郑永安
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
<?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.RiskEventMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.RiskEvent" >
    <!--          -->
    <id column="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="valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="update_by" property="updateBy" 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>
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, risk_unit_id, risk_event_name, valid_flag, create_time, create_by, update_time,
    update_by, risk_uint_name
  </sql>
  <select id="selectPages" resultMap="BaseResultMap">
    select e.*,
    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_event as e
    left join risk_ana_unit as unit on unit.id = e.risk_unit_id and  unit.valid_flag = 1
    where e.valid_flag = 1
    <if test="params.riskEventName != null  and params.riskEventName != ''">
      and e.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>
 
<!--  List<RiskEvent> getRiskEventList();-->
  <select id="getRiskEventList" resultMap="BaseResultMap">
    select unit.risk_unit_name, event.risk_unit_id, event.risk_event_name
    from risk_event event
    left join risk_ana_unit unit on event.risk_unit_id = unit.id and unit.valid_flag = 1
    where  event.valid_flag = 1
  </select>
 
  <!--RiskEvent getByRiskEventName(String riskEventName);-->
  <select id="getByRiskEventName" resultType="com.gk.hotwork.Domain.RiskEvent">
    select * from risk_event where valid_flag = 1 and risk_event_name = #{riskEventName}
  </select>
 
</mapper>