郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
<?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.gk.hotwork.Mapper.RiskControlMeasureMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.RiskControlMeasure" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="risk_event_id" property="riskEventId" jdbcType="BIGINT" />
    <result column="data_src" property="dataSrc" jdbcType="VARCHAR" />
    <result column="risk_measure_desc" property="riskMeasureDesc" jdbcType="VARCHAR" />
    <result column="classify1" property="classify1" jdbcType="VARCHAR" />
    <result column="classify2" property="classify2" jdbcType="VARCHAR" />
    <result column="classify3" property="classify3" jdbcType="VARCHAR" />
 
    <result column="time_effect" property="timeEffect" jdbcType="VARCHAR" />
    <result column="time_unit" property="timeUnit" jdbcType="VARCHAR" />
 
    <result column="troubleshoot_content" property="troubleshootContent" jdbcType="VARCHAR" />
    <result column="valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
    <result column="event_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="event_update_by" property="updateBy" jdbcType="VARCHAR" />
  <association property="riskEvent" javaType="com.gk.hotwork.Domain.RiskEvent">
    <id column="event_id" property="id" jdbcType="BIGINT" />
    <result column="risk_unit_id" property="riskUnitId" jdbcType="BIGINT" />
    <result column="risk_event_name" property="riskEventName" jdbcType="VARCHAR" />
    <result column="event_valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="event_create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="event_create_by" property="createBy" jdbcType="VARCHAR" />
    <association property="riskAnaUnit" javaType="com.gk.hotwork.Domain.RiskAnaUnit">
      <id column="unit_id"  property="id" />
      <result column="hazard_code" jdbcType="VARCHAR" property="hazardCode" />
      <result column="hazard_dep" jdbcType="VARCHAR" property="hazardDep" />
      <result column="hazard_liable_person" jdbcType="VARCHAR" property="hazardLiablePerson" />
      <result column="risk_unit_name" jdbcType="VARCHAR" property="riskUnitName" />
      <result column="unit_create_time" jdbcType="TIMESTAMP" property="createTime" />
      <result column="unit_update_time" jdbcType="TIMESTAMP" property="updateTime" />
      <result column="unit_create_by" jdbcType="VARCHAR" property="createBy" />
      <result column="unit_update_by" jdbcType="VARCHAR" property="updateBy" />
      <result column="unit_valid_flag" jdbcType="TINYINT" property="validFlag" />
      <result column="hazard_liable_person_id" jdbcType="BIGINT" property="hazardLiablePersonId" />
      <result column="hazard_dep_id" jdbcType="BIGINT" property="hazardDepId" />
    </association>
  </association>
 
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, risk_event_id, data_src, risk_measure_desc, classify1, classify2, classify3,
    troubleshoot_content, valid_flag, create_time, update_time, create_by, update_by,
  </sql>
  <select id="selectPages" resultMap="BaseResultMap">
    select measure.*,
    event.id event_id,
    event.risk_unit_id risk_unit_id,
    event.risk_event_name risk_event_name,
    event.valid_flag event_valid_flag,
    event.create_time event_create_time,
    event.create_by event_create_by,
    event.update_time event_update_time,
    event.update_by event_update_by,
    unit.id unit_id,
    unit.hazard_code hazard_code,
    unit.hazard_dep hazard_dep,
    unit.hazard_liable_person hazard_liable_person,
    unit.risk_unit_name risk_unit_name,
    unit.create_time unit_create_time,
    unit.update_time unit_update_time,
    unit.create_by unit_create_by,
    unit.update_by unit_update_by,
    unit.valid_flag unit_valid_flag,
    unit.hazard_liable_person_id hazard_liable_person_id,
    unit.hazard_dep_id hazard_dep_id
    from risk_control_measure as  measure
    left join risk_event as event on event.id = measure.risk_event_id and event.valid_flag = 1
    left join risk_ana_unit as unit on unit.id = event.risk_unit_id and unit.valid_flag = 1
    where measure.valid_flag = 1
    <if test="params.dataSrc != null and params.dataSrc != ''">
      and measure.data_src = #{params.dataSrc}
    </if>
    <if test="params.riskEventName != null and params.riskEventName != ''">
      and event.risk_event_name like concat("%",#{params.riskEventName},"%")
    </if>
    <if test="params.riskUnitName != null and params.riskUnitName != ''">
      and unit.risk_unit_name like concat("%",#{params.riskUnitName},"%")
    </if>
 
  </select>
 
  <select id="getRiskControlMeasureList" resultMap="BaseResultMap">
    select
        measure.data_src,
        measure.risk_measure_desc,
        measure.classify1,
        measure.classify2,
        measure.classify3,
        measure.troubleshoot_content,
        measure.risk_event_id,
        measure.time_effect,
        measure.time_unit,
        event.risk_event_name
    from risk_control_measure as  measure
    left join risk_event as event on event.id = measure.risk_event_id and event.valid_flag = 1
    where measure.valid_flag = 1
  </select>
 
<!--  RiskControlMeasure getByDataSrc(String trim);-->
  <select id="getByDataSrc" resultType="com.gk.hotwork.Domain.RiskControlMeasure">
    select DISTINCT data_src
    from risk_control_measure where valid_flag = 1  and data_src = 'trim'
  </select>
</mapper>