when grid_code = #{item.gridCode} then #{item.deptIdQx}
</if>
</foreach>
</trim>
<trimprefix="dept_name_qx =(case"suffix="end),">
<foreachcollection="list"item="item">
<iftest='null != item.deptNameQx'>
when grid_code = #{item.gridCode} then #{item.deptNameQx}
</if>
</foreach>
</trim>
</trim>
WHERE
1=1
<foreachcollection="list"item="item"open="AND( "separator=" OR "index="index"close=")">
grid_code = #{item.gridCode}
</foreach>
</update>
<insertid="insertBatch">
INSERT INTO ex_dept
(
dept_id_qx,
dept_name_qx
)
VALUES
<foreachcollection="list"item="i"separator=",">
(
#{i.deptIdQx},
#{i.deptNameQx}
)
</foreach>
ON DUPLICATE KEY
UPDATE
dept_id_qx = values(dept_id_qx),
dept_name_qx = values(dept_name_qx)
</insert>
<updateid="updateBatchGrid">
UPDATE ex_dept
<trimprefix="set"suffixOverrides=",">
<trimprefix="dept_id_qx =(case"suffix="end),">
<foreachcollection="list"item="item">
<iftest='null != item.deptIdQx'>
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptIdQx}
</if>
</foreach>
</trim>
<trimprefix="dept_name_qx =(case"suffix="end),">
<foreachcollection="list"item="item">
<iftest='null != item.deptNameQx'>
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptNameQx}
</if>
</foreach>
</trim>
</trim>
WHERE
1=1
<foreachcollection="list"item="item"open="AND( "separator=" OR "index="index"close=")">
dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1'))