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
<?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.ddd.safetyControl.infrastructure.repository.lecls.dao.TSafeRiskLeclsRelationDao">
<!-- 开启二级缓存 -->
<!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.testor.ddd.safetyControl.infrastructure.repository.lecls.entity.TSafeRiskLeclsRelationDO">
<id column="id" property="id"/>
<id column="type" property="type"/>
<id column="value_type" property="valueType"/>
<id column="max_value" property="maxValue"/>
<id column="min_value" property="minValue"/>
<id column="value" property="value"/>
<id column="real_level" property="realLevel"/>
<id column="is_include_max" property="isIncludeMax"/>
<id column="is_include_min" property="isIncludeMin"/>
<id column="formula_str" property="formulasStr"/>
</resultMap>
<sql id="select_base_column">
rs.id,
rs.type,
rs.value_type "valueType",
rs.max_value "maxValue",
rs.min_value "minValue",
rs.value,
rs.real_level "realLevel",
rs.is_include_max "isIncludeMax",
rs.is_include_min "isIncludeMin",
rs.formula_str "formulaStr",
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.valueType!='' and query.valueType!=null">
and rs.value_type=#{query.valueType}
</if>
<if test="query.type!='' and query.type!=null">
and rs.type = #{query.type}
</if>
<if test="query.status!='' and query.status!=null">
and rs.status = #{query.status}
</if>
<if test="query.status == '' or query.status == null">
and rs.status != '1'
</if>
</sql>
<select id="listPage" resultType="com.testor.ddd.safetyControl.interfaces.model.dto.lecls.TSafeRiskLeclsRelationDTO"
parameterType="com.testor.ddd.safetyControl.interfaces.model.dto.lecls.TSafeRiskLeclsRelationDTOParam">
select dd.dict_key as realLevelKey,dd.dict_value realLevelValue,
<include refid="select_base_column" />
from t_safe_risk_lecls_relation rs
left join t_sys_dict_data dd on rs.real_level = dd.dict_data_id
<where>
<if test="query.realLevelKey!=null and query.realLevelKey!=''">
and dd.dict_key = #{realLevelKey}
</if>
<include refid="common_where_if"></include>
</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>