<?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.human.practice.reimburseRegister.mapper.ReimburseSubmitAccountMapper">

    <sql id="Base_Column_List">
        a.id,
        a.create_by_id,
        a.create_time,
        a.update_by_id,
        a.update_time,
        a.del_flag,
        a.type,
        a.proc_ins_id,
        a.process_definition_id,
        a.operator,
        a.operator_office,
        a.reim_date,
        a.remarks,
        a.total_num,
        a.no
    </sql>
    <update id="updateStatusById">
        UPDATE human_resources_practice_reimburse_submit_account SET type = #{type}
		WHERE id = #{id}
    </update>

    <select id="getById"
            resultType="com.jeeplus.human.practice.reimburseRegister.domain.ReimburseSubmitAccount">
        select
        <include refid="Base_Column_List"></include>,
        d.ID_ AS task_id
        from human_resources_practice_reimburse_submit_account a
        LEFT JOIN act_ru_task d ON a.proc_ins_id = d.PROC_INST_ID_
        where a.id = #{id} and a.del_flag = '0'
    </select>
    <select id="findList"
            resultType="com.jeeplus.human.practice.reimburseRegister.domain.ReimburseSubmitAccount">
        select
        <include refid="Base_Column_List"></include>,
        d.ID_ AS task_id
        from human_resources_practice_reimburse_submit_account a
        LEFT JOIN act_ru_task d ON a.proc_ins_id = d.PROC_INST_ID_
        ${ew.customSqlSegment}
        ORDER BY a.create_time DESC
    </select>
    <select id="findFileList" resultType="com.jeeplus.sys.domain.WorkAttachmentInfo">
        SELECT * FROM work_attachment WHERE del_flag = 0 AND attachment_id = #{id}
    </select>
    <select id="findIsExit" resultType="java.lang.Integer">
        SELECT
			COUNT( 0 )
		FROM
			work_attachment
		WHERE
			del_flag = 0
			AND attachment_id = #{id}
			AND attachment_name = #{name}
    </select>
    <select id="findFiles" resultType="com.jeeplus.sys.domain.WorkAttachmentInfo">
        SELECT
			id,
			url,
			attachment_name AS `name`,
			create_by_id AS `by`,
			create_time
		FROM
			work_attachment
		WHERE
			del_flag = 0
			AND attachment_id = #{id}
    </select>
</mapper>