1. 批量更新:
@Update({"<script>" + "<foreach collection=\"smsConfigTemplateList\" item=\"item\" separator=\";\">" + " UPDATE" + " mt_message_template" + " SET pushapp_type = #{item.pushAppType, jdbcType=VARCHAR}, " + " message_title = #{item.messageTitle, jdbcType=VARCHAR}, " + " message_content = #{item.messageContent, jdbcType=VARCHAR}, " + " template_id_weixin = #{item.emplateIdWeixin, jdbcType=VARCHAR}, " + " template_weixin = #{item.templateWeixin, jdbcType=VARCHAR}, " + " template_alipay = #{item.templateAlipay, jdbcType=VARCHAR}, " + " template_id_zhifubao = #{item.templateIdZhifubao, jdbcType=VARCHAR}, " + " modifiedon = #{item.modifiedon, jdbcType=TIMESTAMP}, " + " modifiedby = #{item.modifiedby, jdbcType=VARCHAR} " + " WHERE " + " message_template_id = #{item.messageTemplateId, jdbcType=VARCHAR} " + " AND deletion_state = '0' " + "</foreach>" + "</script>"}) void update(@Param("smsConfigTemplateList") List<SmsConfigTemplate> smsConfigTemplateList);
2. 批量新增:
@Insert({"<script>" + "INSERT INTO mt_message_template (" + "message_template_id,\n" + "message_template_head_id,\n" + "message_title,\n" + "message_content,\n" + "pushapp_type,\n" + "platform_hospital_id,\n" + "template_id_weixin,\n" + "template_weixin,\n" + "template_alipay,\n" + "template_id_zhifubao,\n" + "createdby,\n" + "createdon,\n" + "modifiedby,\n" + "modifiedon,\n" + "deletion_state)" + "values " + "<foreach collection=\"mtMessageTemplateList\" item=\"item\" separator=\",\">" + "(#{item.messageTemplateId}, #{item.messageTemplateHeadId}, " + "#{item.messageTitle}, #{item.messageContent}, " + "#{item.pushAppType}, #{item.platformHospitalId}, " + "#{item.emplateIdWeixin}, #{item.templateWeixin}, " + "#{item.templateAlipay}, #{item.templateIdZhifubao}, " + "#{item.createdby}, #{item.createdon}, " + "#{item.modifiedby}, #{item.modifiedon}, " + "#{item.deletionState})" + "</foreach>" + "</script>"}) void insert(@Param("mtMessageTemplateList") List<MtMessageTemplate> mtMessageTemplateList);
转载于:https://www.cnblogs.com/miaoying/p/10007078.html