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
<?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.safeCheck.dao.TSafeHazardCheckTaskDao">
<!-- 开启二级缓存 -->
<!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.testor.module.safeCheck.model.domain.TSafeHazardCheckTask">
<id column="id" property="id"/>
<id column="plan_id" property="planId"/>
<id column="user_id" property="userId"/>
<id column="people_id" property="peopleId"/>
<id column="org_id" property="orgId"/>
<id column="checked_org_id" property="checkedOrgId"/>
<id column="name" property="name"/>
<id column="check_type_id" property="checkTypeId"/>
<id column="start_date" property="startDate"/>
<id column="initial_end_date" property="initialEndDate"/>
<id column="end_date" property="endDate"/>
<id column="task_status" property="taskStatus"/>
<id column="is_overdue" property="isOverdue"/>
<id column="complete_date" property="completeDate"/>
<id column="process_id" property="processId"/>
</resultMap>
<sql id="select_base_column">
rs.id, rs.plan_id planId, rs.user_id userId, rs.people_id peopleId, rs.org_id orgId,
rs.checked_org_id checkedOrgId, rs.name, rs.check_type_id checkTypeId, rs.start_date startDate, rs.process_id processId,
rs.initial_end_date initialEndDate, rs.end_date endDate, rs.task_status taskStatus, rs.is_overdue isOverdue, rs.complete_date completeDate,
rs.status, rs.remarks, rs.create_by createBy, rs.create_date createDate,
rs.update_by as updateBy, rs.update_date updateDate
</sql>
<sql id="common_where_if">
<if test="query.id!=null and query.id!=''">
and rs.id=#{query.id}
</if>
<if test="query.planId!=null and query.planId!=''">
and rs.plan_id=#{query.planId}
</if>
<if test="query.userId!='' and query.userId!=null">
and rs.user_id=#{query.userId}
</if>
<if test="query.peopleId!='' and query.peopleId!=null">
and rs.people_id=#{query.peopleId}
</if>
<if test="query.orgId!='' and query.orgId!=null">
and rs.org_id=#{query.orgId}
</if>
<if test="query.checkedOrgId!='' and query.checkedOrgId!=null">
and rs.checked_org_id=#{query.checkedOrgId}
</if>
<if test="query.name!='' and query.name!=null">
and rs.name like concat('%',#{query.name},'%')
</if>
<if test="query.checkTypeId!='' and query.checkTypeId!=null">
and rs.check_type_id=#{query.checkTypeId}
</if>
<if test="query.taskStatus!=null">
and rs.task_status=#{query.taskStatus}
</if>
<if test="query.isOverdue!='' and query.isOverdue!=null">
and rs.is_overdue=#{query.isOverdue}
</if>
</sql>
<select id="listPage" resultType="com.testor.module.safeCheck.model.vo.SafeHazardCheckTaskListVO"
parameterType="com.testor.module.safeCheck.model.dto.TSafeHazardCheckTaskParam">
select
so.org_name as orgName,cso.org_name as checkedOrgName,
dpo.dict_value as checkTypeName,su.user_name userName,
<include refid="select_base_column" />
from t_safe_hazard_check_task rs
left join t_sys_org so on rs.org_id = so.org_id
left join t_sys_org cso on rs.checked_org_id = cso.org_id
left join t_sys_dict_data dpo on dpo.dict_data_id = rs.check_type_id
left join t_sys_user su on su.user_id = rs.user_id
<where>
rs.status = '0'
<include refid="common_where_if"></include>
<if test="query.userName!='' and query.userName!=null">
and su.user_name like concat('%',#{query.userName},'%')
</if>
<!-- <if test='query.taskStatus == 0'>-->
<!-- and rs.start_date > now()-->
<!-- </if>-->
<!-- <if test='query.taskStatus == 1'>-->
<!-- and (now() >= rs.start_date)-->
<!-- </if>-->
<!-- <if test='query.taskStatus == 1'>-->
<!-- and (now() >= rs.start_date and rs.end_date >= now() )-->
<!-- </if>-->
<!-- <if test="query.taskStatus!='' and query.taskStatus!=null and query.taskStatus != 0 and query.taskStatus!=1">-->
<!-- and rs.task_status=#{query.taskStatus}-->
<!-- </if>-->
<if test="query.startDateStart!=null">
and rs.start_date >= #{query.startDateStart}
</if>
<if test="query.startDateEnd!=null">
and #{query.startDateEnd} >= rs.start_date
</if>
<if test="query.condOrgIdList!=null and query.condOrgIdList.size>0">
and rs.org_id in
<foreach collection="query.condOrgIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
<if test="query.orderBy!='' and query.orderBy!=null and query.orderType!='' and query.orderType!=null" >
order by ${query.orderBy} ${query.orderType}
</if>
</select>
</mapper>