MyIbatis调用Oracle存储过程
1、xml文件 lt;select id=getGroupNum statementType=CALLABLE parameterType=com.guorui.model.ParamSPCgt;{call GYL_C
1、xml文件
2、parameter bean
public class ParamSPC {
String IN_PARAMETERID;
String IN_STEELID;
Integer OUT_GN;
List
public String getIN_PARAMETERID() {
return IN_PARAMETERID;
}
public void setIN_PARAMETERID(String iN_PARAMETERID) {
IN_PARAMETERID = iN_PARAMETERID;
}
public String getIN_STEELID() {
return IN_STEELID;
}
public void setIN_STEELID(String iN_STEELID) {
IN_STEELID = iN_STEELID;
}
public Integer getOUT_GN() {
return OUT_GN;
}
public void setOUT_GN(Integer oUT_GN) {
OUT_GN = oUT_GN;
}
public List
return RST;
}
public void setRST(List
RST = rST;
}
}
3、xxxMaper.java 中的方法
Object getGroupNum(ParamSPC param);
4、使用demo
SqlSession session = AllSqlMap.getInstance().openSession();
try {
TbSysUserMapper mapper = session.getMapper(TbSysUserMapper.class);
ParamSPC param = new ParamSPC();
param.setIN_PARAMETERID("010401"); // 填充 in 参数,,out 参数不用任何处理
param.setIN_STEELID("65Mn棒带");
mapper.getGroupNum(param);
System.out.println(param.getOUT_GN()); // 获取计算结果
System.out.println(param.getRST().size());
session.commit(true);
} catch(Exception e){
e.printStackTrace();
session.rollback(true);
} finally {
session.close();
}