批量插入
<insert id="insertIndi" parameterType="java.util.HashMap" useGeneratedKeys="false">
<foreach collection="datalist" item="item" index="index" open="begin" close="; end;" separator=";">
insert into fpmv_indi_exectemp(${lineColumn}) values
<foreach collection="item.values" index="key" item="_value" open="(" close=")" separator=",">
#{_value}
</foreach>
</foreach>
</insert>
查询无匹配找默认
<select id="getIndiRefList" parameterType="java.util.HashMap"  resultType="java.util.HashMap">
select * from T_FPDICTYPE where govid = '0' and govyear = '0' and not exists(
select 1 from t_fpdictype where 1 = 1
<if test="year != null">
and trim(govyear) = #{year,jdbcType=VARCHAR}
</if>
<if test = "province != null">
and trim(govid) = #{province,jdbcType=VARCHAR}
</if>
)
union (
select * from t_fpdictype where 1 = 1
<if test="year != null">
and trim(govyear) = #{year,jdbcType=VARCHAR}
</if>
<if test = "province != null">
and trim(govid) = #{province,jdbcType=VARCHAR}
</if>
)

</select>
posted on 2018-09-05 10:43  ..SunXin  阅读(303)  评论(0编辑  收藏  举报