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
<?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.testor.module.fives.dao.TFivesToolUseDao">
<!-- 开启二级缓存 -->
<!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
<!-- 通用查询映射结果 -->
<select id="selectToolUserLists" resultType="com.testor.module.fives.model.vo.TFivesToolUseListVO"
parameterType="com.testor.module.fives.model.dto.TFivesToolUseParam">
SELECT
tu.*
FROM
(
SELECT
tftu.id,
tftu.use_type,
tfto.theme_name,
tftu.create_by,
tftu.create_date,
tftu.grain_org_id,
tftu.area_org_id,
tftu.org_id,
tftu.host_post,
tfto.id AS tool_id,
CASE
tftu.score_type
WHEN '7' THEN
'7'
WHEN '6' THEN
'6' ELSE tftu.score
END AS score
FROM
t_fives_tool_use AS tftu
LEFT JOIN t_fives_tool_opl AS tfto ON tftu.id = tfto.parent_id
WHERE
tftu.use_type = 0 AND tftu.status='0' UNION
SELECT
tftu.id,
tftu.use_type,
tftc.case_name AS theme_name,
tftu.create_by,
tftu.create_date,
tftu.grain_org_id,
tftu.area_org_id,
tftu.org_id,
tftu.host_post,
tftc.id AS tool_id,
CASE
tftu.score_type
WHEN '7' THEN
'7'
WHEN '6' THEN
'6' ELSE tftu.score
END AS score
FROM
t_fives_tool_use AS tftu
LEFT JOIN t_fives_tool_case AS tftc ON tftu.id = tftc.parent_id
WHERE
tftu.use_type = 1 AND tftu.status='0' UNION
SELECT
tftu.id,
tftu.use_type,
tftf.course_name AS theme_name,
tftu.create_by,
tftu.create_date,
tftu.grain_org_id,
tftu.area_org_id,
tftu.org_id,
tftu.host_post,
tftf.id AS tool_id,
CASE
tftu.score_type
WHEN '7' THEN
'7'
WHEN '6' THEN
'6' ELSE tftu.score
END AS score
FROM
t_fives_tool_use AS tftu
LEFT JOIN t_fives_tool_focus AS tftf ON tftu.id = tftf.parent_id
WHERE
tftu.use_type = 2 AND tftu.status='0'
) AS tu
where (tu.org_id in(
<foreach separator="," collection="param.companyIds" item="item" index="index">
#{item}
</foreach>
)
<if test="param.toolList!=null and param.toolList!=''">
or tu.host_post in(
<foreach separator="," collection="param.companyIds" item="item" index="index">
#{item}
</foreach>
)
</if>)
<if test="param.useType!=null and param.useType!=''">
AND tu.use_type=#{param.useType}
</if>
<if test="param.grainOrgId!=null and param.grainOrgId!=''">
AND tu.grain_org_id=#{param.grainOrgId}
</if>
<if test="param.areaOrgId!=null and param.areaOrgId!=''">
AND tu.area_org_id=#{param.areaOrgId}
</if>
<if test="param.themeName!=null and param.themeName!=''">
AND tu.theme_name LIKE CONCAT('%',#{param.themeName},'%')
</if>
<if test="param.startDate!=null and param.startDate!=''">
AND tu.create_date BETWEEN #{param.startDate} AND #{param.endDate}
</if>
<if test="param.score == '6'.toString()" >
AND tu.score = #{param.score}
</if>
<if test="param.score == '7'.toString()" >
AND tu.score = #{param.score}
</if>
<if test="param.score == '8'.toString()" >
AND tu.score = #{param.score}
</if>
<if test="param.score!=null and param.score!='' and param.score!=6 and param.score!=7 and param.score != 8 " >
AND tu.score >= #{param.score} and tu.score not in (6,7,8)
</if>
<if test="param.brightPost!=null and param.brightPost!=''">
AND tu.score >= 4 and tu.score not in (6,7,8)
</if>
ORDER BY tu.score DESC
</select>
<resultMap id="BaseResultMap" type="com.testor.module.fives.model.domain.TFivesToolUse">
<id column="id" property="id"/>
<id column="ref_id" property="refId"/>
<id column="parent_id" property="parentId"/>
<id column="tenant_id" property="tenantId"/>
<id column="process_id" property="processId"/>
<id column="process_status" property="processStatus"/>
<id column="grain_org_id" property="grainOrgId"/>
<id column="area_org_id" property="areaOrgId"/>
<id column="use_type" property="useType"/>
<id column="serial_number" property="serialNumber"/>
</resultMap>
</mapper>