<insert id="saveOrUpdate" parameterType="com.zhongan.crm.dataobject.TContactPerson"> insert into t_contact_person ( <include refid="FieldsOfTContactPersonWithoutId" /> ) values ( #{customerInfoId}, #{duty}, #{name}, #{dept}, #{phone}, #{telephone}, #{email}, #{address}, #{province}, #{city}, #{area}, #{ownerBdDept}, #{weibo}, #{zipCode}, #{gender}, #{birthday}, #{gmtCreated}, #{gmtModified}, #{creator}, #{modifier}, #{isDeleted} ) on duplicate key update customer_info_id=#{customerInfoId}, duty=#{duty}, name=#{name}, dept=#{dept}, phone=#{phone}, telephone=#{telephone}, email=#{email}, address=#{address}, province=#{province}, city=#{city}, area=#{area}, owner_bd_dept=#{ownerBdDept}, weibo=#{weibo}, zip_code=#{zipCode}, gender=#{gender}, birthday=#{birthday}, gmt_created=#{gmtCreated}, gmt_modified=#{gmtModified}, creator=#{creator}, modifier=#{modifier}, is_deleted=#{isDeleted}</insert> <insert id="batchSave" parameterType="java.util.List"> insert into t_contact_person(<include refid="FieldsOfTContactPersonWithoutId" />) values <foreach collection="list" item="item" index="index" separator=","> (#{item.customerInfoId}, #{item.duty}, #{item.name}, #{item.dept}, #{item.phone}, #{item.telephone}, #{item.email}, #{item.address}, #{item.province}, #{item.city}, #{item.area}, #{item.ownerBdDept}, #{item.weibo}, #{item.zipCode}, #{item.gender}, #{item.birthday}, #{item.gmtCreated}, #{item.gmtModified}, #{item.creator}, #{item.modifier}, #{item.isDeleted}) </foreach> </insert> <update id="batchUpdate" parameterType="java.util.List"> <foreach collection="list" item="item" index="index" open="" close="" separator=";"> update t_contact_person <set> customer_info_id=#{item.customerInfoId}, duty=#{item.duty}, name=#{item.name}, dept=#{item.dept}, phone=#{item.phone}, telephone=#{item.telephone}, email=#{item.email}, address=#{item.address}, province=#{item.province}, city=#{item.city}, area=#{item.area}, owner_bd_dept=#{item.ownerBdDept}, weibo=#{item.weibo}, zip_code=#{item.zipCode}, gender=#{item.gender}, birthday=#{item.birthday}, gmt_created=#{item.gmtCreated}, gmt_modified=#{item.gmtModified}, creator=#{item.creator}, modifier=#{item.modifier}, is_deleted=#{item.isDeleted} </set> where id = #{item.id} </foreach> </update> <delete id="batchDelete" parameterType="java.util.List"> delete from t_contact_person where id in <foreach item="item" index="index" collection="list" open="(" separator=", " close=")"> #{item} </foreach> </delete>
mybatis 批量增删改
最新推荐文章于 2023-09-17 23:10:03 发布