Pu Zhibing
2 天以前 546be8a1bafdfc804575a8d07a5d9f2306c29c42
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
<?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.member.mapper.member.MemberSuggestMapper">
 
    <select id="pageAppUserSuggest" resultType="com.ruoyi.member.domain.vo.AppSuggestPageVo">
        SELECT
        suggest_content suggestContent,
        replay_content replayContent,
        shop_replay_content shopReplayContent,
        create_time createTime
        FROM t_member_suggest
        WHERE del_flag = 0 AND create_user_id = #{param.userId}
        AND suggest_type = #{param.suggestType}
        ORDER BY create_time DESC
    </select>
 
    <update id="deleteMemberSuggestTag">
        UPDATE t_member_suggest SET suggest_tags = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', suggest_tags, ','), CONCAT(',',#{suggestTag},','), ','))
        WHERE FIND_IN_SET(#{suggestTag}, suggest_tags) &gt; 0
    </update>
 
 
    <select id="pageMgtMemberSuggest" resultType="com.ruoyi.member.domain.vo.MgtMemberSuggestPageVo">
        SELECT
            tms.suggest_id suggestId,
            tm.real_name userRealName,
            tm.nick_name userNickName,
            CASE tm.gender WHEN 0 THEN "男" WHEN 1 THEN "女" ELSE "未知" END gender,
            tm.mobile userMobile,
            CASE tms.suggest_type WHEN 1 THEN "平台建议" WHEN 2 THEN "店铺建议" ELSE "未知" END suggestType,
            tms.suggest_content suggestContent,
            tms.replay_content replayContent,
            tms.shop_replay_content shopReplayContent,
            CASE tms.replay_flag WHEN 1 THEN "已回复" ELSE "未回复" END suggestStatus,
            tms.create_time createTime,
            tms.replay_user_name replayUserName,
            tms.replay_time replayTime,
            tms.response_time responseTime,
            tms.shop_replay_user_name shopReplayUserName,
            tms.shop_replay_time shopReplayTime,
            tms.shop_response_time shopResponseTime,
            tms.suggest_tags suggestTags,
            tms.shop_id shopId
        FROM
            t_member_suggest tms
        INNER JOIN t_member tm ON tms.create_user_id = tm.user_id
        WHERE tms.del_flag = 0
        <if test="param.keyword!=null and param.keyword !='' and param.shopIds==null">
            AND (tm.real_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.nick_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.mobile LIKE CONCAT('%',#{param.keyword},'%') OR tms.replay_user_name LIKE CONCAT('%',#{param.keyword},'%') OR tms.shop_replay_user_name LIKE CONCAT('%',#{param.keyword},'%'))
        </if>
        <if test="param.keyword!=null and param.keyword !='' and param.shopIds != null">
            AND (tm.real_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.nick_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.mobile LIKE CONCAT('%',#{param.keyword},'%') OR tms.replay_user_name LIKE CONCAT('%',#{param.keyword},'%') OR tms.shop_replay_user_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(tms.shop_id, #{param.shopIds}) > 0)
        </if>
        <if test="param.keyword == null and param.shopIds!=null and param.shopIds!=''">
            AND FIND_IN_SET(tms.shop_id, #{param.shopIds}) > 0
        </if>
        <if test="param.createStartTime!=null and param.createStartTime!=''">
            AND Date(tms.create_time) &gt;= #{param.createStartTime}
        </if>
        <if test="param.createEndTime!=null and param.createEndTime!=''">
            AND Date(tms.create_time) &lt;= #{param.createEndTime}
        </if>
        <if test="param.suggestStatus!=null and param.suggestStatus!=''">
            AND tms.replay_flag = #{param.suggestStatus}
        </if>
        <if test="param.gender!=null">
            AND tm.gender = #{param.gender}
        </if>
        <if test="param.tags!=null and param.tags!=''">
            AND tms.suggest_tags REGEXP #{param.tags}
        </if>
        <if test="param.shopReplayStartTime!=null and param.shopReplayStartTime!=''">
            AND Date(tms.shop_replay_time) &gt;= #{param.shopReplayStartTime}
        </if>
        <if test="param.shopReplayEndTime!=null and param.shopReplayEndTime!=''">
            AND Date(tms.shop_replay_time) &lt;= #{param.shopReplayEndTime}
        </if>
        <if test="param.replayStartTime!=null and param.replayStartTime!=''">
            AND Date(tms.replay_time) &gt;= #{param.replayStartTime}
        </if>
        <if test="param.replayEndTime!=null and param.replayEndTime!=''">
            AND Date(tms.replay_time) &lt;= #{param.replayEndTime}
        </if>
        <if test="param.suggestType!=null and param.suggestType!=''">
            AND tms.suggest_type = #{param.suggestType}
        </if>
        ORDER BY
        <if test="param.suggestSort!=null and param.suggestSort==1">
            tms.response_timestamp ASC,
        </if>
        <if test="param.suggestSort!=null and param.suggestSort==2">
            tms.response_timestamp DESC,
        </if>
        <if test="param.suggestSort!=null and param.suggestSort==3">
            tms.shop_response_timestamp ASC,
        </if>
        <if test="param.suggestSort!=null and param.suggestSort==4">
            tms.shop_response_timestamp DESC,
        </if>
            tms.replay_flag ASC,tms.create_time DESC
    </select>
</mapper>