<?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.business.project.mapper.JyProjectReportsSubmitMapper">
    <select id="findById" resultType="com.jeeplus.business.project.service.dto.JyProjectReportsSubmitDTO">
        select
            a.id,
            a.create_by_id,
            su.name as createByName,
            a.create_time as createDate,
            a.project_id,
            a.type,
            a.first_type,
            a.number,
            a.status,
            a.remarks,
            a.proc_ins_id,
            a.process_definition_id,
            so.name as office,
            so.id,
            art.ID_ as task_id
            from jy_user_signet a
            left join sys_user su on a.create_by_id = su.id
            left join sys_office so on su.office_id=so.id
            left join act_ru_task art ON a.proc_ins_id = art.PROC_INST_ID_
            where a.id=#{id}
    </select>


    <update id="updateReportsSubmitById">
        update jy_user_signet set status = #{status} where id=#{id}
    </update>

    <select id="findReportsSubmitListExccedTime" resultType="com.jeeplus.business.project.domain.JyProjectReportsSubmit">
        select distinct
            a.id,
            a.create_by_id,
            su.name as createByName,
            a.create_time as createDate,
            a.project_id,
            a.type,
            a.first_type,
            a.number,
            a.status,
            a.remarks,
            a.proc_ins_id,
            a.process_definition_id,
            so.name as office,
            so.id,
            art.ID_ as task_id
            from jy_user_signet a
            left join sys_user su on a.create_by_id = su.id
            left join sys_office so on su.office_id=so.id
            left join act_ru_task art ON a.proc_ins_id = art.PROC_INST_ID_
            where a.create_time &lt; #{newDate} and a.status != '5' and a.type_status = '2'
    </select>

    <update id="updateExceedTimeStatus">
        update jy_user_signet set status = #{status},exceed_time_status=#{exceedTimeStatus} where id=#{id}
    </update>

    <select id="findReportsSubmitListInTime" resultType="com.jeeplus.business.project.domain.JyProjectReportsSubmit">
        select distinct
            a.id,
            a.create_by_id,
            su.name as createByName,
            a.create_time as createDate,
            a.project_id,
            a.type,
            a.first_type,
            a.number,
            a.status,
            a.remarks,
            a.proc_ins_id,
            a.process_definition_id,
            so.name as office,
            so.id,
            art.ID_ as task_id
            from jy_user_signet a
            left join sys_user su on a.create_by_id = su.id
            left join sys_office so on su.office_id=so.id
            left join act_ru_task art ON a.proc_ins_id = art.PROC_INST_ID_
            where a.create_time &gt;= #{newDate} and a.status != '5' and a.type_status = '2'
    </select>

</mapper>