ExceptionWorkorderLogMapper.xml
2.72 KB
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
<?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.apple.erp.mapper.ExceptionWorkorderLogMapper">
<!-- 根据工单ID获取处理日志列表 -->
<select id="selectWorkorderLogsByWorkorderId" resultType="com.apple.erp.dto.ExceptionWorkorderLogRes">
SELECT
ewl.log_id,
ewl.workorder_id,
ewl.workorder_no,
ewl.handle_user,
ewl.handle_time,
ewl.before_status,
CASE ewl.before_status
WHEN 1 THEN '待处理'
WHEN 2 THEN '处理中'
WHEN 3 THEN '已解决'
WHEN 4 THEN '已关闭'
ELSE '未知状态'
END AS before_status_name,
ewl.after_status,
CASE ewl.after_status
WHEN 1 THEN '待处理'
WHEN 2 THEN '处理中'
WHEN 3 THEN '已解决'
WHEN 4 THEN '已关闭'
ELSE '未知状态'
END AS after_status_name,
ewl.handle_opinion,
ewl.attach_url,
ewl.create_by,
ewl.create_time
FROM t_exception_workorder_log ewl
WHERE ewl.workorder_id = #{workorderId} AND ewl.del_flag = '0'
ORDER BY ewl.handle_time DESC
</select>
<!-- 根据工单ID列表批量获取处理日志 -->
<select id="selectWorkorderLogsByWorkorderIds" resultType="com.apple.erp.dto.ExceptionWorkorderLogRes">
SELECT
ewl.log_id,
ewl.workorder_id,
ewl.workorder_no,
ewl.handle_user,
ewl.handle_time,
ewl.before_status,
CASE ewl.before_status
WHEN 1 THEN '待处理'
WHEN 2 THEN '处理中'
WHEN 3 THEN '已解决'
WHEN 4 THEN '已关闭'
ELSE '未知状态'
END AS before_status_name,
ewl.after_status,
CASE ewl.after_status
WHEN 1 THEN '待处理'
WHEN 2 THEN '处理中'
WHEN 3 THEN '已解决'
WHEN 4 THEN '已关闭'
ELSE '未知状态'
END AS after_status_name,
ewl.handle_opinion,
ewl.attach_url,
ewl.create_by,
ewl.create_time
FROM t_exception_workorder_log ewl
WHERE ewl.workorder_id IN
<foreach collection="workorderIds" item="workorderId" open="(" separator="," close=")">
#{workorderId}
</foreach>
AND ewl.del_flag = '0'
ORDER BY ewl.workorder_id, ewl.handle_time DESC
</select>
</mapper>