主题:[讨论]关于java代码转sql存储过程的问题,请帮帮忙!谢谢!
我有这样一段java代码,现在想把它转换成sql存储过程的形式,请问应该如何编写,小弟初学,谢谢知道的帮帮我!!万分感谢!
public class My998808caoZhonghe {
public MyBeanUsermsg getRmsg(Connection conn, MyBeanUsermsg pbu) {
MyBeanUsermsg bu = pbu;
int step = Integer.parseInt(bu.getStep().trim());
String msg = bu.getMsg().trim();
String sheng = bu.getSheng().trim();//省市
String usernumber = bu.getUsernumber().trim();//用户名
if (new MyMain().bprintln) {
System.out.println("My998808caoZhonghe开始执行step=" + step);
}
String rmsg = "";
if (false) {
}
else if (step <= 1) {
rmsg = "a";
bu.setStep( (1 + 1) + "");
bu.setRmsg(rmsg);
}
else if (step <= 2) {
if (msg.equals("6*1")) {
rmsg = "a" + sheng ;
bu.setStep( (611 + 1) + "");
}
else if (msg.equals("6*2")) {
rmsg = "b" + mmgetusernumberlast4(usernumber);
bu.setStep( (621 + 1) + "");
}
else { //if (msg.equals("6*3"))
rmsg = "c";
bu.setStep( (631 + 1) + "");
}
bu.setRmsg(rmsg);
}
return bu;
}
private String getrmsglast(String pusernumber) {
String rmsg = "";
String usernumber = pusernumber;
if (usernumber.endsWith("1")) {
rmsg = "abc";
}
else if (usernumber.endsWith("2")) {
rmsg = "def";
return rmsg;
}
//12位随机数
public String mmget12Random() {
String rs = "";
for (int i = 0; i < 12; i++) {
rs = rs + ("" + new Random().nextInt(10)).trim().substring(0, 1);
}
return rs;
}
}
public class My998808caoZhonghe {
public MyBeanUsermsg getRmsg(Connection conn, MyBeanUsermsg pbu) {
MyBeanUsermsg bu = pbu;
int step = Integer.parseInt(bu.getStep().trim());
String msg = bu.getMsg().trim();
String sheng = bu.getSheng().trim();//省市
String usernumber = bu.getUsernumber().trim();//用户名
if (new MyMain().bprintln) {
System.out.println("My998808caoZhonghe开始执行step=" + step);
}
String rmsg = "";
if (false) {
}
else if (step <= 1) {
rmsg = "a";
bu.setStep( (1 + 1) + "");
bu.setRmsg(rmsg);
}
else if (step <= 2) {
if (msg.equals("6*1")) {
rmsg = "a" + sheng ;
bu.setStep( (611 + 1) + "");
}
else if (msg.equals("6*2")) {
rmsg = "b" + mmgetusernumberlast4(usernumber);
bu.setStep( (621 + 1) + "");
}
else { //if (msg.equals("6*3"))
rmsg = "c";
bu.setStep( (631 + 1) + "");
}
bu.setRmsg(rmsg);
}
return bu;
}
private String getrmsglast(String pusernumber) {
String rmsg = "";
String usernumber = pusernumber;
if (usernumber.endsWith("1")) {
rmsg = "abc";
}
else if (usernumber.endsWith("2")) {
rmsg = "def";
return rmsg;
}
//12位随机数
public String mmget12Random() {
String rs = "";
for (int i = 0; i < 12; i++) {
rs = rs + ("" + new Random().nextInt(10)).trim().substring(0, 1);
}
return rs;
}
}