123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <?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.CheckTaskDoingMapper">
- <resultMap id="CheckTaskDoingItemDtoMap" type="com.zhyc.xps.aqpt.dto.CheckTaskDoingItemDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
- <result column="task_id" property="taskId" jdbcType="BIGINT" />
- <result column="check_record_id" property="checkRecordId" jdbcType="BIGINT" />
- <result column="group_id" property="groupId" jdbcType="BIGINT" />
- <result column="position_id" property="positionId" jdbcType="BIGINT" />
- <result column="account_id" property="accountId" jdbcType="BIGINT" />
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT" />
- <result column="hazard_id" property="hazardId" jdbcType="BIGINT" />
- <result column="hazard_title" property="hazardTitle" jdbcType="VARCHAR" />
- <result column="hazard_code" property="hazardCode" jdbcType="VARCHAR" />
- <result column="risk_id" property="riskId" jdbcType="BIGINT" />
- <result column="risk_title" property="riskTitle" jdbcType="VARCHAR" />
- <result column="risk_code" property="riskCode" jdbcType="VARCHAR" />
- <result column="measure_id" property="measureId" jdbcType="BIGINT" />
- <result column="measure_content" property="measureContent" jdbcType="VARCHAR" />
- <result column="measure_type_id" property="measureTypeId" jdbcType="BIGINT" />
- <result column="measure_type_title" property="measureTypeTitle" jdbcType="VARCHAR" />
- <result column="measure_reference" property="measureReference" jdbcType="VARCHAR" />
- <result column="measure_desc" property="measureDesc" jdbcType="VARCHAR" />
- <result column="check_time" property="checkTime" jdbcType="TIMESTAMP"/>
- <result column="check_result" property="checkResult" jdbcType="BIGINT" />
- <result column="check_desc" property="checkDesc" jdbcType="VARCHAR" />
- <result column="danger_id" property="dangerId" jdbcType="BIGINT" />
- <result column="created_by" property="createdBy" jdbcType="BIGINT" />
- <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
- </resultMap>
- <sql id="CheckTaskDoingItemDto_Cols">
- A.oc_id,
- A.task_id,
- A.check_record_id,
- A.account_id,
- A.position_id,
- A.group_id,
- A.risk_point_id,
- A.checklist_id,
- A.hazard_id,
- B.hazard_title,
- B.hazard_code,
- A.risk_id,
- C.risk_source AS risk_title,
- C.risk_code,
- A.measure_id,
- D.measure_type_id,
- E.measure_type_title,
- D.measure_content,
- D.measure_reference,
- D.measure_desc,
- A.check_time,
- A.check_result,
- A.check_desc,
- A.danger_id,
- A.created_by,
- A.created_at
- </sql>
- <!--列表查询-->
- <select id="getItemByList" resultMap="CheckTaskDoingItemDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="CheckTaskDoingItemDto_Cols"/>
- FROM check_task_doing AS A
- LEFT JOIN checklist_hazard AS B ON (A.oc_id = B.oc_id AND A.hazard_id = B.hazard_id)
- LEFT JOIN checklist_hazard_risk AS C ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id)
- LEFT JOIN checklist_hazard_risk_measure AS D ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id AND A.measure_id = D.measure_id)
- LEFT JOIN measure_type AS E ON (D.measure_type_id = E.measure_type_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND D.measure_content like "%"#{keywords}"%"
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,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>
- <if test="checkResult != null">
- AND A.check_result = #{checkResult ,jdbcType=BIGINT}
- </if>
- ORDER BY A.hazard_id ASC, A.risk_id ASC, A.measure_id ASC
- </select>
- <!--分页查询-->
- <select id="getItemByPage" resultMap="CheckTaskDoingItemDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="CheckTaskDoingItemDto_Cols"/>
- FROM check_task_doing AS A
- LEFT JOIN checklist_hazard AS B ON (A.oc_id = B.oc_id AND A.hazard_id = B.hazard_id)
- LEFT JOIN checklist_hazard_risk AS C ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id)
- LEFT JOIN checklist_hazard_risk_measure AS D ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id AND A.measure_id = D.measure_id)
- LEFT JOIN measure_type AS E ON (D.measure_type_id = E.measure_type_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND D.measure_content like "%"#{keywords}"%"
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,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>
- <if test="checkResult != null">
- AND A.check_result = #{checkResult ,jdbcType=BIGINT}
- </if>
- ORDER BY A.hazard_id ASC, A.risk_id ASC, A.measure_id ASC
- </select>
- <!--基于ID查询-->
- <select id="getItemById" resultMap="CheckTaskDoingItemDtoMap">
- SELECT
- <include refid="CheckTaskDoingItemDto_Cols"/>
- FROM check_task_doing AS A
- LEFT JOIN checklist_hazard AS B ON (A.oc_id = B.oc_id AND A.hazard_id = B.hazard_id)
- LEFT JOIN checklist_hazard_risk AS C ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id)
- LEFT JOIN checklist_hazard_risk_measure AS D ON (A.oc_id = B.oc_id AND A.hazard_id = C.hazard_id AND A.risk_id = C.risk_id AND A.measure_id = D.measure_id)
- LEFT JOIN measure_type AS E ON (D.measure_type_id = E.measure_type_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--Create-->
- <insert id="createItem" parameterType="com.zhyc.xps.aqpt.entity.CheckTaskDoingItem">
- INSERT INTO check_task_doing
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="groupId != null">
- group_id,
- </if>
- <if test="positionId != null">
- position_id,
- </if>
- <if test="accountId != null">
- account_id,
- </if>
- <if test="taskId != null">
- task_id,
- </if>
- <if test="checkRecordId != null">
- check_record_id,
- </if>
- <if test="checklistId != null">
- checklist_id,
- </if>
- <if test="riskPointId != null">
- risk_point_id,
- </if>
- <if test="hazardId != null">
- hazard_id,
- </if>
- <if test="riskId != null">
- risk_id,
- </if>
- <if test="measureId != null">
- measure_id,
- </if>
- <if test="checkTime != null">
- check_time,
- </if>
- <if test="checkResult != null">
- check_result,
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- check_desc,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="groupId != null">
- #{groupId ,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- #{positionId ,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="taskId != null">
- #{taskId ,jdbcType=BIGINT},
- </if>
- <if test="checkRecordId != null">
- #{checkRecordId ,jdbcType=BIGINT},
- </if>
- <if test="checklistId != null">
- #{checklistId ,jdbcType=BIGINT},
- </if>
- <if test="riskPointId != null">
- #{riskPointId ,jdbcType=BIGINT},
- </if>
- <if test="hazardId != null">
- #{hazardId ,jdbcType=BIGINT},
- </if>
- <if test="riskId != null">
- #{riskId ,jdbcType=BIGINT},
- </if>
- <if test="measureId != null">
- #{measureId ,jdbcType=BIGINT},
- </if>
- <if test="checkTime != null">
- #{checkTime ,jdbcType=DATE},
- </if>
- <if test="checkResult != null">
- #{checkResult ,jdbcType=BIGINT},
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- #{checkDesc ,jdbcType=VARCHAR},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <insert id="createItemBatch" parameterType="java.util.List">
- INSERT INTO check_task_doing(
- oc_id,
- group_id,
- position_id,
- account_id,
- task_id,
- check_record_id,
- checklist_id,
- risk_point_id,
- hazard_id,
- risk_id,
- measure_id,
- check_time,
- check_result,
- check_desc,
- created_by,
- created_at)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.ocId},
- #{item.groupId},
- #{item.positionId},
- #{item.accountId},
- #{item.taskId},
- #{item.checkRecordId},
- #{item.checklistId},
- #{item.riskPointId},
- #{item.hazardId},
- #{item.riskId},
- #{item.measureId},
- #{item.checkTime},
- #{item.checkResult},
- #{item.checkDesc},
- #{item.createdBy},
- #{item.createdAt})
- </foreach>
- </insert>
- <!--更新-->
- <update id="updateItem" parameterType="com.zhyc.xps.aqpt.entity.CheckTaskDoingItem">
- UPDATE check_task_doing
- <trim suffixOverrides=",">
- <set>
- <if test="accountId != null">
- account_id = #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="checkTime == null">
- check_time = NOW(),
- </if>
- <if test="checkResult != null">
- check_result = #{checkResult ,jdbcType=BIGINT},
- </if>
- <if test="dangerId != null">
- danger_id = #{dangerId ,jdbcType=BIGINT},
- </if>
- <if test="checkDesc != null">
- check_desc = #{checkDesc ,jdbcType=VARCHAR},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--更新-->
- <update id="batchUpdateItem" parameterType="java.util.Map">
- UPDATE check_task_doing
- <trim suffixOverrides=",">
- <set>
- <if test="accountId != null">
- account_id = #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="checkResult != null">
- check_result = #{checkResult ,jdbcType=BIGINT},
- </if>
- <if test="checkDesc != null">
- check_desc = #{checkDesc ,jdbcType=VARCHAR},
- </if>
- <if test="dangerId != null">
- danger_id = #{dangerId ,jdbcType=BIGINT},
- </if>
- <if test="checkTime == null">
- check_time = NOW()
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <delete id="deleteItem" parameterType="java.util.Map">
- DELETE from check_task_doing
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId,jdbcType=BIGINT}
- </if>
- <if test="taskId != null ">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|