mybatis批量插入
1. INSERT INTO test (a, b, c) VALUES
<foreach collection="list" item="item" separator=",">
(#{item.a}, #{item.b}, #{item.c})
</foreach>
2. <select id="insertBatchBillWechat" parameterType="List">
BEGIN
<foreach collection ="list" item="billWechat" index="index" separator =";">
INSERT INTO t_bill_wechat
(lsh,jysj ,appid ,mchid , sonmchid,wechatorder ,shddh, userid,jylx , jystatus,fkryh ,hbzl ,zje ,qyhbje,wechattkorder ,shtkorder ,tkje ,qyhbtkje ,tklx ,tkzt ,shmc , sxf,fl ,xzqhdm ,jktzsbh ,zsdwbm ,tzslx,bankid,pay_code )
VALUES
(T_BILL_WECHAT_SEQ.Nextval,#{billWechat.jysj} ,#{billWechat.appid} ,#{billWechat.mchid} , #{billWechat.sonmchid},#{billWechat.wechatorder} , #{billWechat.shddh}, #{billWechat.userid},#{billWechat.jylx} , #{billWechat.jystatus},#{billWechat.fkryh} ,#{billWechat.hbzl} ,#{billWechat.zje},#{billWechat.qyhbje} ,#{billWechat.wechattkorder} ,#{billWechat.shtkorder} ,#{billWechat.tkje} ,#{billWechat.qyhbtkje} ,#{billWechat.tklx} ,#{billWechat.tkzt} ,#{billWechat.shmc} , #{billWechat.sxf},#{billWechat.fl} ,#{billWechat.xzqhdm} ,#{billWechat.jktzsbh} ,#{billWechat.zsdwbm} ,#{billWechat.tzslx},#{billWechat.bankid} ,#{billWechat.pay_code})
</foreach >
;END ;
</select>
inser各字段判断
<insert id="addConfigMerid" parameterType="com.hisun.fspay.domain.TConfigMerid">
insert into t_config_merid
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="czqhnm != null">
CZQHNM,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="czqhnm != null">
#{czqhnm,jdbcType=VARCHAR},
</if>
</trim>
</insert>
调用包中过程
<select id="checkSffs" parameterType="com.vision.czzh.modules.base.entity.ZwJcsjEntity" resultType="java.lang.Object" statementType="CALLABLE">
<![CDATA[
{
call pkg_acc_checkfs.test(
#{kmdm,mode=IN,jdbcType=VARCHAR},
#{out_result,mode=OUT,jdbcType=VARCHAR,javaType=String})
}
]]>
</select>
like '${timestart}%'
= #{timestart}