<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.panzhihua.service_community.dao.McsProductLabelDAO">
|
|
<resultMap type="com.panzhihua.service_community.entity.McsProductLabel" id="McsProductLabelMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="productId" column="product_id" jdbcType="INTEGER"/>
|
<result property="labelId" column="label_id" jdbcType="INTEGER"/>
|
<result property="labelName" column="label_name" jdbcType="VARCHAR"/>
|
</resultMap>
|
|
<!-- 批量插入 -->
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.mcs_product_label(product_id, label_id, label_name)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.productId}, #{entity.labelId}, #{entity.labelName})
|
</foreach>
|
</insert>
|
<!-- 批量插入或按主键更新 -->
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.mcs_product_label(product_id, label_id, label_name)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.productId}, #{entity.labelId}, #{entity.labelName})
|
</foreach>
|
on duplicate key update
|
product_id = values(product_id) , label_id = values(label_id) , label_name = values(label_name)
|
</insert>
|
|
</mapper>
|