<?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.nantian.cloud.jljc.mapper.TSuperviseTaskApplyMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,monitor_id,modify_user_id,modify_user_name,modify_time,modify_comments,audit_result,audit_user_id,
        audit_user_name,audit_time,audit_comments,del_flag,dept_id
    </sql>

    <select id="getPage" resultType="com.nantian.cloud.jljc.vo.TSuperviseTaskApplyVo">
        SELECT
            a.*,
            t.monitored_ent
        FROM
            t_supervise_task_apply a
            LEFT JOIN t_supervise_task t ON a.monitor_id = t.monitor_id
        WHERE
        a.del_flag = '1'
        <if test="query.monitorId != null and query.monitorId != '' ">
            AND a.monitor_id = #{query.monitorId}
        </if>
        <if test="query.monitoredEnt != null and query.monitoredEnt != '' ">
            AND t.monitored_ent = #{query.monitoredEnt}
        </if>
        <if test="query.modifyUserName != null and query.modifyUserName != '' ">
            AND a.modify_user_name = #{query.modifyUserName}
        </if>
        <if test="query.auditResult != null and query.auditResult != '' ">
            AND a.audit_Result = #{query.auditResult}
        </if>
        ORDER BY audit_result ASC
    </select>
</mapper>
