标签:rac 入库 code exce ack table val ble hash
一.xml层
<!--批量入库-->
<insert id="addSecCodeList" parameterClass="java.util.HashMap">
<![CDATA[
BEGIN
]]>
<iterate property="secCodeList">
INSERT
INTO A_TABLE A
(
A.ID,
A.SECURITYNO,
A.BATCHNO,
A.ISDELETE
)
VALUES
(SEQ_SEC.nextval,#secCodeList[]#,#batchNo#,‘0‘);
</iterate>
<![CDATA[
END;
]]>
</insert>
二.action层
//批量生成
for (int i = 0; i < num; i++) {
sb.append(scu.createSecCode(productNo));
sb.append(",");
System.out.println("i="+i);
}
String securityNo = sb.toString();
securityNo=securityNo.substring(0,securityNo.length() -1);
//ibatis批量入库
Map<String, Object> mapList=new HashMap<String, Object>();
mapList.put("securityNo", securityNo);
mapList.put("batchNo", batchNo);
batchService.addSecCodeList(mapList);
三.serviceImpl层
/**
*批量入库
*/
public String addSecCodeList(Map<String, Object> map){
String securityNo=ConvertUtils.obj2Str(map.get("securityNo"),"");
String [] sn=securityNo.split(",");
map.put("secCodeList", sn);
return batchDao.addSecCodeList(map);
}
四.daoImpl层
/**
*批量入库
*/
public String addSecCodeList(Map<String, Object> map){
try {
super.getSqlMapClientTemplate().insert("addSecCodeList", map);
return "true";
} catch (DataAccessException e) {
e.printStackTrace();
return "false";
}
}
标签:rac 入库 code exce ack table val ble hash
原文地址:https://www.cnblogs.com/guangxiang/p/10337904.html