1、xml文件
<select id="getGroupNum" statementType="CALLABLE" parameterType="com.guorui.model.ParamSPC">
{call GYL_COMMON.GETGROUPNUM(
#{IN_PARAMETERID,jdbcType=VARCHAR,mode=IN},
#{IN_STEELID,jdbcType=VARCHAR,mode=IN},null,null,null,
-
#{OUT_GN,jdbcType=INTEGER,mode=OUT},
#{RST,jdbcType=CURSOR,mode=OUT,resultMap=BaseResultMap2,javaType=java.sql.ResultSet})}
</select>
<resultMap id="BaseResultMap2" type="com.guorui.dao.TbSySUSEr">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Nov 15 19:49:43 CST 2010.
-->
<result column="USERID" jdbcType="DECIMAL" property="userid" />
<result column="NUSERID" jdbcType="VARCHAR" property="nuserid" />
<result column="STRUSERNAME" jdbcType="VARCHAR" property="strusername" />
<result column="STRDEP" jdbcType="VARCHAR" property="strdep" />
<result column="STRDUTY" jdbcType="VARCHAR" property="strduty" />
<result column="STRUSERPWD" jdbcType="VARCHAR" property="struserpwd" />
<result column="DTINSDATE" jdbcType="TIMESTAMP" property="dtinsdate" />
<result column="STRINSBY" jdbcType="VARCHAR" property="strinsby" />
<result column="DTUPTDATE" jdbcType="TIMESTAMP" property="dtuptdate" />
<result column="STRUPTBY" jdbcType="VARCHAR" property="struptby" />
<result column="LOGIN_COUNT" jdbcType="DECIMAL" property="loginCount" />
<result column="LOGIN_LAST_TIME" jdbcType="TIMESTAMP" property="loginLastTime" />
<result column="STATUS" jdbcType="VARCHAR" property="status" />
<result column="STRDEPNO" jdbcType="VARCHAR" property="strdepno" />
</resultMap>
2、parameter bean
public class ParamSPC {
String IN_PARAMETERID;
String IN_STEELID;
Integer OUT_GN;
List<TbSySUSEr> RST;
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<TbSySUSEr> getRST() {
return RST;
}
public void setRST(List<TbSySUSEr> rST) {
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 參數(shù),out 參數(shù)不用任何處理
param.setIN_STEELID("65Mn棒帶");
mapper.getGroupNum(param);
System.out.println(param.getOUT_GN()); // 獲取計算結(jié)果
System.out.println(param.getRST().size());
session.commit(true);
} catch(Exception e){
e.printStackTrace();
session.rollback(true);
} finally {
session.close();
} 本文出自:億恩科技【1tcdy.com】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|