|
@@ -74,6 +74,55 @@
|
|
|
a.belonging_department as "belongingDepartment"
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="projectRecordsColumnss">
|
|
|
+ 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"
|
|
|
+ </sql>
|
|
|
+
|
|
|
<sql id="projectRecordsJoins">
|
|
|
LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
</sql>
|
|
@@ -241,34 +290,97 @@
|
|
|
|
|
|
<select id="findList" resultType="RuralProjectRecords" >
|
|
|
SELECT
|
|
|
- <include refid="projectRecordsColumns"/>
|
|
|
- ,a.submit_money as "submitMoney",
|
|
|
+ <include refid="projectRecordsColumnss"/>
|
|
|
+ ,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
|
|
|
+ ,(case
|
|
|
+ when a.submit_money = '1' and prd.status = '5' then
|
|
|
+ '已完成'
|
|
|
+ when a.submit_money = '2' and prdt.status = '5' then
|
|
|
+ '已完成' else '未完成'
|
|
|
+ end) as completionStatus
|
|
|
+ ,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"
|
|
|
- ,ifnull(prr.status ,0) as "projectReportRecordStatus"
|
|
|
- ,ifnull(prd.status ,0) as "projectReportStatus"
|
|
|
- ,if(prd.number is not null,"1","0") as reportDataFlag
|
|
|
+ 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(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
|
|
|
+ ,if(date_add(prd.audit_pass_date,interval #{endingCount} day) >now(),"0","1") as reportedType
|
|
|
+ ,ifnull(rprr.report_status,0) as "reportStatus"
|
|
|
+ ,ifnull(rprr.sync_status,0) as "syncStatus"
|
|
|
+ ,ifnull(pas.status,0) as "approvalSignatureStatus"
|
|
|
+ ,ifnull(pas.process_instance_id,"") as "approvalSignatureProcessInstanceId"
|
|
|
+ ,ifnull(prs.status,0) as "reportSignatureStatus"
|
|
|
+ ,ifnull(prs.process_instance_id,"") as "reportSignatureProcessInstanceId"
|
|
|
+ ,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
|
|
|
+ ,ifnull(ppf.status,0) as "paperFilingStatus"
|
|
|
+ ,ppf.process_instance_id as "ppfProcessInstanceId"
|
|
|
+ ,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"
|
|
|
+ /*,SUM(wi.money) as "money"*/
|
|
|
+ ,prd.ZiXunShouRu as "money"
|
|
|
+ ,prd.signature_flag as "signatureFlag"
|
|
|
+ ,prd.signature_contract_id as "signatureContractId"
|
|
|
+ ,prd.signature_url as "signatureUrl"
|
|
|
+ ,a.report_signature_flag as "reportSignatureFlag"
|
|
|
+ ,a.report_signature_url as "reportSignatureUrl"
|
|
|
+ ,a.report_signature_contract_id as "reportSignatureContractId"
|
|
|
+ ,prsi.id as "prsiId"
|
|
|
FROM rural_project_records a
|
|
|
- <include refid="projectRecordsJoins"/>
|
|
|
-
|
|
|
- <if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
- LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
- LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
- </if>
|
|
|
- <if test="createBy !=null and createBy !=''">
|
|
|
- <if test="createBy.name !=null and createBy.name !=''">
|
|
|
- LEFT JOIN sys_user cr on a.create_by = cr.id
|
|
|
- </if>
|
|
|
+ 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 project_filingbatch pfb on pfb.id=pfp.filing_batch
|
|
|
+ LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
+ <if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
+ LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
+ LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
</if>
|
|
|
- LEFT JOIN work_project_user w1 on a.id = w1.project_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 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 project_report_data prd on prd.project_id = a.id
|
|
|
- LEFT JOIN rural_project_report_record prr on prd.id = prr.report_id
|
|
|
- LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
- LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.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
|
|
|
+ left join project_paper_filing ppf on ppf.project_id = a.id
|
|
|
+ left join project_approval_signature pas on pas.project_id = a.id
|
|
|
+ left join project_report_signature prs on prs.project_id = a.id
|
|
|
+ left join project_report_signature_info prsi on prsi.project_report_id = prd.number
|
|
|
<where>
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
AND a.project_id like concat('%',#{projectId},'%')
|