mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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.ConvenientProductSpecificationDAO">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientProductSpecificationDO">
                <id column="id" property="id" />
                <id column="name" property="name" />
                <id column="price" property="price" />
                <id column="image" property="image" />
                <id column="product_id" property="productId" />
                <id column="is_del" property="isDel" />
                <id column="created_at" property="createdAt" />
                <id column="created_by" property="createdBy" />
                <id column="updated_at" property="updatedAt" />
                <id column="updated_by" property="updatedBy" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
    id,`name`,price,image,product_id,is_del,created_at,created_by,updated_at,updated_by
    </sql>
    <insert id="batchInsert">
        INSERT INTO `com_convenient_product_specifications`(name,price,image,product_id,created_at,created_by)
        VALUES
        <foreach collection="productSpecificationDOList" item="item" index="index" separator="," >
            (#{item.name}, #{item.price}, #{item.image}, #{item.productId}, #{item.createdAt}, #{item.createdBy})
        </foreach>
    </insert>
    <update id="deleteLoseRelationSpecifications" parameterType="java.util.List">
        UPDATE com_convenient_product_specifications SET is_del = 1
        WHERE product_id = #{productId} AND id NOT IN
        <foreach collection="notNeedDelIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
    <update id="batchDeleteByProductIds">
        UPDATE com_convenient_product_specifications SET is_del = 1
        WHERE id IN
        <foreach collection="needDelProductIds" open="(" separator="," close=")" index="index" item="item">
            #{item}
        </foreach>
    </update>
 
 
</mapper>