123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <?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.CheckRecordEventMapper">
- <resultMap id="CheckRecordDtoMap" type="com.zhyc.xps.aqpt.dto.CheckRecordDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--OC ID-->
- <result column="check_record_id" property="checkRecordId" jdbcType="BIGINT" /><!--CheckRecord ID-->
- <result column="account_id" property="accountId" jdbcType="BIGINT" /><!--ACCOUNT-->
- <result column="task_id" property="taskId" jdbcType="BIGINT" /><!--TASK ID-->
- <result column="risk_point_id" property="riskPointId" 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_type_id" property="measureTypeId" jdbcType="BIGINT" />
- <result column="measure_content" property="measureContent" jdbcType="VARCHAR"/>
- <result column="measure_reference" property="measureReference" jdbcType="VARCHAR"/>
- <result column="check_time" property="checkTime" jdbcType="DATE" />
- <result column="check_result" property="checkResult" jdbcType="BIGINT" />
- <result column="check_desc" property="checkDesc" jdbcType="VARCHAR"/>
- <result column="task_title" property="taskTitle" jdbcType="VARCHAR"/>
- <result column="task_priority" property="taskPriority" jdbcType="BIGINT" />
- <result column="position_id" property="positionId" jdbcType="BIGINT" />
- <result column="position_name" property="positionName" jdbcType="VARCHAR"/>
- <result column="group_id" property="groupId" jdbcType="BIGINT" />
- <result column="group_name" property="groupName" jdbcType="VARCHAR"/>
- <result column="account_name" property="accountName" jdbcType="VARCHAR"/>
- <result column="danger_id" property="dangerId" jdbcType="BIGINT" />
- </resultMap>
- <sql id="CheckRecordDto_Cols">
- A.oc_id,
- A.check_record_id,
- A.account_id,
- F.account_name,
- A.task_id,
- B.task_title,
- A.risk_point_id,
- C.risk_point_title,
- B.group_id,
- D.group_name,
- B.position_id,
- E.position_name,
- A.checklist_id,
- A.hazard_id,
- A.hazard_title,
- A.hazard_code,
- A.risk_id,
- A.risk_title,
- A.risk_code,
- A.measure_id,
- G.task_cat_title,
- A.measure_type_id,
- H.measure_type_title,
- A.measure_content,
- A.measure_reference,
- A.check_time,
- A.check_result,
- A.check_desc,
- A.danger_id
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="CheckRecordDtoMap">
- SELECT
- <include refid="CheckRecordDto_Cols"/>
- FROM check_record_event AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id)
- LEFT JOIN ent_risk_point AS C ON (A.oc_id = C.oc_id AND A.risk_point_id = C.risk_point_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id)
- LEFT JOIN account AS F ON (A.oc_id = F.oc_id AND A.account_id = F.account_id)
- LEFT JOIN task_cat AS G ON (B.task_cat_id = G.task_cat_id )
- LEFT JOIN measure_type AS H ON (A.measure_type_id = H.measure_type_id)
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT}
- AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="CheckRecordDtoMap">
- SELECT
- <include refid="CheckRecordDto_Cols"/>
- FROM check_record_event AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id)
- LEFT JOIN ent_risk_point AS C ON (A.oc_id = C.oc_id AND A.risk_point_id = C.risk_point_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id)
- LEFT JOIN account AS F ON (A.oc_id = F.oc_id AND A.account_id = F.account_id)
- LEFT JOIN task_cat AS G ON (B.task_cat_id = G.task_cat_id )
- LEFT JOIN measure_type AS H ON (A.measure_type_id = H.measure_type_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- AND A.account_id = #{accountId, 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 A.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>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND D.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND D.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="day != null and day != ''">
- AND date_format(A.check_time , '%Y-%m-%d') = #{day}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND A.check_time BETWEEN #{startDate} AND #{endDate}
- </if>
- ORDER BY A.check_time DESC
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="CheckRecordDtoMap">
- SELECT
- <include refid="CheckRecordDto_Cols"/>
- FROM check_record_event AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id)
- LEFT JOIN ent_risk_point AS C ON (A.oc_id = C.oc_id AND A.risk_point_id = C.risk_point_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id)
- LEFT JOIN account AS F ON (A.oc_id = F.oc_id AND A.account_id = F.account_id)
- LEFT JOIN task_cat AS G ON (B.task_cat_id = G.task_cat_id )
- LEFT JOIN measure_type AS H ON (A.measure_type_id = H.measure_type_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- AND A.account_id = #{accountId, jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND D.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND D.node_right <= #{nodeRight ,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 A.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>
- <if test="day != null and day != ''">
- AND date_format(A.check_time , '%Y-%m-%d') = #{day}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND A.check_time BETWEEN #{startDate} AND #{endDate}
- </if>
- ORDER BY A.check_time DESC
- </select>
- <!--Create-->
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.CheckRecord">
- INSERT INTO check_record_event
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="checkRecordId != null">
- check_record_id,
- </if>
- <if test="accountId != null">
- account_id,
- </if>
- <if test="taskId != null">
- task_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="hazardTitle != null and hazardTitle!=''">
- hazard_title,
- </if>
- <if test="hazardCode != null and hazardCode != ''">
- hazard_code,
- </if>
- <if test="riskId != null">
- risk_id,
- </if>
- <if test="riskTitle != null and riskTitle!=''">
- risk_title,
- </if>
- <if test="riskCode != null and riskCode != ''">
- risk_code,
- </if>
- <if test="measureId != null">
- measure_id,
- </if>
- <if test="measureTypeId != null">
- measure_type_id,
- </if>
- <if test="measureContent != null and measureContent!=''">
- measure_content,
- </if>
- <if test="measureReference != null and measureReference != ''">
- measure_reference,
- </if>
- <if test="checkTime != null">
- check_time,
- </if>
- <if test="checkResult != null">
- check_result,
- </if>
- <if test="dangerId != null">
- danger_id,
- </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="checkRecordId != null">
- #{checkRecordId ,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="taskId != null">
- #{taskId ,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="hazardTitle != null and hazardTitle!=''">
- #{hazardTitle ,jdbcType=VARCHAR},
- </if>
- <if test="hazardCode != null and hazardCode != ''">
- #{hazardCode ,jdbcType=VARCHAR},
- </if>
- <if test="riskId != null">
- #{riskId ,jdbcType=BIGINT},
- </if>
- <if test="riskTitle != null and riskTitle!=''">
- #{riskTitle ,jdbcType=VARCHAR},
- </if>
- <if test="riskCode != null and riskCode != ''">
- #{riskCode ,jdbcType=VARCHAR},
- </if>
- <if test="measureId != null">
- #{measureId ,jdbcType=BIGINT},
- </if>
- <if test="measureTypeId != null">
- #{measureTypeId ,jdbcType=BIGINT},
- </if>
- <if test="measureContent != null and measureContent!=''">
- #{measureContent ,jdbcType=VARCHAR},
- </if>
- <if test="measureReference != null and measureReference!=''">
- #{measureReference ,jdbcType=VARCHAR},
- </if>
- <if test="checkTime != null">
- #{checkTime ,jdbcType=DATE},
- </if>
- <if test="checkResult != null">
- #{checkResult ,jdbcType=BIGINT},
- </if>
- <if test="dangerId != null">
- #{dangerId ,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>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.common.entity.Checklist">
- UPDATE check_record_event
- <trim suffixOverrides=",">
- <set>
- <if test="checkResult != null">
- check_result = #{checkResult ,jdbcType=BIGINT},
- </if>
- <if test="dangerId != null">
- danger_id = #{dangerId ,jdbcType=BIGINT},
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- check_desc = #{checkDesc ,jdbcType=VARCHAR},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM check_record_event
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- <if test="accountId != null ">
- AND account_id = #{accountId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null ">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null ">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null ">
- AND risk_point_id = #{riskPointId ,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="measureId != null ">
- AND measure_id = #{measureId ,jdbcType=BIGINT}
- </if>
- <if test="checkResult != null ">
- AND check_result = #{checkResult ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|