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
| <?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.sangeshenbian.dao.ComplaintMapper">
|
| <select id="selectComplaintPage" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO">
| SELECT
| sc.id,
| sc.serial_number,
| sc.TIME,
| sc.problem_type,
| sc.NAME,
| sc.contact_number,
| sc.location,
| sc.detailed_address,
| sc.description_title,
| sc.description_content,
| sc.images,
| sc.videos,
| CASE
|
| WHEN scar.audit_type = 1
| AND scar.audit_status = 0 THEN
| 7
| WHEN scar.audit_type = 2
| AND scar.audit_status = 0 THEN
| 5
| WHEN scar.audit_status = 2 THEN
| 6 ELSE sc.STATUS
| END AS STATUS,
| sc.report_type,
| sc.superior_id,
| sc.create_by,
| sc.create_time,
| sc.update_by,
| sc.update_time,
| sc.completion_description,
| sc.completion_images,
| sc.completion_videos,
| sc.completion_other_description,
| sc.completion_time,
| sc.completion_user_id,
| sc.completion_username,
| sc.completion_user_phone,
| sc.closing_time,
| sc.over_time_days,
| sc.latitude,
| sc.longitude,
| scar.audit_type,
| scar.audit_status,
| scar.COMMENT,
| scar.create_time AS reportTime,
| scar.system_user_id,
| scar.reporter,
| scar.department_name,
| scar.department_id
| FROM
| sgsb_complaint sc
| LEFT JOIN sgsb_complaint_audit_record scar ON sc.id = scar.complaint_id and scar.latest_flag = 1
| <where>
| <if test="isSuperior == 1">
| and sc.superior_id = #{targetId}
| </if>
| <if test="isSuperior == 0">
| and sc.create_by = #{targetId}
| </if>
| <if test="query.type!=null and query.type == 0">
| and audit_type = 1 AND audit_status = 0) OR (audit_type = 2 AND audit_status = 0
| </if>
| <if test="query.type!=null and query.type == 1">
| and sc.status IN(0,1,2)
| </if>
| <if test="query.type!=null and query.type == 2">
| and sc.status = 3
| </if>
| </where>
| ORDER BY sc.create_time DESC
| </select>
| <select id="getDetail" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO">
| SELECT sc.id,
| sc.serial_number,
| sc.time,
| sc.problem_type,
| sc.name,
| sc.contact_number,
| sc.location,
| sc.detailed_address,
| sc.description_title,
| sc.description_content,
| sc.images,
| sc.videos,
| CASE
| WHEN scar.audit_type = 1 AND scar.audit_status = 0 THEN 7
| WHEN scar.audit_type = 2 AND scar.audit_status = 0 THEN 5
| WHEN scar.audit_status = 2 THEN 6
| ELSE sc.status
| END AS status,
| sc.report_type,
| sc.superior_id,
| sc.create_by,
| sc.create_time,
| sc.update_by,
| sc.update_time,
| sc.completion_description,
| sc.completion_images,
| sc.completion_videos,
| sc.completion_other_description,
| sc.completion_time,
| sc.completion_user_id,
| sc.completion_username,
| sc.completion_user_phone,
| sc.closing_time,
| sc.over_time_days,
| sc.latitude,
| sc.longitude,
| scar.audit_type,
| scar.audit_status,
| scar.comment,
| scar.images,
| scar.videos,
| scar.create_time AS reportTime,
| scar.system_user_id,
| scar.reporter,
| scar.department_name,
| scar.department_id,
| scar.comment,
| scar.create_time AS auditTime,
| scar.reject_reason,
| su.nick_name,
| su.phone,
| su2.nick_name AS auditorName,
| su2.phone AS auditorPhone
| FROM sgsb_complaint sc
| LEFT JOIN sys_user su ON su.user_id = sc.create_by
| LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id AND scar.latest_flag = 1
| LEFT JOIN sys_user su2 ON su2.user_id = scar.auditor_id AND scar.audit_status != 0
| <where>
| sc.id = #{id}
| </where>
| </select>
| <select id="getTodoList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO">
| SELECT sc.id,
| sc.description_title,
| sc.closing_time,
| su.image_url
| FROM sgsb_complaint sc
| LEFT JOIN sys_user su ON su.user_id = sc.create_by
| <where>
| sc.status = 0
| <if test="isSuperior == 1 and targetId != null">
| AND sc.superior_id = #{targetId}
| </if>
| <if test="isSuperior == 0 and targetId != null">
| AND sc.create_by = #{targetId}
| </if>
| </where>
| ORDER BY sc.create_time DESC
| </select>
| </mapper>
|
|