|
@@ -7,6 +7,7 @@
|
|
|
a.create_by AS "createBy.id",
|
|
|
a.create_date AS "createDate",
|
|
|
(select name from sys_user user where user.id=a.create_by) AS "createBy.name",
|
|
|
+ (select name from sys_user user where user.id=a.create_by) AS "createByName",
|
|
|
a.update_by AS "updateBy.id",
|
|
|
a.update_date AS "updateDate",
|
|
|
a.del_flag AS "delFlag",
|
|
@@ -50,6 +51,111 @@
|
|
|
a.emergency_project as "emergencyProject"
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="recordDownloadSql">
|
|
|
+ distinct(a.id) AS "id",
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
+ a.create_date AS "createDate",
|
|
|
+ (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
|
|
|
+ (select name from sys_user user where user.id=a.create_by) AS "createByName",
|
|
|
+ a.update_by AS "updateBy.id",
|
|
|
+ a.update_date AS "updateDate",
|
|
|
+ a.del_flag AS "delFlag",
|
|
|
+ a.contract_id AS "workContractInfo.id",
|
|
|
+ a.project_id AS "projectId",
|
|
|
+ a.project_name AS "projectName",
|
|
|
+ a.scale_type AS "scaleType",
|
|
|
+ a.scale_unit AS "scaleUnit",
|
|
|
+ a.scale_quantity AS "scaleQuantity",
|
|
|
+ a.area_id AS "area.id",
|
|
|
+ a.project_site AS "projectSite",
|
|
|
+ a.project_desc AS "projectDesc",
|
|
|
+ a.remarks AS "remarks",
|
|
|
+ a.status AS "projectStatus",
|
|
|
+ a.process_instance_id AS "processInstanceId",
|
|
|
+ a.company_id AS "company.id",
|
|
|
+ a.office_id AS "office.id",
|
|
|
+ a.alter_process_id AS "alterProcessId",
|
|
|
+ area.name AS "area.name",
|
|
|
+ a.province,
|
|
|
+ a.city,
|
|
|
+ a.area_name AS "county",
|
|
|
+ a.project_structure AS "projectStructure",
|
|
|
+ a.on_ground_num AS "onGroundNum",
|
|
|
+ a.under_ground_num AS "underGroundNum",
|
|
|
+ a.building_scale AS "buildingScale",
|
|
|
+ a.measuring_unit AS "measuringUnit",
|
|
|
+ a.project_use AS "projectUse",
|
|
|
+ a.install_fees AS "installFees",
|
|
|
+ a.building_fees AS "buildingFees",
|
|
|
+ a.building_percent AS "buildingPercent",
|
|
|
+ a.install_percent AS "installPercent",
|
|
|
+ a.unit_fees AS "unitFees",
|
|
|
+ a.building_unit_fees AS "buildingUnitFees",
|
|
|
+ a.install_unit_fees AS "installUnitFees",
|
|
|
+ a.total_fees AS "totalFees",
|
|
|
+ ifnull(a.reported_state,0) as "reportedState",
|
|
|
+ a.over_due_status as "overDueStatus",
|
|
|
+ ifnull(a.record_state,0) as "projectRecordStatus",
|
|
|
+ a.over_record_status as "overRecordStatus",
|
|
|
+ a.emergency_project as "emergencyProject"
|
|
|
+ ,ifnull(a.reported_state,0) as "reportedState"
|
|
|
+ ,a.project_master_id as "projectMasterId"
|
|
|
+ ,sub.name as "projectMasterName"
|
|
|
+ ,sob.name as "projectMasterOffice"
|
|
|
+ ,a.submit_money as "submitMoney"
|
|
|
+ ,(case when a.submit_money = '1' then 'B级' when a.submit_money = '2' then 'A级' else '' end) as projectScale
|
|
|
+ ,a.project_type as projectType,
|
|
|
+ wci.name AS "workContractInfo.name",
|
|
|
+ wct.id AS "workContractInfo.client.id",
|
|
|
+ wct.name AS "workContractInfo.client.name",
|
|
|
+ o.top_company AS "office.name",
|
|
|
+ o.name AS "createByOffice",
|
|
|
+ ifnull(prd.number ,"") as "projectReportNumber"
|
|
|
+ ,ifnull(prd.status,0) as "projectReportStatus"
|
|
|
+ ,ifnull(prd.name,"") as "projectReportName"
|
|
|
+ ,ifnull(prrd.status,0) as "downProjectReportRecordStatus",
|
|
|
+ prrd.file_num as recodeNum,
|
|
|
+ prr.process_instance_id as prrProcessInstanceId,
|
|
|
+ prrd.process_instance_id as prrdProcessInstanceId
|
|
|
+ ,prd.id as prdId
|
|
|
+ ,prr.id as prrId
|
|
|
+ ,prrd.id as prrdId
|
|
|
+ ,prd.audit_pass_date as auditPassDate
|
|
|
+ ,ifnull(rprr.report_status,0) as "reportStatus"
|
|
|
+ ,ifnull(rprr.sync_status,0) as "syncStatus"
|
|
|
+ ,rprr.process_instance_id as "reportedProcessInstanceId"
|
|
|
+ ,ifnull(prdt.status,0) as "projectReportStatusTwo"
|
|
|
+ ,prdt.id as prdtId
|
|
|
+ ,prdt.process_instance_id as prdtProcessinstanceId
|
|
|
+ ,ifnull(pmdr.status,0) as "defectRecordStatus"
|
|
|
+ ,pmdr.process_instance_id as "pmdrProcessInstanceId"
|
|
|
+ ,pmdr.id as pmdrId
|
|
|
+ ,wci.contract_num as "workContractInfo.contractNum"
|
|
|
+ ,wci.contract_price as "workContractInfo.contractPrice"
|
|
|
+ ,prd.audit_pass_date as "reportAuditDate"
|
|
|
+ ,prdt.audit_pass_date as "reportTwoAuditDate"
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="recordDownloadLeftSql">
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
+ left join rural_project_records_reported rprr on rprr.id = a.id
|
|
|
+ LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id
|
|
|
+ LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
+ LEFT JOIN sys_user sub on a.project_master_id = sub.id
|
|
|
+ LEFT JOIN sys_office sob ON sob.id = sub.office_id
|
|
|
+ LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
+ LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
+ LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
+ LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
+ LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
+ left join project_report_data prd on prd.project_id = a.id
|
|
|
+ left join project_report_data_two prdt on prdt.project_id = a.id
|
|
|
+ left join rural_project_report_record prr on prr.report_id = prd.id
|
|
|
+ LEFT JOIN project_material_defect_record pmdr on prd.id = pmdr.report_id
|
|
|
+ left join rural_project_report_record_down prrd on prrd.report_id = prd.id
|
|
|
+ </sql>
|
|
|
+
|
|
|
|
|
|
<select id="get" resultType="RuralProjectRecords" >
|
|
|
SELECT
|
|
@@ -96,15 +202,19 @@
|
|
|
<select id="findList" resultType="RuralProjectRecords" >
|
|
|
SELECT
|
|
|
<include refid="projectRecordsColumns"/>
|
|
|
+ ,a.record_state as "recordState"
|
|
|
,a.submit_money as "submitMoney"
|
|
|
+ ,(case when a.submit_money = '1' then 'B级' when a.submit_money = '2' then 'A级' else '' end) as projectScale
|
|
|
,a.project_type as projectType,
|
|
|
wci.name AS "workContractInfo.name",
|
|
|
wci.contract_num as "workContractInfo.contractNum",
|
|
|
wci.contract_price as "workContractInfo.contractPrice",
|
|
|
sub.name as "projectMasterName",
|
|
|
+ sob.name as "projectMasterOffice",
|
|
|
wct.id AS "workContractInfo.client.id",
|
|
|
wct.name AS "workContractInfo.client.name",
|
|
|
o.top_company AS "office.name",
|
|
|
+ o.name AS "createByOffice",
|
|
|
ifnull(prd.number ,"") as "projectReportNumber"
|
|
|
,ifnull(prd.status,0) as "projectReportStatus"
|
|
|
,ifnull(prd.name,"") as "projectReportName"
|
|
@@ -132,6 +242,12 @@
|
|
|
,ppf.id as "ppfId"
|
|
|
,pfb.process_instance_id AS "filingProcessinstanceId"
|
|
|
,ifnull(pfp.status,0) as "filingProjectStatus"
|
|
|
+ ,ifnull(prd.approval_fee ,"") as "approvalFee"
|
|
|
+ ,ifnull(prd.review_fee ,"") as "reviewFee"
|
|
|
+ ,ifnull(prd.verify_fee ,"") as "verifyFee"
|
|
|
+ ,ifnull(prd.verify_rate ,"") as "verifyRate"
|
|
|
+ ,prd.audit_pass_date as "reportAuditDate"
|
|
|
+ ,prdt.audit_pass_date as "reportTwoAuditDate"
|
|
|
FROM rural_project_records a
|
|
|
LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
left join rural_project_records_reported rprr on rprr.id = a.id
|
|
@@ -143,6 +259,7 @@
|
|
|
LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
</if>
|
|
|
LEFT JOIN sys_user sub on a.project_master_id = sub.id
|
|
|
+ LEFT JOIN sys_office sob ON sob.id = sub.office_id
|
|
|
LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
@@ -275,7 +392,14 @@
|
|
|
</if>
|
|
|
<choose>
|
|
|
<when test="projectReportRecordStatus != null and projectReportRecordStatus != '' and projectReportRecordStatus != 0">
|
|
|
- AND prr.status = #{projectReportRecordStatus}
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus == 6 or projectReportRecordStatus == 7">
|
|
|
+ AND a.record_state= #{projectReportRecordStatus}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND prr.status = #{projectReportRecordStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
<choose>
|
|
@@ -459,7 +583,14 @@
|
|
|
</if>
|
|
|
<choose>
|
|
|
<when test="projectReportRecordStatus != null and projectReportRecordStatus != '' and projectReportRecordStatus != 0">
|
|
|
- AND prr.status = #{projectReportRecordStatus}
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus == 6 or projectReportRecordStatus == 7">
|
|
|
+ AND a.record_state= #{projectReportRecordStatus}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND prr.status = #{projectReportRecordStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
<choose>
|
|
@@ -494,59 +625,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="findListOnRecordDownload" resultType="RuralProjectRecords" >
|
|
|
+ <select id="findListOnRecordDownload" resultType="DownloadProjectRecords" >
|
|
|
SELECT
|
|
|
- <include refid="projectRecordsColumns"/>
|
|
|
- ,ifnull(a.reported_state,0) as "reportedState"
|
|
|
- ,a.project_master_id as "projectMasterId"
|
|
|
- ,sub.name as "projectMasterName"
|
|
|
- ,a.submit_money as "submitMoney"
|
|
|
- ,a.project_type as projectType,
|
|
|
- wci.name AS "workContractInfo.name",
|
|
|
- wct.id AS "workContractInfo.client.id",
|
|
|
- wct.name AS "workContractInfo.client.name",
|
|
|
- o.top_company AS "office.name",
|
|
|
- ifnull(prd.number ,"") as "projectReportNumber"
|
|
|
- ,ifnull(prd.status,0) as "projectReportStatus"
|
|
|
- ,ifnull(prd.name,"") as "projectReportName"
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
,ifnull(prr.status,0) as "projectReportRecordStatus"
|
|
|
- ,ifnull(prrd.status,0) as "downProjectReportRecordStatus",
|
|
|
- prrd.file_num as recodeNum,
|
|
|
- prr.process_instance_id as prrProcessInstanceId,
|
|
|
- prrd.process_instance_id as prrdProcessInstanceId
|
|
|
- ,prd.id as prdId
|
|
|
- ,prr.id as prrId
|
|
|
- ,prrd.id as prrdId
|
|
|
- ,prd.audit_pass_date as auditPassDate
|
|
|
- ,ifnull(rprr.report_status,0) as "reportStatus"
|
|
|
- ,ifnull(rprr.sync_status,0) as "syncStatus"
|
|
|
- ,rprr.process_instance_id as "reportedProcessInstanceId"
|
|
|
- ,ifnull(prdt.status,0) as "projectReportStatusTwo"
|
|
|
- ,prdt.id as prdtId
|
|
|
- ,prdt.process_instance_id as prdtProcessinstanceId
|
|
|
- ,ifnull(pmdr.status,0) as "defectRecordStatus"
|
|
|
- ,pmdr.process_instance_id as "pmdrProcessInstanceId"
|
|
|
- ,pmdr.id as pmdrId
|
|
|
- ,wci.contract_num as "workContractInfo.contractNum"
|
|
|
- ,wci.contract_price as "workContractInfo.contractPrice"
|
|
|
FROM rural_project_records a
|
|
|
- LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
- left join rural_project_records_reported rprr on rprr.id = a.id
|
|
|
- LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id
|
|
|
- LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
- LEFT JOIN sys_user sub on a.project_master_id = sub.id
|
|
|
- LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
- LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
- LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
- LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
- LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
- LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
- left join project_report_data prd on prd.project_id = a.id
|
|
|
- left join project_report_data_two prdt on prdt.project_id = a.id
|
|
|
- left join rural_project_report_record prr on prr.report_id = prd.id
|
|
|
- LEFT JOIN project_material_defect_record pmdr on prd.id = pmdr.report_id
|
|
|
- left join rural_project_report_record_down prrd on prrd.report_id = prd.id
|
|
|
-
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
<where>
|
|
|
a.status = 5
|
|
|
AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
@@ -572,6 +656,86 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getElseRecordList" resultType="DownloadProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,"6" as "projectReportRecordStatus"
|
|
|
+ ,prr.record_date as "recordStartAuditDate"
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ ,timestampdiff(day,prd.audit_pass_date,now()) as "elseRecordDay"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,timestampdiff(day,prdt.audit_pass_date,now()) as "elseRecordDay"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ and prd.status = 5
|
|
|
+ AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and prr.status is null
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ and timestampdiff(day,prd.audit_pass_date,now())>#{endingCount}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and timestampdiff(day,prdt.audit_pass_date,now())>#{endingCount}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getExeedRecordList" resultType="DownloadProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,"7" as "projectReportRecordStatus"
|
|
|
+ ,prr.record_date as "recordStartAuditDate"
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ ,timestampdiff(day,prd.audit_pass_date,prr.record_date) as "exeedRecordDay"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,timestampdiff(day,prdt.audit_pass_date,prr.record_date) as "exeedRecordDay"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ and prd.status = 5
|
|
|
+ AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and prr.status is not null
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ and timestampdiff(day,prd.audit_pass_date,prr.record_date)>#{endingCount}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and timestampdiff(day,prdt.audit_pass_date,prr.record_date)>#{endingCount}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getProjectMaterialList" resultType="RuralProjectRecords" >
|
|
|
select a.id,a.project_name as "projectName"
|
|
|
from rural_project_records a
|
|
@@ -590,59 +754,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="findListOnReportedDownload" resultType="RuralProjectRecords" >
|
|
|
+ <select id="findListOnReportedDownload" resultType="DownloadProjectReporteds" >
|
|
|
SELECT
|
|
|
- <include refid="projectRecordsColumns"/>
|
|
|
- ,ifnull(a.reported_state,0) as "reportedState"
|
|
|
- ,a.project_master_id as "projectMasterId"
|
|
|
- ,sub.name as "projectMasterName"
|
|
|
- ,a.submit_money as "submitMoney"
|
|
|
- ,a.project_type as projectType,
|
|
|
- wci.name AS "workContractInfo.name",
|
|
|
- wct.id AS "workContractInfo.client.id",
|
|
|
- wct.name AS "workContractInfo.client.name",
|
|
|
- o.top_company AS "office.name",
|
|
|
- ifnull(prd.number ,"") as "projectReportNumber"
|
|
|
- ,ifnull(prd.status,0) as "projectReportStatus"
|
|
|
- ,ifnull(prd.name,"") as "projectReportName"
|
|
|
- ,ifnull(prr.status,0) as "projectReportRecordStatus"
|
|
|
- ,ifnull(prrd.status,0) as "downProjectReportRecordStatus",
|
|
|
- prrd.file_num as recodeNum,
|
|
|
- prr.process_instance_id as prrProcessInstanceId,
|
|
|
- prrd.process_instance_id as prrdProcessInstanceId
|
|
|
- ,prd.id as prdId
|
|
|
- ,prr.id as prrId
|
|
|
- ,prrd.id as prrdId
|
|
|
- ,prd.audit_pass_date as auditPassDate
|
|
|
- ,ifnull(rprr.report_status,0) as "reportStatus"
|
|
|
- ,ifnull(rprr.sync_status,0) as "syncStatus"
|
|
|
- ,rprr.process_instance_id as "reportedProcessInstanceId"
|
|
|
- ,ifnull(prdt.status,0) as "projectReportStatusTwo"
|
|
|
- ,prdt.id as prdtId
|
|
|
- ,prdt.process_instance_id as prdtProcessinstanceId
|
|
|
- ,ifnull(pmdr.status,0) as "defectRecordStatus"
|
|
|
- ,pmdr.process_instance_id as "pmdrProcessInstanceId"
|
|
|
- ,pmdr.id as pmdrId
|
|
|
- ,wci.contract_num as "workContractInfo.contractNum"
|
|
|
- ,wci.contract_price as "workContractInfo.contractPrice"
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,ifnull(rprr.report_status,0) as "projectReportRecordStatus"
|
|
|
FROM rural_project_records a
|
|
|
- LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
- left join rural_project_records_reported rprr on rprr.id = a.id
|
|
|
- LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id
|
|
|
- LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
- LEFT JOIN sys_user sub on a.project_master_id = sub.id
|
|
|
- LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
- LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
- LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
- LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
- LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
- LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
- left join project_report_data prd on prd.project_id = a.id
|
|
|
- left join project_report_data_two prdt on prdt.project_id = a.id
|
|
|
- left join rural_project_report_record prr on prr.report_id = prd.id
|
|
|
- LEFT JOIN project_material_defect_record pmdr on prd.id = pmdr.report_id
|
|
|
- left join rural_project_report_record_down prrd on prrd.report_id = prd.id
|
|
|
-
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
<where>
|
|
|
a.status = 5
|
|
|
AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
@@ -667,4 +784,172 @@
|
|
|
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getElseReportedList" resultType="DownloadProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,"6" as "projectReportRecordStatus"
|
|
|
+ ,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1) as "recordStartAuditDate"
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ ,timestampdiff(day,prd.audit_pass_date,now()) as "elseRecordDay"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,timestampdiff(day,prdt.audit_pass_date,now()) as "elseRecordDay"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ and prd.status = 5
|
|
|
+ AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and rprr.report_status is null
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ and timestampdiff(day,prd.audit_pass_date,now())>#{endingCount}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and timestampdiff(day,prdt.audit_pass_date,now())>#{endingCount}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getExeedReportedList" resultType="DownloadProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,"7" as "projectReportRecordStatus"
|
|
|
+ ,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1) as "recordStartAuditDate"
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ ,timestampdiff(day,prd.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1)) as "exeedRecordDay"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,timestampdiff(day,prdt.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1)) as "exeedRecordDay"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ and prd.status = 5
|
|
|
+ AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and rprr.report_status is not null
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ and timestampdiff(day,prd.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1))>#{endingCount}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and timestampdiff(day,prdt.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1))>#{endingCount}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDispenseReportedList" resultType="DownloadProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="recordDownloadSql"/>
|
|
|
+ ,"11" as "projectReportRecordStatus"
|
|
|
+ ,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1) as "recordStartAuditDate"
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ ,timestampdiff(day,prd.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1)) as "exeedRecordDay"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,timestampdiff(day,prdt.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1)) as "exeedRecordDay"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="recordDownloadLeftSql"/>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ and prd.status = 5
|
|
|
+ AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and rprr.report_status is not null
|
|
|
+ and rprr.JingHeJianLv>30
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject != null and emergencyProject != '' and emergencyProject == 1">
|
|
|
+ /*B类紧急*/
|
|
|
+ and timestampdiff(day,prd.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1))>#{endingCount}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and timestampdiff(day,prdt.audit_pass_date,(select create_date from work_activity_process wap where wap.process_instance_id = rprr.process_instance_id
|
|
|
+ order by create_date
|
|
|
+ limit 1))>#{endingCount}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getSumInvoiceMoney" resultType="java.lang.String">
|
|
|
+ select sum(wi.money) from work_invoice_project_relation a
|
|
|
+ left join work_invoice wi on wi.id = a.invoice_id
|
|
|
+ where a.project_id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getProjectMaterialListByDownload" resultType="DownloadProjectRecords" >
|
|
|
+ select a.id,a.project_name as "projectName"
|
|
|
+ from rural_project_records a
|
|
|
+ left join project_report_data prd on a.id = prd.project_id
|
|
|
+ left join project_material_defect_record pmdr on prd.id = pmdr.report_id
|
|
|
+ <where>
|
|
|
+ <if test="projectIdList!=null and projectIdList.size!=0">
|
|
|
+ and a.id in
|
|
|
+ <foreach collection="projectIdList" item="id" separator="," open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and pmdr.status = 5
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|