jiangqs
2023-05-09 0398509aa5f27bd6f987adf3d24eceef56b07b4c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?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.ruoyi.shop.mapper.shop.ShopCertificateMapper">
 
    <resultMap type="ShopCertificate" id="ShopCertificateResult">
        <result property="cerId"    column="cer_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="cerStatus"    column="cer_status"    />
        <result property="shopId"    column="shop_id"    />
        <result property="cerName"    column="cer_name"    />
        <result property="cerNumber"    column="cer_number"    />
        <result property="cerPicture"    column="cer_picture"    />
    </resultMap>
 
    <sql id="selectShopCertificateVo">
        select cer_id, del_flag, cer_status, shop_id, cer_name, cer_number, cer_picture from t_shop_certificate
    </sql>
 
    <select id="selectShopCertificateList" parameterType="ShopCertificate" resultMap="ShopCertificateResult">
        <include refid="selectShopCertificateVo"/>
        <where>
            <if test="cerStatus != null "> and cer_status = #{cerStatus}</if>
            <if test="shopId != null "> and shop_id = #{shopId}</if>
            <if test="cerName != null  and cerName != ''"> and cer_name like concat('%', #{cerName}, '%')</if>
            <if test="cerNumber != null "> and cer_number = #{cerNumber}</if>
            <if test="cerPicture != null  and cerPicture != ''"> and cer_picture = #{cerPicture}</if>
        </where>
    </select>
 
    <select id="selectShopCertificateByCerId" parameterType="Long" resultMap="ShopCertificateResult">
        <include refid="selectShopCertificateVo"/>
        where cer_id = #{cerId}
    </select>
 
    <insert id="insertShopCertificate" parameterType="ShopCertificate" useGeneratedKeys="true" keyProperty="cerId">
        insert into t_shop_certificate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="cerStatus != null">cer_status,</if>
            <if test="shopId != null">shop_id,</if>
            <if test="cerName != null">cer_name,</if>
            <if test="cerNumber != null">cer_number,</if>
            <if test="cerPicture != null">cer_picture,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="cerStatus != null">#{cerStatus},</if>
            <if test="shopId != null">#{shopId},</if>
            <if test="cerName != null">#{cerName},</if>
            <if test="cerNumber != null">#{cerNumber},</if>
            <if test="cerPicture != null">#{cerPicture},</if>
        </trim>
    </insert>
 
    <update id="updateShopCertificate" parameterType="ShopCertificate">
        update t_shop_certificate
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="cerStatus != null">cer_status = #{cerStatus},</if>
            <if test="shopId != null">shop_id = #{shopId},</if>
            <if test="cerName != null">cer_name = #{cerName},</if>
            <if test="cerNumber != null">cer_number = #{cerNumber},</if>
            <if test="cerPicture != null">cer_picture = #{cerPicture},</if>
        </trim>
        where cer_id = #{cerId}
    </update>
 
    <delete id="deleteShopCertificateByCerId" parameterType="Long">
        delete from t_shop_certificate where cer_id = #{cerId}
    </delete>
 
    <delete id="deleteShopCertificateByCerIds" parameterType="String">
        delete from t_shop_certificate where cer_id in
        <foreach item="cerId" collection="array" open="(" separator="," close=")">
            #{cerId}
        </foreach>
    </delete>
 
    <select id="listShopCertificateVo" resultType="com.ruoyi.shop.domain.vo.MerShopCertificateListVo">
        SELECT
        cer_id cerId,
        cer_name cerName,
        cer_number cerNumber,
        cer_picture cerPicture
        FROM t_shop_certificate
        WHRER del_flag = 0 AND shop_id = #{param.shopId}
        <if test="param.status != null and param.status == 1">
            AND cer_status = 1
        </if>
        <if test="param.status != null and param.status == 2">
            AND (cer_status = 0 OR  cer_status = 2)
        </if>
    </select>
</mapper>