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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?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_grid.dao.ComActEasyPhotoMapper">
 
     <resultMap id="baseResult" type="com.panzhihua.service_grid.model.dos.ComActEasyPhotoDO">
        <result property="id" column="id"/>
        <result property="sponsorId" column="sponsor_id"/>
        <result property="happenAddr" column="happen_addr"/>
        <result property="addrRemark" column="addr_remark"/>
        <result property="status" column="status"/>
        <result property="handlerId" column="handler_id"/>
        <result property="createAt" column="create_at"/>
        <result property="examineAt" column="examine_at"/>
        <result property="detail" column="detail"/>
        <result property="photoPathList" column="photo_path_list"/>
        <result property="handleResult" column="handle_result"/>
        <result property="handlePhotoList" column="handle_photo_list"/>
        <result property="communityId" column="community_id"/>
        <result property="isHide" column="is_hide"/>
        <result property="isNeedFeedBack" column="is_need_feed_back"/>
        <result property="feedbackAt" column="feedback_at"/>
        <result property="rejectReason" column="reject_reason"/>
        <result property="delTag" column="del_tag"/>
        <result property="isReport" column="is_report"/>
        <result property="isPublicity" column="is_publicity"/>
        <result property="handleStatus" column="handle_status"/>
    </resultMap>
 
    <sql id="columns">
    <![CDATA[
        id,sponsor_id,happen_addr,addr_remark,status,handler_id,create_at,examine_at,detail,photo_path_list,handle_result,handle_photo_list,community_id,is_hide,is_need_feed_back,feedback_at,reject_reason,del_tag,is_report,is_publicity
    ]]>
    </sql>
 
 
    <select id="findByPage" resultType="com.panzhihua.common.model.vos.grid.ComActEasyPhotoVO"
        parameterType="com.panzhihua.common.model.dtos.grid.PageEasyAppDTO">
        SELECT
        caep.id,
        su.nick_name,
        su.image_url,
        caep.sponsor_id,
        caep.detail,
        caep.create_at,
        caep.`status`,
        caep.is_publicity,
        caep.photo_path_list,
        caep.happen_addr,
        caep.addr_remark,
        caep.handle_status,
        caep.is_report
        FROM
        com_act_easy_photo AS caep
        LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id
        <where>
            AND caep.del_tag = 0
            <if test="easyAppDTO.communityId!=null">
                AND caep.community_id = ${easyAppDTO.communityId}
            </if>
           <if test="easyAppDTO.isReport!=null">
                AND caep.is_report = #{easyAppDTO.isReport}
            </if>
           <if test="easyAppDTO.isPublicity!=null">
                AND caep.is_publicity = #{easyAppDTO.isPublicity}
            </if>
            <if test="easyAppDTO.handleStatus!=null">
                AND caep.handle_status = #{easyAppDTO.handleStatus}
            </if>
        </where>
        ORDER BY caep.create_at desc
    </select>
 
    <select id="findByEaseId" resultType="com.panzhihua.common.model.vos.grid.ComActEasyPhotoVO">
        SELECT
        caep.id,
        su.nick_name,
        su.image_url,
        caep.sponsor_id,
        caep.detail,
        caep.create_at,
        caep.`status`,
        caep.is_publicity,
        caep.photo_path_list,
        caep.happen_addr,
        caep.addr_remark,
        caep.handle_status,
        caep.handle_result,
        caep.handle_photo_list,
        caep.feedback_at,
        caep.lng_lat,
        caep.handler_id,
        su1.`name` AS handlerName,
        caep.is_report
        FROM
        com_act_easy_photo AS caep
        LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id
        LEFT JOIN sys_user AS su1 ON su1.user_id = caep.handler_id
        <where>
            <if test="easyId!=null">
                AND caep.id = #{easyId}
            </if>
        </where>
        ORDER BY caep.create_at desc
    </select>
 
    <select id="easyListByAdmin" parameterType="com.panzhihua.common.model.dtos.grid.PageEasyAdminDTO"
            resultType="com.panzhihua.common.model.vos.grid.ComActEasyPhotoAdminVO">
        SELECT
            caep.id,
            caep.detail,
            su.nick_name as userNickName,
            caep.create_at,
            caep.is_report,
            caep.is_publicity,
            caep.classify_id,
            caep.handle_status
        FROM
            com_act_easy_photo AS caep
            LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id
            LEFT JOIN com_act_easy_photo_classify AS caepc ON caepc.id = caep.classify_id
            LEFT JOIN sys_user AS su1 ON su1.user_id = caep.handler_id
            LEFT JOIN com_act AS ca ON ca.community_id = caep.community_id
        <where>
            AND caep.del_tag = 0
            <if test="easyAppDTO.communityId!=null">
                AND caep.community_id = ${easyAppDTO.communityId}
            </if>
            <if test="easyAppDTO.streetId!=null">
                and ca.street_id = #{easyAppDTO.streetId}
            </if>
            <if test="easyAppDTO.isReport!=null">
                AND caep.is_report = #{easyAppDTO.isReport}
            </if>
            <if test="easyAppDTO.isPublicity!=null">
                AND caep.is_publicity = #{easyAppDTO.isPublicity}
            </if>
            <if test="easyAppDTO.handleStatus!=null">
                AND caep.handle_status = #{easyAppDTO.handleStatus}
            </if>
            <if test="easyAppDTO.easyPhotoTypeId!=null">
                AND caep.classify_id = #{easyAppDTO.easyPhotoTypeId}
            </if>
            <if test="easyAppDTO.keyWord != null and easyAppDTO.keyWord != &quot;&quot;">
                AND (caepc.`name` LIKE concat (#{easyAppDTO.keyWord},'%') or
                caep.detail LIKE concat (#{easyAppDTO.keyWord},'%') or
                su.nick_name LIKE concat (#{easyAppDTO.keyWord},'%') or
                caep.happen_addr LIKE concat (#{easyAppDTO.keyWord},'%') or
                (caep.is_report = 0 and su1.nick_name LIKE concat (#{easyAppDTO.keyWord},'%')))
            </if>
        </where>
        ORDER BY
            caep.create_at DESC
    </select>
 
    <select id="easyDetailByAdmin" resultType="com.panzhihua.common.model.vos.grid.ComActEasyPhotoAdminVO">
        SELECT DISTINCT
            caep.id,
            caep.detail,
            su.nick_name AS userNickName,
            su.image_url AS imageUrl,
            caep.create_at,
            caep.is_report,
            caep.is_publicity,
            caep.handle_status,
            caep.detail,
            caep.photo_path_list,
            caep.addr_remark,
            caep.happen_addr,
            caep.lng_lat,
            caep.handle_result,
            caep.handle_photo_list,
            su1.nick_name as handlerName,
            caep.feedback_at as feedbackAt
        FROM
            com_act_easy_photo AS caep
            LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id
            LEFT JOIN sys_user AS su1 ON su1.user_id = caep.handler_id
        <where>
            <if test="easyId!=null">
                AND caep.id = #{easyId}
            </if>
        </where>
    </select>
 
    <update id="easyPublicityByAdmin" parameterType="com.panzhihua.common.model.dtos.grid.ComActEasyPhotoEditAdminDTO">
        update com_act_easy_photo
        <if test="photoEditDTO.type!=null and photoEditDTO.type == 1">
            set is_publicity = #{photoEditDTO.isPublicity}
        </if>
        <if test="photoEditDTO.type!=null and photoEditDTO.type == 2">
            set del_tag = 1
        </if>
        <if test="photoEditDTO.ids!=null and photoEditDTO.ids.size > 0">
            where id in
            <foreach collection='photoEditDTO.ids' item='id' index='index' open='(' close=')' separator=',' >
            #{id}
            </foreach>
        </if>
    </update>
</mapper>