123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?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.zhyc.xps.aqpt.mapper.ChecklistHazardRiskPositionMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.aqpt.entity.ChecklistHazardRiskPosition">
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT"/>
- <result column="hazard_id" property="hazardId" jdbcType="BIGINT"/>
- <result column="risk_id" property="riskId" jdbcType="BIGINT"/>
- <result column="position_id" property="positionId" jdbcType="BIGINT"/>
- </resultMap>
- <resultMap id="ChecklistHazardRiskPositionDtoMap" type="com.zhyc.xps.aqpt.dto.ChecklistHazardRiskPositionDto" extends="BaseResultMap">
- <result column="position_name" property="positionName" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="EntRiskCtrlPositionDto_Cols">
- A.oc_id,
- A.checklist_id,
- A.hazard_id,
- A.risk_id,
- A.position_id,
- B.position_name
- </sql>
- <select id="getByList" parameterType="java.util.Map" resultMap="ChecklistHazardRiskPositionDtoMap">
- SELECT
- <include refid="EntRiskCtrlPositionDto_Cols"/>
- FROM checklist_hazard_risk_position AS A
- LEFT JOIN s_position AS B ON (A.oc_id = B.oc_id AND A.position_id = B.position_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId,jdbcType=BIGINT}
- </if>
- <if test="hazardId != null">
- AND A.hazard_id = #{hazardId,jdbcType=BIGINT}
- </if>
- <if test="riskId != null">
- AND A.risk_id = #{riskId,jdbcType=BIGINT}
- </if>
- ORDER BY A.position_id ASC
- </select>
- <select id="getByListWithDef" parameterType="java.util.Map" resultMap="ChecklistHazardRiskPositionDtoMap">
- SELECT
- A.oc_id,
- A.position_id,
- A.position_name,
- B.hazard_id,
- B.risk_id,
- A.created_by,
- A.created_at,
- A.updated_by,
- A.updated_at
- FROM s_position AS A
- LEFT JOIN (
- SELECT
- *
- FROM checklist_hazard_risk_position AS C
- WHERE 1 = 1
- <if test="ocId != null">
- AND C.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND C.checklist_id = #{checklistId,jdbcType=BIGINT}
- </if>
- <if test="hazardId != null">
- AND C.hazard_id = #{hazardId ,jdbcType=BIGINT}
- </if>
- <if test="riskId != null">
- AND C.risk_id = #{riskId ,jdbcType=BIGINT}
- </if>
- ) AS B ON (A.oc_id = B.oc_id AND A.position_id = B.position_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.position_id ASC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.ChecklistHazardRiskPosition">
- INSERT INTO checklist_hazard_risk_position
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="checklistId != null">
- checklist_id,
- </if>
- <if test="hazardId != null">
- hazard_id,
- </if>
- <if test="riskId != null">
- risk_id,
- </if>
- <if test="positionId != null">
- position_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="checklistId != null">
- #{checklistId,jdbcType=BIGINT},
- </if>
- <if test="hazardId != null">
- #{hazardId ,jdbcType=BIGINT},
- </if>
- <if test="riskId != null">
- #{riskId ,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- #{positionId ,jdbcType=BIGINT},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM checklist_hazard_risk_position
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="hazardId != null">
- AND hazard_id = #{hazardId ,jdbcType=BIGINT}
- </if>
- <if test="riskId != null">
- AND risk_id = #{riskId ,jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND position_id = #{positionId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|