<?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.gonghang.h5clientapp.dao.TaskReportMapper">

    <!--    上海工行 掌上运维——查询报告列表-->
    <resultMap id="ReportMap" type="java.util.HashMap">
        <id column="id" jdbcType="INTEGER" property="reportId"/>
        <result column="report_name" jdbcType="VARCHAR" property="reportName"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
    </resultMap>
    <select id="selectReportList" resultMap="ReportMap">
        SELECT
        r.id,
        r.report_name,
        r.`status`,
        DATE_FORMAT(r.create_time,'%Y-%c-%d %H:%i:%s') create_time
        FROM
        task_report r
        LEFT JOIN check_task t ON t.id = r.task_id
        WHERE
        1=1
        <if test="robotId != null">
            and d.robot_id =#{robotId}
        </if>
        ORDER BY
        r.create_time DESC
    </select>
</mapper>