|
@@ -0,0 +1,328 @@
|
|
|
|
|
+<?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.practiceSignature.mapper.CwPracticeSignatureMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureDTO">
|
|
|
|
|
+ <id property="id" column="id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="createBy.id" column="create_by_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
|
|
+ <result property="updateBy.id" column="update_by_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
|
|
|
+ <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
|
|
|
|
|
+ <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="projectName" column="project_name" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="reportNo" column="report_no" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="contractId" column="contract_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="status" column="status" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="applyUserId" column="apply_user_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="applyUserName" column="apply_user_name" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
|
|
|
|
|
+ <result property="signFinishTime" column="sign_finish_time" jdbcType="TIMESTAMP"/>
|
|
|
|
|
+ <result property="createByName" column="createByName" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="fileCount" column="fileCount" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="signedFileCount" column="signedFileCount" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="reportStatus" column="reportStatus" jdbcType="VARCHAR"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 详情:带出关联报告、签署人链、原件与已盖章件 -->
|
|
|
|
|
+ <resultMap id="DetailResultMap" type="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureDTO"
|
|
|
|
|
+ extends="BaseResultMap">
|
|
|
|
|
+ <collection property="signatureReportList" ofType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureReportDTO"
|
|
|
|
|
+ column="id" select="getReportList"></collection>
|
|
|
|
|
+ <collection property="signerList" ofType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureSignerDTO"
|
|
|
|
|
+ column="id" select="getSignerList"></collection>
|
|
|
|
|
+ <collection property="workAttachmentDtoList" ofType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO"
|
|
|
|
|
+ column="id" select="selectAttachmentList"></collection>
|
|
|
|
|
+ <collection property="signedAttachmentDtoList" ofType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO"
|
|
|
|
|
+ column="id" select="getSignedFileList"></collection>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap id="AttachmentMap" type="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO">
|
|
|
|
|
+ <id property="id" column="id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="createBy.id" column="create_by_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="createBy.name" column="createByName" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
|
|
+ <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="url" column="url" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="name" column="attachment_name" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="size" column="file_size" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="attachmentId" column="attachment_id" jdbcType="VARCHAR"/>
|
|
|
|
|
+ <result property="attachmentFlag" column="attachment_flag" jdbcType="VARCHAR"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <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.remarks,
|
|
|
|
|
+ a.project_name,
|
|
|
|
|
+ a.report_no,
|
|
|
|
|
+ a.contract_id,
|
|
|
|
|
+ a.contract_tenant_name,
|
|
|
|
|
+ a.status,
|
|
|
|
|
+ a.proc_ins_id,
|
|
|
|
|
+ a.process_definition_id,
|
|
|
|
|
+ a.apply_user_id,
|
|
|
|
|
+ a.apply_user_name,
|
|
|
|
|
+ a.apply_time,
|
|
|
|
|
+ a.sign_finish_time
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="Attachment_Column_List">
|
|
|
|
|
+ wa.id,
|
|
|
|
|
+ wa.create_by_id,
|
|
|
|
|
+ wa.create_time,
|
|
|
|
|
+ wa.update_by_id,
|
|
|
|
|
+ wa.update_time,
|
|
|
|
|
+ wa.del_flag,
|
|
|
|
|
+ wa.url,
|
|
|
|
|
+ wa.type,
|
|
|
|
|
+ wa.attachment_id,
|
|
|
|
|
+ wa.attachment_name,
|
|
|
|
|
+ wa.attachment_flag,
|
|
|
|
|
+ wa.module_type,
|
|
|
|
|
+ wa.attachment_type,
|
|
|
|
|
+ wa.file_size,
|
|
|
|
|
+ wa.sort,
|
|
|
|
|
+ wa.description
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 列表:待盖章/已盖章份数用子查询,报告是否作废实时反查、不落库(设计文档 5.2) -->
|
|
|
|
|
+ <select id="findList" resultMap="BaseResultMap">
|
|
|
|
|
+ SELECT DISTINCT
|
|
|
|
|
+ <include refid="Base_Column_List"></include>,
|
|
|
|
|
+ su.name AS createByName,
|
|
|
|
|
+ (SELECT COUNT(1) FROM cw_practice_signature_file cw_f
|
|
|
|
|
+ WHERE cw_f.signature_id = a.id AND cw_f.del_flag = '0') AS fileCount,
|
|
|
|
|
+ (SELECT COUNT(1) FROM cw_practice_signature_file cw_f
|
|
|
|
|
+ WHERE cw_f.signature_id = a.id AND cw_f.del_flag = '0'
|
|
|
|
|
+ AND cw_f.signed_attachment_id IS NOT NULL AND cw_f.signed_attachment_id != '') AS signedFileCount,
|
|
|
|
|
+ (SELECT cw_r.status FROM cw_practice_signature_report cw_sr
|
|
|
|
|
+ LEFT JOIN cw_project_report cw_r ON cw_r.id = cw_sr.report_id AND cw_r.del_flag = '0'
|
|
|
|
|
+ WHERE cw_sr.signature_id = a.id AND cw_sr.del_flag = '0' LIMIT 1) AS reportStatus
|
|
|
|
|
+ FROM cw_practice_signature a
|
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = a.create_by_id AND su.del_flag = '0'
|
|
|
|
|
+ ${ew.customSqlSegment}
|
|
|
|
|
+ ORDER BY a.create_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="queryById" resultMap="DetailResultMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Base_Column_List"></include>,
|
|
|
|
|
+ su.name AS createByName
|
|
|
|
|
+ FROM cw_practice_signature a
|
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = a.create_by_id AND su.del_flag = '0'
|
|
|
|
|
+ WHERE a.id = #{id} AND a.del_flag = '0'
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 关联报告:报告号取 new_line(权威来源),注师姓名与状态只读反查,绝不回写报告表 -->
|
|
|
|
|
+ <select id="getReportList" resultType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureReportDTO">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ cw_sr.id,
|
|
|
|
|
+ cw_sr.signature_id,
|
|
|
|
|
+ cw_sr.report_id,
|
|
|
|
|
+ cw_sr.annotator1,
|
|
|
|
|
+ cw_sr.annotator2,
|
|
|
|
|
+ su1.name AS annotator1Name,
|
|
|
|
|
+ su2.name AS annotator2Name,
|
|
|
|
|
+ su1.practice_seal_flag AS annotator1SealFlag,
|
|
|
|
|
+ su2.practice_seal_flag AS annotator2SealFlag,
|
|
|
|
|
+ new_line.report_no AS reportNo,
|
|
|
|
|
+ new_line.report_type AS reportType,
|
|
|
|
|
+ new_line.report_number AS reportNumber,
|
|
|
|
|
+ new_line.report_date AS reportDate,
|
|
|
|
|
+ new_line.bank_letters_count AS bankLettersCount,
|
|
|
|
|
+ new_line.digital_letter_count AS digitalLetterCount,
|
|
|
|
|
+ new_line.approved_no_including_tax AS approvedNoIncludingTax,
|
|
|
|
|
+ new_line.approved_including_tax AS approvedIncludingTax,
|
|
|
|
|
+ cwcb.name AS servedUnitName,
|
|
|
|
|
+ cw_pbt.project_number AS projectNumber,
|
|
|
|
|
+ cw_pbt.project_name AS projectName,
|
|
|
|
|
+ su_pm.name AS projectMasterName,
|
|
|
|
|
+ su_rh.name AS realHeaderName,
|
|
|
|
|
+ cw_r.report_name AS reportName,
|
|
|
|
|
+ cw_r.industry AS industry,
|
|
|
|
|
+ cw_r.business_objects AS businessObjects,
|
|
|
|
|
+ cw_r.business_type AS businessType,
|
|
|
|
|
+ cw_r.audit_business_type AS auditBusinessType,
|
|
|
|
|
+ COALESCE(cw_rev.review_status, '0') AS reviewStatus,
|
|
|
|
|
+ cw_r.status AS reportStatus
|
|
|
|
|
+ FROM cw_practice_signature_report cw_sr
|
|
|
|
|
+ LEFT JOIN cw_project_report cw_r ON cw_r.id = cw_sr.report_id AND cw_r.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN cw_project_report_new_line new_line ON new_line.report_id = cw_sr.report_id AND new_line.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN cw_project_report_review cw_rev ON cw_rev.report_id = cw_sr.report_id AND cw_rev.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN cw_project_records cw_pbt ON cw_r.project_id = cw_pbt.id AND cw_pbt.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN cw_work_client_base cwcb ON new_line.served_unit_id = cwcb.id AND cwcb.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su1 ON su1.id = cw_sr.annotator1 AND su1.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su2 ON su2.id = cw_sr.annotator2 AND su2.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su_pm ON su_pm.id = cw_pbt.project_master_id AND su_pm.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su_rh ON su_rh.id = cw_pbt.real_header AND su_rh.del_flag = '0'
|
|
|
|
|
+ WHERE cw_sr.signature_id = #{id} AND cw_sr.del_flag = '0'
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 签署人链:按 serial_no 升序(注师1 先签、注师2 后签),出参不含手机号 -->
|
|
|
|
|
+ <select id="getSignerList" resultType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureSignerDTO">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ cw_sg.id,
|
|
|
|
|
+ cw_sg.signature_id,
|
|
|
|
|
+ cw_sg.serial_no,
|
|
|
|
|
+ cw_sg.user_id,
|
|
|
|
|
+ cw_sg.user_name,
|
|
|
|
|
+ cw_sg.sign_status,
|
|
|
|
|
+ cw_sg.sign_time,
|
|
|
|
|
+ cw_sg.task_id,
|
|
|
|
|
+ cw_sg.task_name
|
|
|
|
|
+ FROM cw_practice_signature_signer cw_sg
|
|
|
|
|
+ WHERE cw_sg.signature_id = #{id} AND cw_sg.del_flag = '0'
|
|
|
|
|
+ ORDER BY cw_sg.serial_no ASC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 待盖章原件:work_attachment 里 attachment_id 存的是本单据主键,attachment_flag 按 十一 定稿为 practice_report -->
|
|
|
|
|
+ <select id="selectAttachmentList" resultMap="AttachmentMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Attachment_Column_List"></include>
|
|
|
|
|
+ , su.name AS createByName
|
|
|
|
|
+ FROM work_attachment wa
|
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = wa.create_by_id AND su.del_flag = '0'
|
|
|
|
|
+ WHERE wa.del_flag = '0'
|
|
|
|
|
+ AND wa.attachment_id = #{attachmentId}
|
|
|
|
|
+ AND wa.attachment_flag = 'practice_report'
|
|
|
|
|
+ ORDER BY wa.create_time ASC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 已盖章件:从文件记录上的 signed_attachment_id 反查附件(阶段 G 落库后才有值) -->
|
|
|
|
|
+ <select id="getSignedFileList" resultMap="AttachmentMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Attachment_Column_List"></include>
|
|
|
|
|
+ , su.name AS createByName
|
|
|
|
|
+ FROM cw_practice_signature_file cw_f
|
|
|
|
|
+ INNER JOIN work_attachment wa ON wa.id = cw_f.signed_attachment_id AND wa.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = wa.create_by_id AND su.del_flag = '0'
|
|
|
|
|
+ WHERE cw_f.del_flag = '0'
|
|
|
|
|
+ AND cw_f.signature_id = #{id}
|
|
|
|
|
+ ORDER BY cw_f.serial_no ASC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 候选报告:强制过滤 复核已完成(5) + 有报告号 + 报告未作废(7) + 本人参与的项目,见 8.6、20.5 -->
|
|
|
|
|
+ <select id="findCandidateReportList" resultType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureReportDTO">
|
|
|
|
|
+ SELECT DISTINCT
|
|
|
|
|
+ cw_r.id AS reportId,
|
|
|
|
|
+ new_line.report_no AS reportNo,
|
|
|
|
|
+ cw_pbt.project_number AS projectNumber,
|
|
|
|
|
+ cw_pbt.project_name AS projectName,
|
|
|
|
|
+ cw_r.signature_annotator1 AS annotator1,
|
|
|
|
|
+ cw_r.signature_annotator2 AS annotator2,
|
|
|
|
|
+ su1.name AS annotator1Name,
|
|
|
|
|
+ su2.name AS annotator2Name,
|
|
|
|
|
+ su1.practice_seal_flag AS annotator1SealFlag,
|
|
|
|
|
+ su2.practice_seal_flag AS annotator2SealFlag,
|
|
|
|
|
+ cw_rev.review_status AS reviewStatus,
|
|
|
|
|
+ cw_r.status AS reportStatus,
|
|
|
|
|
+ cw_r.report_name AS reportName,
|
|
|
|
|
+ cwcb.name AS servedUnitName,
|
|
|
|
|
+ new_line.report_type AS reportType,
|
|
|
|
|
+ new_line.bank_letters_count AS bankLettersCount,
|
|
|
|
|
+ new_line.digital_letter_count AS digitalLetterCount,
|
|
|
|
|
+ new_line.approved_no_including_tax AS approvedNoIncludingTax,
|
|
|
|
|
+ new_line.approved_including_tax AS approvedIncludingTax,
|
|
|
|
|
+ cw_r.industry AS industry,
|
|
|
|
|
+ cw_r.business_objects AS businessObjects,
|
|
|
|
|
+ cw_r.business_type AS businessType,
|
|
|
|
|
+ cw_r.audit_business_type AS auditBusinessType,
|
|
|
|
|
+ new_line.report_number AS reportNumber,
|
|
|
|
|
+ new_line.report_date AS reportDate,
|
|
|
|
|
+ su_pm.name AS projectMasterName,
|
|
|
|
|
+ su_rh.name AS realHeaderName,
|
|
|
|
|
+ su_rev.name AS reviewByName,
|
|
|
|
|
+ cw_rev.audit_time AS auditTime
|
|
|
|
|
+ FROM cw_project_report cw_r
|
|
|
|
|
+ INNER JOIN cw_project_report_review cw_rev ON cw_rev.report_id = cw_r.id AND cw_rev.del_flag = '0' AND cw_rev.review_status = '5'
|
|
|
|
|
+ INNER JOIN cw_project_report_new_line new_line ON new_line.report_id = cw_r.id AND new_line.del_flag = '0'
|
|
|
|
|
+ AND new_line.report_no IS NOT NULL AND new_line.report_no != ''
|
|
|
|
|
+ LEFT JOIN cw_project_records cw_pbt ON cw_r.project_id = cw_pbt.id AND cw_pbt.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su1 ON su1.id = cw_r.signature_annotator1 AND su1.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su2 ON su2.id = cw_r.signature_annotator2 AND su2.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN cw_work_client_base cwcb ON new_line.served_unit_id = cwcb.id AND cwcb.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su_pm ON su_pm.id = cw_pbt.project_master_id AND su_pm.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su_rh ON su_rh.id = cw_pbt.real_header AND su_rh.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su_rev ON su_rev.id = cw_rev.review_by AND su_rev.del_flag = '0'
|
|
|
|
|
+ WHERE cw_r.del_flag = '0'
|
|
|
|
|
+ AND cw_r.status != '7'
|
|
|
|
|
+ <if test="currentUser != null and currentUser.id != null and currentUser.id != '1'.toString()">
|
|
|
|
|
+ AND (cw_pbt.create_by_id = #{currentUser.id} OR cw_pbt.id IN (
|
|
|
|
|
+ SELECT cw_pm.project_id FROM cw_project_members cw_pm
|
|
|
|
|
+ WHERE cw_pm.user_id = #{currentUser.id} AND cw_pm.del_flag = '0' AND cw_pm.status = '0'
|
|
|
|
|
+ ))
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="query != null and query.reportNo != null and query.reportNo != ''">
|
|
|
|
|
+ AND new_line.report_no LIKE CONCAT('%', #{query.reportNo}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="query != null and query.projectName != null and query.projectName != ''">
|
|
|
|
|
+ AND cw_pbt.project_name LIKE CONCAT('%', #{query.projectName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY cw_rev.audit_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 前置条件复核:只读,返回当前状态与可读原因文案 -->
|
|
|
|
|
+ <select id="checkReportByReportId" resultType="com.jeeplus.finance.practiceSignature.service.dto.CwPracticeSignatureReportDTO">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ cw_r.id AS reportId,
|
|
|
|
|
+ new_line.report_no AS reportNo,
|
|
|
|
|
+ cw_pbt.project_number AS projectNumber,
|
|
|
|
|
+ cw_pbt.project_name AS projectName,
|
|
|
|
|
+ cw_r.signature_annotator1 AS annotator1,
|
|
|
|
|
+ cw_r.signature_annotator2 AS annotator2,
|
|
|
|
|
+ cw_r.status AS reportStatus,
|
|
|
|
|
+ COALESCE(cw_rev.review_status, '0') AS reviewStatus
|
|
|
|
|
+ FROM cw_project_report cw_r
|
|
|
|
|
+ LEFT JOIN cw_project_records cw_pbt ON cw_r.project_id = cw_pbt.id AND cw_pbt.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN (SELECT cw_rev_inner.report_id, MAX(cw_rev_inner.review_status) AS review_status
|
|
|
|
|
+ FROM cw_project_report_review cw_rev_inner
|
|
|
|
|
+ WHERE cw_rev_inner.del_flag = '0'
|
|
|
|
|
+ GROUP BY cw_rev_inner.report_id) cw_rev ON cw_rev.report_id = cw_r.id
|
|
|
|
|
+ LEFT JOIN (SELECT nl.report_id, MAX(nl.report_no) AS report_no
|
|
|
|
|
+ FROM cw_project_report_new_line nl
|
|
|
|
|
+ WHERE nl.del_flag = '0'
|
|
|
|
|
+ GROUP BY nl.report_id) new_line ON new_line.report_id = cw_r.id
|
|
|
|
|
+ WHERE cw_r.id = #{reportId}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 同一份报告的在途与历次单据(详情自查清单,见 4.4) -->
|
|
|
|
|
+ <select id="findListByReportId" resultMap="BaseResultMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Base_Column_List"></include>,
|
|
|
|
|
+ su.name AS createByName,
|
|
|
|
|
+ (SELECT COUNT(1) FROM cw_practice_signature_file cw_f
|
|
|
|
|
+ WHERE cw_f.signature_id = a.id AND cw_f.del_flag = '0') AS fileCount
|
|
|
|
|
+ FROM cw_practice_signature a
|
|
|
|
|
+ INNER JOIN cw_practice_signature_report cw_sr ON cw_sr.signature_id = a.id AND cw_sr.del_flag = '0'
|
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = a.create_by_id AND su.del_flag = '0'
|
|
|
|
|
+ WHERE a.del_flag = '0'
|
|
|
|
|
+ AND cw_sr.report_id = #{reportId}
|
|
|
|
|
+ <if test="excludeId != null and excludeId != ''">
|
|
|
|
|
+ AND a.id != #{excludeId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY a.create_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 子表重建:关联报告 / 文件记录 / 签署人链(物理删除,附件表里的原件本身不动) -->
|
|
|
|
|
+ <delete id="deleteReportBySignatureId">
|
|
|
|
|
+ delete from cw_practice_signature_report where signature_id = #{signatureId}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteFileBySignatureId">
|
|
|
|
|
+ delete from cw_practice_signature_file where signature_id = #{signatureId}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteSignerBySignatureId">
|
|
|
|
|
+ delete from cw_practice_signature_signer where signature_id = #{signatureId}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+</mapper>
|