<?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.finance.projectReport.mapper.CwSignatureAnnotatorMapper">
    <resultMap id="BaseResultMap" type="com.jeeplus.finance.projectReport.domain.CwSignatureAnnotator">
        <id property="id" column="id" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
        <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
        <result property="reportId" column="report_id" jdbcType="VARCHAR"/>
        <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
        <result property="status" column="status" jdbcType="VARCHAR"/>
        <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
        <result property="reason" column="reason" jdbcType="VARCHAR"/>
        <result property="signatureAnnotator1" column="signature_annotator1" jdbcType="VARCHAR"/>
        <result property="signatureAnnotator2" column="signature_annotator2" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="getSigById" resultType="com.jeeplus.finance.projectReport.domain.CwSignatureAnnotator">
        SELECT
            rsa.id,
            rsa.status,
            rsa.json_data,
            rsa.proc_ins_id,
            rsa.reason,
            art.ID_ as taskId
        FROM
            cw_project_report_signature_annotator rsa
        left join act_ru_task art on rsa.proc_ins_id = art.PROC_INST_ID_
        WHERE
            report_id = #{id}
            AND del_flag = 0
            ORDER BY create_time desc limit 1
    </select>

    <update id="updateStatusById">
        update cw_project_report_signature_annotator set status = #{status},signature_annotator1=#{signatureAnnotator1},signature_annotator2=#{signatureAnnotator2},reason=#{reason} where id = #{id}
    </update>

    <update id="setClearReason">
        update cw_project_report_signature_annotator set reason = null where id = #{id}
    </update>

    <update id="updateStatusBySigId">
        update cw_project_report_signature_annotator set status = #{signatureAnnotatorStatus},del_flag='1' where id = #{id}
    </update>



    <select id="getSigByIdList" resultType="com.jeeplus.finance.projectReport.domain.CwSignatureAnnotator">
        SELECT
            rsa.id,
            rsa.status,
            rsa.json_data,
            rsa.proc_ins_id,
            rsa.reason,
            rsa.report_id,
            art.ID_ as taskId
        FROM
            cw_project_report_signature_annotator rsa
        left join act_ru_task art on rsa.proc_ins_id = art.PROC_INST_ID_
        WHERE
            report_id in
            <foreach collection="reportIdList" open="(" close=")" separator="," item="id">
                #{id}
            </foreach>
            AND del_flag = 0
            ORDER BY create_time desc limit 1
    </select>

























</mapper>