or子句
实体类里创建 private List<String> aL;
<if test="aL != null ">
and
<foreach collection="aL" item="item" index="index" open="(" close=")" separator="or">
字段名 = #{aL[${index}]}
</foreach>
</if>
in 子句
<if test="aL != null ">
and 字段名 in
<foreach collection="aL" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
批修改
<update id="update" useGeneratedKeys="false" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
update 表名
<set>
<if test="item.dutyUserId != null" >
DUTY_USER_ID = #{item.dutyUserId},
</if>
<if test="item.status != null">
STATUS =#{item.status},
</if>
</set>
where PROC_ID = #{item.procId}
</foreach>
</update>
批添加
<insert id="batchInsertLog" useGeneratedKeys="false" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
insert into 表名
<trim prefix="(" suffix=")" suffixOverrides="," >
LOG_ID,
<if test="item.staffId != null and item.staffId != ''">
STAFF_ID,
</if>
<if test="item.category != null and item.category !=''">
CATEGORY,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
WO_ORDER_LOG_SEQ.Nextval,
<if test="item.staffId != null and item.staffId != ''">
#{item.staffId},
</if>
<if test="item.category != null and item.category !=''">
#{item.category},
</if>
</trim>
</foreach>
</insert>