郑永安
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
<?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.SafetySelfInspectionItemMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.SafetySelfInspectionItem" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <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" />
 
    <result column="safety_self_inspection_id" property="safetySelfInspectionId" jdbcType="BIGINT" />
    <result column="safety_inspection_item_id" property="safetyInspectionItemId" jdbcType="BIGINT" />
    <result column="safety_inspection_item_result" property="safetyInspectionItemResult" jdbcType="VARCHAR" />
 
  </resultMap>
 
  <select id="getBySafetySelfInspectionId" resultMap="BaseResultMap">
    select * from safety_self_inspection_item where  valid_flag = 1 and safety_self_inspection_id=#{safetySelfInspectionId}
  </select>
 
  <update id="deleteById">
    update safety_self_inspection_item set
    valid_flag=0,
    update_time=#{updateTime},
    update_by=#{updateBy}
    where id=#{id}
  </update>
 
  <select id="getDetailBySafetySelfInspectionId" resultMap="BaseResultMap">
    SELECT
        a.*,
        b.standardization_requirements AS standardizationRequirements,
        b.enterprise_standard AS enterpriseStandard,
        b.review_method AS reviewMethod,
        b.veto AS veto,
        c.id AS elementA,
        c.NAME AS elementAName,
        c.weight AS elementAWeight,
        d.id AS elementB,
        d.NAME AS elementBName,
        d.point as point
    FROM
        safety_self_inspection_item a
        LEFT JOIN safety_inspection_item b ON a.safety_inspection_item_id = b.id
        AND b.valid_flag = 1
        LEFT JOIN element_management c ON b.element_a = c.id
        AND c.valid_flag = 1
        LEFT JOIN element_management d ON b.element_b = d.id
        AND d.valid_flag = 1
    WHERE
        a.valid_flag = 1
    AND a.safety_self_inspection_id=#{safetySelfInspectionId}
  </select>
 
    <select id="getDetailById" resultMap="BaseResultMap">
    SELECT
        a.*,
        b.standardization_requirements AS standardizationRequirements,
        b.enterprise_standard AS enterpriseStandard,
        b.review_method AS reviewMethod,
        b.veto AS veto,
        c.NAME AS elementAName,
        d.NAME AS elementBName,
        d.point as point
    FROM
        safety_self_inspection_item a
        LEFT JOIN safety_inspection_item b ON a.safety_inspection_item_id = b.id
        AND b.valid_flag = 1
        LEFT JOIN element_management c ON b.element_a = c.id
        AND c.valid_flag = 1
        LEFT JOIN element_management d ON b.element_b = d.id
        AND d.valid_flag = 1
    WHERE
        a.valid_flag = 1
    AND a.id=#{id}
  </select>
 
 
</mapper>