zhangjian
2023-05-30 dabbcc356af21f9f2f88ac69ff07994e6e32e4fc
ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
@@ -13,56 +13,48 @@
        <result property="inspectMode"    column="inspect_mode"    />
        <result property="menualSwitch"    column="menual_switch"    />
        <result property="createBy"    column="create_by"    />
        <result property="cameraId"    column="camera_id"    />
        <result property="channel"    column="channel"    />
        <result property="currentStepId"    column="current_step_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="cameraId"    column="camera_id"    />
        <result property="channel"    column="channel"    />
        <result property="deptId"    column="dept_id"    />
        <result property="userId"    column="user_id"    />
        <result property="currentStopStartTime"    column="current_stop_start_time"    />
        <result property="currentStepId"    column="current_step_id"    />
        <result property="currentStepStartTime"    column="current_step_start_time"    />
    </resultMap>
    <resultMap id="ArdVideoInspectTaskArdVideoInspectTaskStepResult" type="ArdVideoInspectTask" extends="ArdVideoInspectTaskResult">
        <collection property="ardVideoInspectTaskStepList" notNullColumn="sub_id" javaType="java.util.List" resultMap="ArdVideoInspectTaskStepResult" />
        <collection property="ardVideoInspectTaskStepList" notNullColumn="sub_task_id" javaType="java.util.List" resultMap="ArdVideoInspectTaskStepResult" />
    </resultMap>
    <resultMap type="ArdVideoInspectTaskStep" id="ArdVideoInspectTaskStepResult">
        <result property="taskId"    column="sub_task_id"    />
        <result property="deptId"    column="sub_dept_id"    />
        <result property="userId"    column="sub_user_id"    />
        <result property="id"    column="sub_id"    />
        <result property="orderNumber"    column="sub_order_number"    />
        <result property="recordingTime"    column="sub_recording_time"    />
        <result property="wellId"    column="sub_well_id"    />
        <result property="taskId"    column="sub_task_id"    />
        <result property="deptId"    column="sub_dept_id"    />
        <result property="userId"    column="sub_user_id"    />
    </resultMap>
    <sql id="selectArdVideoInspectTaskVo">
        select id, task_name, start_time, end_time, repeat_period, inspect_mode, menual_switch, create_by, camera_id, channel, current_step_id, create_time, update_by, update_time, dept_id, user_id, current_stop_start_time from ard_video_inspect_task
        select id, task_name, start_time, end_time, repeat_period, inspect_mode, menual_switch, create_by, create_time, update_by, update_time, camera_id, channel, dept_id, user_id, current_step_id, current_step_start_time from ard_video_inspect_task
    </sql>
    <select id="selectArdVideoInspectTaskList" parameterType="ArdVideoInspectTask" resultMap="ArdVideoInspectTaskResult">
        <include refid="selectArdVideoInspectTaskVo"/>
        <where>  
            <if test="taskName != null  and taskName != ''"> and task_name like '%'||#{taskName}||'%'</if>
            <if test="params.beginStartTime != null and params.beginStartTime != '' and params.endStartTime != null and params.endStartTime != ''"> and start_time between #{params.beginStartTime} and #{params.endStartTime}</if>
            <if test="params.beginEndTime != null and params.beginEndTime != '' and params.endEndTime != null and params.endEndTime != ''"> and end_time between #{params.beginEndTime} and #{params.endEndTime}</if>
            <if test="repeatPeriod != null  and repeatPeriod != ''"> and repeat_period = #{repeatPeriod}</if>
            <if test="inspectMode != null  and inspectMode != ''"> and inspect_mode = #{inspectMode}</if>
            <if test="menualSwitch != null  and menualSwitch != ''"> and menual_switch = #{menualSwitch}</if>
            <if test="cameraId != null  and cameraId != ''"> and camera_id = #{cameraId}</if>
            <if test="channel != null  and channel != ''"> and channel = #{channel}</if>
            <if test="currentStepId != null  and currentStepId != ''"> and current_step_id = #{currentStepId}</if>
            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="currentStopStartTime != null  and currentStopStartTime != ''"> and current_stop_start_time = #{currentStopStartTime}</if>
            <if test="channel != null "> and channel = #{channel}</if>
        </where>
    </select>
    
    <select id="selectArdVideoInspectTaskById" parameterType="String" resultMap="ArdVideoInspectTaskArdVideoInspectTaskStepResult">
        select a.id, a.task_name, a.start_time, a.end_time, a.repeat_period, a.inspect_mode, a.menual_switch, a.create_by, a.camera_id, a.channel, a.current_step_id, a.create_time, a.update_by, a.update_time, a.dept_id, a.user_id, a.current_stop_start_time,
 b.id as sub_id, b.order_number as sub_order_number, b.recording_time as sub_recording_time, b.well_id as sub_well_id, b.task_id as sub_task_id, b.dept_id as sub_dept_id, b.user_id as sub_user_id
        select a.id, a.task_name, a.start_time, a.end_time, a.repeat_period, a.inspect_mode, a.menual_switch, a.create_by, a.create_time, a.update_by, a.update_time, a.camera_id, a.channel, a.dept_id, a.user_id, a.current_step_id, a.current_step_start_time,
 b.task_id as sub_task_id, b.dept_id as sub_dept_id, b.user_id as sub_user_id, b.id as sub_id, b.order_number as sub_order_number, b.recording_time as sub_recording_time, b.well_id as sub_well_id
        from ard_video_inspect_task a
        left join ard_video_inspect_task_step b on b.task_id = a.id
        where a.id = #{id}
