jiangqs
2023-06-06 0f9d03ee930d1c2dc62b34dd2c3522cda91f93cf
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?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.ShopTaskMapper">
 
    <resultMap type="ShopTask" id="ShopTaskResult">
        <result property="taskId"    column="task_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="shopId"    column="shop_id"    />
        <result property="followType"    column="follow_type"    />
        <result property="followContent"    column="follow_content"    />
        <result property="nextFollowDate"    column="next_follow_date"    />
        <result property="taskTitle"    column="task_title"    />
        <result property="emergencyState"    column="emergency_state"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
 
    <sql id="selectShopTaskVo">
        select task_id, del_flag, shop_id, follow_type, follow_content, next_follow_date, task_title, emergency_state, create_time from t_shop_task
    </sql>
 
    <select id="selectShopTaskList" parameterType="ShopTask" resultMap="ShopTaskResult">
        <include refid="selectShopTaskVo"/>
        <where>
            <if test="shopId != null "> and shop_id = #{shopId}</if>
            <if test="followType != null "> and follow_type = #{followType}</if>
            <if test="followContent != null  and followContent != ''"> and follow_content = #{followContent}</if>
            <if test="nextFollowDate != null "> and next_follow_date = #{nextFollowDate}</if>
            <if test="taskTitle != null  and taskTitle != ''"> and task_title = #{taskTitle}</if>
            <if test="emergencyState != null "> and emergency_state = #{emergencyState}</if>
        </where>
    </select>
 
    <select id="selectShopTaskByTaskId" parameterType="String" resultMap="ShopTaskResult">
        <include refid="selectShopTaskVo"/>
        where task_id = #{taskId}
    </select>
 
    <insert id="insertShopTask" parameterType="ShopTask">
        insert into t_shop_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskId != null">task_id,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="shopId != null">shop_id,</if>
            <if test="followType != null">follow_type,</if>
            <if test="followContent != null">follow_content,</if>
            <if test="nextFollowDate != null">next_follow_date,</if>
            <if test="taskTitle != null">task_title,</if>
            <if test="emergencyState != null">emergency_state,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskId != null">#{taskId},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="shopId != null">#{shopId},</if>
            <if test="followType != null">#{followType},</if>
            <if test="followContent != null">#{followContent},</if>
            <if test="nextFollowDate != null">#{nextFollowDate},</if>
            <if test="taskTitle != null">#{taskTitle},</if>
            <if test="emergencyState != null">#{emergencyState},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>
 
    <update id="updateShopTask" parameterType="ShopTask">
        update t_shop_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="shopId != null">shop_id = #{shopId},</if>
            <if test="followType != null">follow_type = #{followType},</if>
            <if test="followContent != null">follow_content = #{followContent},</if>
            <if test="nextFollowDate != null">next_follow_date = #{nextFollowDate},</if>
            <if test="taskTitle != null">task_title = #{taskTitle},</if>
            <if test="emergencyState != null">emergency_state = #{emergencyState},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where task_id = #{taskId}
    </update>
 
    <delete id="deleteShopTaskByTaskId" parameterType="String">
        delete from t_shop_task where task_id = #{taskId}
    </delete>
 
    <delete id="deleteShopTaskByTaskIds" parameterType="String">
        delete from t_shop_task where task_id in
        <foreach item="taskId" collection="array" open="(" separator="," close=")">
            #{taskId}
        </foreach>
    </delete>
 
    <select id="pageMgtAgencyFollow" resultType="com.ruoyi.shop.domain.vo.MgtAgencyTaskRecordPageVo">
        SELECT
        tmtr.user_id userId,
        tmtr.id followId,
        tmtr.task_id taskId,
        tmtr.create_time createTime,
        tmtr.follow_type followType,
        tmtr.call_time callTime,
        tmtr.follow_content followContent,
        tmtr.call_phone callPhone
        FROM t_agency_task tmt
        INNER JOIN t_agency_task_record tmtr ON tmtr.task_id = tmt.task_id
        WHERE tmt.del_flag = 0 AND tmt.agency_id = #{param.shopId}
        ORDER BY tmtr.create_time DESC
    </select>
 
 
 
</mapper>