123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- <?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.CheckTaskMapper">
- <resultMap id="CheckTaskDtoMap" type="com.zhyc.xps.aqpt.dto.CheckTaskDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="task_id" property="taskId" jdbcType="BIGINT" />
- <result column="task_code" property="taskCode" jdbcType="VARCHAR" />
- <result column="task_title" property="taskTitle" jdbcType="VARCHAR" />
- <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
- <result column="task_cat_id" property="taskCatId" jdbcType="BIGINT" />
- <result column="task_type_id" property="taskTypeId" jdbcType="BIGINT" />
- <result column="expected_start_time" property="expectedStartTime" jdbcType="TIMESTAMP"/>
- <result column="expected_end_time" property="expectedEndTime" jdbcType="TIMESTAMP"/>
- <result column="actual_start_time" property="actualStartTime" jdbcType="TIMESTAMP"/>
- <result column="actual_end_time" property="actualEndTime" jdbcType="TIMESTAMP"/>
- <result column="task_priority" property="taskPriority" jdbcType="BIGINT" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="parent_id" property="parentId" jdbcType="BIGINT" />
- <result column="root_id" property="rootId" jdbcType="BIGINT" />
- <result column="task_origin" property="taskOrigin" jdbcType="BIGINT" />
- <result column="launch_group_id" property="launchGroupId" jdbcType="BIGINT" />
- <result column="launch_position_id" property="launchPositionId" jdbcType="BIGINT" />
- <result column="launch_account_id" property="launchAccountId" jdbcType="BIGINT" />
- <result column="launch_group_name" property="launchGroupName" jdbcType="VARCHAR" />
- <result column="launch_position_name" property="launchPositionName" jdbcType="VARCHAR" />
- <result column="launch_account_name" property="launchAccountName" jdbcType="VARCHAR" />
- <result column="launch_time" property="launchTime" jdbcType="TIMESTAMP"/>
- <result column="handle_group_id" property="handleGroupId" jdbcType="BIGINT" />
- <result column="handle_position_id" property="handlePositionId" jdbcType="BIGINT" />
- <result column="handle_account_id" property="handleAccountId" jdbcType="BIGINT" />
- <result column="handle_group_name" property="handleGroupName" jdbcType="VARCHAR" />
- <result column="handle_position_name" property="handlePositionName" jdbcType="VARCHAR" />
- <result column="handle_account_name" property="handleAccountName" jdbcType="VARCHAR" />
- <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
- <result column="risk_point_title" property="riskPointTitle" jdbcType="VARCHAR" />
- <result column="check_def_id" property="checkDefId" jdbcType="BIGINT" />
- <result column="check_cat_id" property="checkCatId" jdbcType="BIGINT" />
- <result column="check_cat_title" property="checkCatTitle" jdbcType="VARCHAR" />
- <result column="check_type_id" property="checkTypeId" jdbcType="BIGINT" />
- <result column="checklist_type_id" property="checklistTypeId" jdbcType="BIGINT" />
- <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR" />
- <result column="checklist_cat_id" property="checklistCatId" jdbcType="BIGINT" />
- <result column="checklist_cat_title" property="checklistCatTitle" jdbcType="VARCHAR" />
- <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR" />
- <result column="checklist_version" property="checklistVersion" jdbcType="VARCHAR" />
- <result column="check_status" property="checkStatus" jdbcType="BIGINT" />
- </resultMap>
- <sql id="CheckTaskDto_Cols">
- A.oc_id,
- B.task_id,
- B.task_code,
- B.task_title,
- B.task_desc,
- B.task_type_id,
- B.task_cat_id,
- C.task_cat_title,
- B.task_priority,
- B.launch_group_id,
- D.group_name AS launch_group_name,
- B.launch_position_id,
- E.position_name AS launch_position_name,
- B.launch_account_id,
- F.account_name AS launch_account_name,
- B.launch_time,
- B.expected_start_time,
- B.expected_end_time,
- B.actual_start_time,
- B.actual_end_time,
- B.handle_group_id,
- B.handle_group_name,
- B.handle_position_id,
- B.handle_position_name,
- B.handle_account_id,
- B.handle_account_name,
- B.status,
- A.risk_point_id,
- G.risk_point_title,
- A.check_def_id,
- A.check_type_id,
- A.check_cat_id,
- N.check_cat_title,
- A.check_status,
- A.checklist_id,
- A.check_count,
- H.checklist_title,
- H.checklist_type_id,
- H.checklist_desc,
- H.checklist_cat_id,
- M.checklist_cat_title,
- H.version AS checklist_version
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="CheckTaskDtoMap">
- SELECT
- <include refid="CheckTaskDto_Cols"/>
- FROM check_task AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
- LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
- LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
- LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
- LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
- LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
- LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.task_id DESC
- </select>
- <!--列表:任务信息-->
- <select id="getByList" resultMap="CheckTaskDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="CheckTaskDto_Cols"/>
- FROM check_task AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
- LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
- LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
- LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
- LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
- LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
- LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
- WHERE A.deleted_flag = 0
- <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 ( H.checklist_title like "%"#{keywords}"%"
- OR B.task_title like "%"#{keywords}"%" )
- </if>
- <if test="status != null">
- AND B.status = #{status ,jdbcType=BIGINT}
- </if>
- <if test="checkStatus != null">
- AND A.check_status = #{checkStatus ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="launchAccountId != null">
- AND B.launch_account_id = #{launchAccountId,jdbcType=BIGINT}
- </if>
- <if test="launchPositionId != null">
- AND B.launch_position_id = #{launchPositionId,jdbcType=BIGINT}
- </if>
- <if test="launchGroupId != null">
- AND B.launch_group_id = #{launchGroupId,jdbcType=BIGINT}
- </if>
- <if test="handleAccountId != null">
- AND B.handle_account_id = #{handleAccountId,jdbcType=BIGINT}
- </if>
- <if test="handlePositionId != null">
- AND B.handle_position_id = #{handlePositionId,jdbcType=BIGINT}
- </if>
- <if test="handleGroupId != null">
- AND B.handle_group_id = #{handleGroupId,jdbcType=BIGINT}
- </if>
- <if test="isExceed != null and isExceed == 1">
- <![CDATA[
- AND B.expected_end_time < now()
- AND (B.status = 1 OR B.status = 0)
- ]]>
- </if>
- <if test="startLaunchTime != null">
- <![CDATA[
- AND B.launch_time >= #{startLaunchTime ,jdbcType=TIMESTAMP}
- ]]>
- </if>
- <if test="endLaunchTime != null">
- <![CDATA[
- AND B.launch_time <= #{endLaunchTime, jdbcType=TIMESTAMP}
- ]]>
- </if>
- ORDER BY A.task_id DESC
- </select>
- <!--分页:任务信息-->
- <select id="getByPage" resultMap="CheckTaskDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="CheckTaskDto_Cols"/>
- FROM check_task AS A
- LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
- LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
- LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
- LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
- LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
- LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
- LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
- WHERE A.deleted_flag = 0
- <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 ( H.checklist_title like "%"#{keywords}"%"
- OR B.task_title like "%"#{keywords}"%" )
- </if>
- <if test="status != null">
- AND B.status = #{status, jdbcType=BIGINT}
- </if>
- <if test="checkStatus != null">
- AND A.check_status = #{checkStatus, jdbcType=BIGINT}
- </if>
- <if test="launchAccountId != null">
- AND B.launch_account_id = #{launchAccountId, jdbcType=BIGINT}
- </if>
- <if test="launchPositionId != null">
- AND B.launch_position_id = #{launchPositionId, jdbcType=BIGINT}
- </if>
- <if test="launchGroupId != null">
- AND B.launch_group_id = #{launchGroupId, jdbcType=BIGINT}
- </if>
- <if test="handleAccountId != null">
- AND B.handle_account_id = #{handleAccountId, jdbcType=BIGINT}
- </if>
- <if test="handlePositionId != null">
- AND B.handle_position_id = #{handlePositionId, jdbcType=BIGINT}
- </if>
- <if test="handleGroupId != null">
- AND B.handle_group_id = #{handleGroupId, jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId, jdbcType=BIGINT}
- </if>
- <if test="startLaunchTime != null">
- <![CDATA[
- AND B.launch_time >= #{startLaunchTime, jdbcType=TIMESTAMP}
- ]]>
- </if>
- <if test="endLaunchTime != null">
- <![CDATA[
- AND B.launch_time <= #{endLaunchTime, jdbcType=TIMESTAMP}
- ]]>
- </if>
- ORDER BY A.task_id DESC
- </select>
- <!--getCheckTaskExceedList-->
- <select id="getCheckTaskExceedList" resultType="com.zhyc.xps.aqpt.dto.CheckTaskDetailDto">
- SELECT ct.task_id,
- ct.risk_point_id,
- t.task_title,
- t.oc_id,
- t.handle_account_id,
- t.handle_position_id,
- t.handle_group_id,
- t.expected_end_time
- FROM check_task ct
- LEFT JOIN task t ON (t.task_id = ct.task_id AND t.oc_id = ct.oc_id)
- WHERE ct.deleted_flag = 0
- AND t.deleted_flag = 0
- <![CDATA[
- AND t.expected_end_time <= now()
- ]]>
- AND t.STATUS = 1
- </select>
- <!--Create-->
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.CheckTask">
- INSERT INTO check_task
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="taskId != null">
- task_id,
- </if>
- <if test="riskPointId != null">
- risk_point_id,
- </if>
- <if test="checkDefId != null">
- check_def_id,
- </if>
- <if test="checkCatId != null">
- check_cat_id,
- </if>
- <if test="checkTypeId != null">
- check_type_id,
- </if>
- <if test="checkTitle != null and checkTitle!=''">
- check_title,
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- check_desc,
- </if>
- <if test="checklistId != null">
- checklist_id,
- </if>
- <if test="checkCount != null">
- check_count,
- </if>
- <if test="checkStatus != null">
- check_status,
- </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="taskId != null">
- #{taskId ,jdbcType=BIGINT},
- </if>
- <if test="riskPointId != null">
- #{riskPointId ,jdbcType=BIGINT},
- </if>
- <if test="checkDefId != null">
- #{checkDefId ,jdbcType=BIGINT},
- </if>
- <if test="checkCatId != null">
- #{checkCatId ,jdbcType=BIGINT},
- </if>
- <if test="checkTypeId != null">
- #{checkTypeId ,jdbcType=BIGINT},
- </if>
- <if test="checkTitle != null and checkTitle!=''">
- #{checkTitle ,jdbcType=VARCHAR},
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- #{checkDesc ,jdbcType=VARCHAR},
- </if>
- <if test="checklistId != null">
- #{checklistId ,jdbcType=BIGINT},
- </if>
- <if test="checkCount != null">
- #{checkCount ,jdbcType=BIGINT},
- </if>
- <if test="checkStatus != null">
- #{checkStatus ,jdbcType=BIGINT},
- </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.aqpt.entity.CheckTask">
- UPDATE check_task
- <trim suffixOverrides=",">
- <set>
- <if test="checkTitle != null and checkTitle!=''">
- check_title = #{checkTitle ,jdbcType=VARCHAR},
- </if>
- <if test="checkDesc != null and checkDesc != ''">
- check_desc = #{checkDesc ,jdbcType=VARCHAR},
- </if>
- <if test="checklistId != null">
- checklist_id = #{checklistId ,jdbcType=BIGINT},
- </if>
- <if test="checkCatId != null">
- check_cat_id = #{checkCatId ,jdbcType=BIGINT},
- </if>
- <if test="checkTypeId != null">
- check_type_id = #{checkTypeId ,jdbcType=BIGINT},
- </if>
- <if test="checkCount != null">
- check_count = #{checkCount ,jdbcType=INTEGER},
- </if>
- <if test="checkStatus != null">
- check_status = #{checkStatus ,jdbcType=BIGINT},
- </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="taskId != null">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM check_task
- 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="checkDefId != null ">
- AND check_def_id = #{checkDefId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|