<?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>
|