bug
jiangqs
2023-08-25 156e141e55a8abf486157d1fa89d25e23f4a06a3
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
<?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.task.ShopFileMapper">
 
    <resultMap type="ShopFile" id="ShopFileResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="shopId"    column="shop_id"    />
        <result property="fileType"    column="file_type"    />
        <result property="fileUrl"    column="file_url"    />
    </resultMap>
 
    <sql id="selectShopFileVo">
        select id, del_flag, shop_id, file_type, file_url from t_shop_file
    </sql>
 
    <select id="selectShopFileList" parameterType="ShopFile" resultMap="ShopFileResult">
        <include refid="selectShopFileVo"/>
        <where>
            <if test="shopId != null "> and shop_id = #{shopId}</if>
            <if test="fileType != null "> and file_type = #{fileType}</if>
            <if test="fileUrl != null  and fileUrl != ''"> and file_url = #{fileUrl}</if>
        </where>
    </select>
 
    <select id="selectShopFileById" parameterType="Long" resultMap="ShopFileResult">
        <include refid="selectShopFileVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertShopFile" parameterType="ShopFile" useGeneratedKeys="true" keyProperty="id">
        insert into t_shop_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="shopId != null">shop_id,</if>
            <if test="fileType != null">file_type,</if>
            <if test="fileUrl != null">file_url,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="shopId != null">#{shopId},</if>
            <if test="fileType != null">#{fileType},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
        </trim>
    </insert>
 
    <update id="updateShopFile" parameterType="ShopFile">
        update t_shop_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="shopId != null">shop_id = #{shopId},</if>
            <if test="fileType != null">file_type = #{fileType},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteShopFileById" parameterType="Long">
        delete from t_shop_file where id = #{id}
    </delete>
 
    <delete id="deleteShopFileByIds" parameterType="String">
        delete from t_shop_file where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="deleteByShopId">
        UPDATE t_shop_file SET del_flag = 1 WHERE shop_id = #{shopId}
    </update>
 
</mapper>