spring ibatis操作CLOB

 public void recordOrder(OrderLogPojo orderLog) {
  if (null != orderLog) {
   this.getSqlMapClientTemplate().insert("CBSInterfaceConfigBusinessDaoImpl.insertInterfaceExcuteLog", orderLog);
   updateColunmClob(orderLog);
  }
 }
 /**
  * 更新clob字段
  * @param orderLog
  */
 public void updateColunmClob(OrderLogPojo orderLog){
  //入参clob
  Map<String,String> inMap = new HashMap<String,String>();
  String inmsg = orderLog.getInmsg();
  if (null != inmsg && !("".equals(inmsg))) {
   while (inmsg.length() > 500) {
    String temp = inmsg.substring(0, 500);
    inMap.put("inmsg", temp);
    inMap.put("logId", orderLog.getLogId());
    this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updateInmsgClob", inMap);
    inmsg = inmsg.substring(500);
   }
   inMap.put("inmsg", inmsg);
   inMap.put("logId", orderLog.getLogId());
   this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updateInmsgClob", inMap);
  }
  
  //出参clob
  Map<String, String> outMap = new HashMap<String, String>();
  String outmsg = orderLog.getOutmsg();
  if (null != outmsg && !("".equals(outmsg))) {
   while (outmsg.length() > 500) {
    String temp = outmsg.substring(0, 500);
    outMap.put("outmsg", temp);
    outMap.put("logId", orderLog.getLogId());
    this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updateOutmsgClob", outMap);
    outmsg = outmsg.substring(500);
   }
   outMap.put("outmsg", outmsg);
   outMap.put("logId", orderLog.getLogId());
   this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updateOutmsgClob", outMap);
  }
  
  //异常提示clob
  Map<String, String> errMap = new HashMap<String, String>();
  String errmsg = orderLog.getErrmsg();
  if (null != errmsg && !("".equals(errmsg))) {
   while (errmsg.length() > 500) {
    String temp = errmsg.substring(0, 500);
    errMap.put("errmsg", temp);
    errMap.put("logId", orderLog.getLogId());
    this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updatErrClob", errMap);
    errmsg = errmsg.substring(500);
   }
   errMap.put("errmsg", errmsg);
   errMap.put("logId", orderLog.getLogId());
   this.getSqlMapClientTemplate().update("CBSInterfaceConfigBusinessDaoImpl.updatErrClob", errMap);
  }
 }
 
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" " http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="CBSInterfaceConfigBusinessDaoImpl">
 
 <typeAlias alias="OrderLogPojo"   type="com.timesontransfar.cbsintf.pojo.OrderLogPojo"   />
 
 <typeAlias alias="hashMap" type="java.util.HashMap" />
 <typeAlias alias="string"  type="java.lang.String"  />
 <typeAlias alias="int"     type="java.lang.Integer" />
 
 <insert id="insertInterfaceExcuteLog" parameterClass="OrderLogPojo">
  insert into TB_ORD_INTERFACE_LOG
        (LOG_ID,
        INTERFACE_NAME,
        METHOD_NAME,
        EXCUTETIME,
        COMPLETETIME,
        RETFLAG,
        PROD_ORDER_ID,
        APP_NO,
        INMSG,
        OUTMSG,
        ERRMSG,
        TIME_LONG,
        RECALL_FLAG,
        REGION_ID)
  VALUES
  (#logId:VARCHAR#,        
   #interfaceName:VARCHAR#,
   #methodName:VARCHAR#,
   SYSDATE,
   SYSDATE,
   #retFlag:VARCHAR#,
   #prodOrderId:VARCHAR#,
   #appNo:VARCHAR#,
   empty_clob(),
   empty_clob(),
   empty_clob(),
   #longTime:VARCHAR#,
   #recallFlag:VARCHAR#,
   #regionId:VARCHAR#)
 </insert>
 <update id="updateInmsgClob" parameterClass="hashMap">
     UPDATE TB_ORD_INTERFACE_LOG
     SET INMSG = INMSG|| #inmsg:CLOB#
     where LOG_ID = #logId:VARCHAR#
 </update>
 <update id="updateOutmsgClob" parameterClass="hashMap">
     UPDATE TB_ORD_INTERFACE_LOG
     SET OUTMSG = OUTMSG|| #outmsg:CLOB#
     where LOG_ID = #logId:VARCHAR#
 </update>
 <update id="updatErrClob" parameterClass="hashMap">
     UPDATE TB_ORD_INTERFACE_LOG
     SET ERRMSG = ERRMSG|| #errmsg:CLOB#
     where LOG_ID = #logId:VARCHAR#
 </update>
</sqlMap>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值