<?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.proofread.mapper.ProofreadIssuedMapper">

	<select id="findById" resultType="com.jeeplus.assess.proofread.domain.ProofreadIssued">
		SELECT
			a.id,
			a.create_by_id,
			a.create_time,
			a.update_by_id,
			a.update_time,
			a.del_flag,
			a.project_id,
			b.`name` AS project_name,
			b.assessment_date,
			b.project_manager,
			b.report_type,
			c.report_no,
			d.`name` AS project_manager_name,
			e.`name` AS department,
			a.is_txtz,
			a.is_bgdzdgd,
			a.is_xyba,
			a.is_wcba,
			a.seal_type,
			a.assessment_report,
			a.assessment_explain,
			a.assessment_detail,
			a.consulting_report,
			a.status,
			a.agree_time,
			a.agree_user_id,
			a.proc_ins_id,
			a.process_definition_id,
			a.service_type
		FROM
			proofread_issued a
			LEFT JOIN program_project_list_info b ON a.project_id = b.id
			LEFT JOIN program_report_no c ON b.id = c.program_id
			LEFT JOIN sys_user d ON b.project_manager = d.id
			LEFT JOIN sys_office e ON d.office_id = e.id
		WHERE
			a.del_flag = 0
			AND a.project_id = #{id}
	</select>

	<select id="findProjectInfoById" resultType="com.jeeplus.assess.proofread.domain.ProofreadIssued">
		SELECT
			b.id AS project_id,
			b.`name` AS project_name,
			b.assessment_date,
			b.project_manager,
			c.report_no,
			d.`name` AS project_manager_name,
			e.`name` AS department,
			b.report_type
		FROM
			program_project_list_info b
			LEFT JOIN program_report_no c ON b.id = c.program_id
			LEFT JOIN sys_user d ON b.project_manager = d.id
			LEFT JOIN sys_office e ON d.office_id = e.id
		WHERE
			b.del_flag = 0
			AND b.id = #{id}
	</select>

	<update id="updateStatusById">
		update proofread_issued set status = #{status}
		 where del_flag = 0 AND id = #{id}
	</update>

</mapper>
