<?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.jeeplus.assess.program.configuration.projectList.mapper.ProgramReportCancellationMapper">
    <select id="getByReportNo" resultType="com.jeeplus.assess.program.configuration.projectList.domain.ProgramReportCancellation">
        select
            id,
            create_by_id,
            create_time
            report_no,
            in_flag,
            del_flag
        from program_report_cancellation
        where report_no = #{reportNo}
    </select>

    <delete id="deleteByCanId">
        delete from program_report_cancellation where id = #{id}
    </delete>

    <update id="updateInfoById">
        update program_report_cancellation set del_flag = #{delFlag} where id = #{id}
    </update>

    <select id="getInfos" resultType="com.jeeplus.assess.program.configuration.projectList.domain.ProgramReportCancellation">
        SELECT
            id,
            create_by_id,
            create_time,
            report_no,
            in_flag,
            del_flag
        FROM program_report_cancellation
        WHERE (
        create_time &lt; DATE_SUB(NOW(), INTERVAL (SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv ON dt.id = dv.dict_type_id WHERE dt.type = 'program_report_days') DAY)
        OR in_flag = '2'
        )
        AND number = #{currentYear}
        AND report_no LIKE concat('%',#{type},'%')
        and del_flag = '0'
        ORDER BY create_time ASC
        LIMIT 1
    </select>
</mapper>