• mybatis 注解形式设置批量新增、批量更新数据


    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,
    " +
                "message_template_head_id,
    " +
                "message_title,
    " +
                "message_content,
    " +
                "pushapp_type,
    " +
                "platform_hospital_id,
    " +
                "template_id_weixin,
    " +
                "template_weixin,
    " +
                "template_alipay,
    " +
                "template_id_zhifubao,
    " +
                "createdby,
    " +
                "createdon,
    " +
                "modifiedby,
    " +
                "modifiedon,
    " +
                "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);

  • 相关阅读:
    PYTHON 爬虫笔记八:利用Requests+正则表达式爬取猫眼电影top100(实战项目一)
    PYTHON 爬虫笔记七:Selenium库基础用法
    PYTHON 爬虫笔记六:PyQuery库基础用法
    java练习题(六)
    js练习题(三)
    js练习题(一)
    表格
    MAYA网络Z1J10928
    //绑定select下拉框change事件只执行一次
    枚举数组转换字符串
  • 原文地址:https://www.cnblogs.com/miaoying/p/10007078.html
Copyright © 2020-2023  润新知