<?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.willalp.yiqing.mapper.HsYiqingTaskMapper">

    <resultMap type="com.willalp.yiqing.domain.HsYiqingTask" id="HsYiqingTaskResult">
        <result property="yqTaskId" column="yq_task_id"/>
        <result property="taskNo" column="task_no"/>
        <result property="orgNo" column="org_no"/>
        <result property="swpw" column="swpw"/>
        <result property="taskTitle" column="task_title"/>
        <result property="ruleId" column="rule_id"/>
        <result property="taskAddress" column="task_address"/>
        <result property="planStartTime" column="plan_start_time"/>
        <result property="actualStartTime" column="actual_start_time"/>
        <result property="planEndTime" column="plan_end_time"/>
        <result property="actualEndTime" column="actual_end_time"/>
        <result property="belongMain" column="belong_main"/>
        <result property="executor" column="executor"/>
        <result property="taskStatus" column="task_status"/>
        <result property="isDelete" column="is_delete"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectHsYiqingTaskVo">
        select yq_task_id,
               task_no,
               org_no,
               swpw,
               task_title,
               rule_id,
               task_address,
               plan_start_time,
               plan_end_time,
               actual_start_time,
               actual_end_time,
               belong_main,
               executor,
               task_status,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_yiqing_task
    </sql>

    <select id="selectHsYiqingTaskList" parameterType="HsYiqingTask" resultMap="HsYiqingTaskResult">
        <include refid="selectHsYiqingTaskVo"/>
        <where>
            is_delete = 0
            <if test="taskNo != null  and taskNo != ''">
                  and task_no like concat('%', #{taskNo}, '%')
            </if>
            <if test="orgNo != null  and orgNo != ''">
                  and org_no = #{orgNo}
            </if>
            <if test="swpw != null  and swpw != ''">
                  and swpw like concat('%', #{swpw}, '%')
            </if>
            <if test="taskTitle != null  and taskTitle != ''">
                  and task_title like concat('%', #{taskTitle}, '%')
            </if>
            <if test="ruleId != null  and ruleId != ''">
                  and rule_id = #{ruleId}
            </if>
            <if test="taskAddress != null  and taskAddress != ''">
                  and task_address like concat('%', #{taskAddress}, '%')
            </if>
            <if test="planStartTime != null ">
                  and plan_start_time like concat('%', #{planStartTime}, '%')
            </if>
            <if test="planEndTime != null ">
                  and plan_end_time like concat('%', #{planEndTime}, '%')
            </if>
            <if test="belongMain != null  and belongMain != ''">
                  and belong_main like concat('%', #{belongMain}, '%')
            </if>
            <if test="executor != null  and executor != ''">
                  and executor like concat('%', #{executor}, '%')
            </if>
            <if test="taskStatus != null ">
                  and task_status = #{taskStatus}
            </if>
            <if test="isDelete != null ">
                  and is_delete = #{isDelete}
            </if>
        </where>
    </select>
</mapper>