@@ -79,15 +71,15 @@
            <if test="inspectMode != null">inspect_mode,</if>
            <if test="menualSwitch != null">menual_switch,</if>
            <if test="createBy != null">create_by,</if>
            <if test="cameraId != null">camera_id,</if>
            <if test="channel != null">channel,</if>
            <if test="currentStepId != null">current_step_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="cameraId != null">camera_id,</if>
            <if test="channel != null">channel,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="userId != null">user_id,</if>
            <if test="currentStopStartTime != null">current_stop_start_time,</if>
            <if test="currentStepId != null">current_step_id,</if>
            <if test="currentStepStartTime != null">current_step_start_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -98,15 +90,15 @@
            <if test="inspectMode != null">#{inspectMode},</if>
            <if test="menualSwitch != null">#{menualSwitch},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="cameraId != null">#{cameraId},</if>
            <if test="channel != null">#{channel},</if>
            <if test="currentStepId != null">#{currentStepId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="cameraId != null">#{cameraId},</if>
            <if test="channel != null">#{channel},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="userId != null">#{userId},</if>
            <if test="currentStopStartTime != null">#{currentStopStartTime},</if>
            <if test="currentStepId != null">#{currentStepId},</if>
            <if test="currentStepStartTime != null">#{currentStepStartTime},</if>
         </trim>
    </insert>
@@ -120,15 +112,15 @@
            <if test="inspectMode != null">inspect_mode = #{inspectMode},</if>
            <if test="menualSwitch != null">menual_switch = #{menualSwitch},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="cameraId != null">camera_id = #{cameraId},</if>
            <if test="channel != null">channel = #{channel},</if>
            <if test="currentStepId != null">current_step_id = #{currentStepId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="cameraId != null">camera_id = #{cameraId},</if>
            <if test="channel != null">channel = #{channel},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="currentStopStartTime != null">current_stop_start_time = #{currentStopStartTime},</if>
            <if test="currentStepId != null">current_step_id = #{currentStepId},</if>
            <if test="currentStepStartTime != null">current_step_start_time = #{currentStepStartTime},</if>
        </trim>
        where id = #{id}
    </update>
@@ -156,9 +148,9 @@
    </delete>
    <insert id="batchArdVideoInspectTaskStep">
        insert into ard_video_inspect_task_step( id, order_number, recording_time, well_id, task_id, dept_id, user_id) values
        insert into ard_video_inspect_task_step( task_id, dept_id, user_id, order_number, recording_time, well_id) values
      <foreach item="item" index="index" collection="list" separator=",">
            ( #{item.id}, #{item.orderNumber}, #{item.recordingTime}, #{item.wellId}, #{item.taskId}, #{item.deptId}, #{item.userId})
            ( #{item.taskId}, #{item.deptId}, #{item.userId}, #{item.orderNumber}, #{item.recordingTime}, #{item.wellId})
        </foreach>
    </insert>
</mapper>