|
@@ -159,6 +159,70 @@
|
|
|
a.emergency_project as "emergencyProject"
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="newProjectRecordsColumns">
|
|
|
+ a.id AS "id",
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
+ a.create_date AS "createDate",
|
|
|
+ sua.name AS "createBy.name",
|
|
|
+ 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",
|
|
|
+ a.attachment_project_sort as "attachmentProjectSort",
|
|
|
+ a.report_signature_flag as "reportSignatureFlag",
|
|
|
+ a.report_signature_document_id as "reportSignatureDocumentId",
|
|
|
+ a.report_signature_contract_id as "reportSignatureContractId",
|
|
|
+ a.report_signature_invalid_document_id as "reportSignatureInvalidDocumentId",
|
|
|
+ a.report_signature_file_name as "reportSignatureFileName",
|
|
|
+ a.report_signature_upload_file_user as "reportSignatureUploadFileUser.id",
|
|
|
+ a.report_signature_upload_date as "reportSignatureUploadDate",
|
|
|
+ a.quality_signature_flag as "qualitySignatureFlag",
|
|
|
+ a.quality_signature_document_id as "qualitySignatureDocumentId",
|
|
|
+ a.quality_signature_contract_id as "qualitySignatureContractId",
|
|
|
+ a.quality_signature_invalid_document_id as "qualitySignatureInvalidDocumentId",
|
|
|
+ a.quality_signature_file_name as "qualitySignatureFileName",
|
|
|
+ a.quality_signature_upload_file_user as "qualitySignatureUploadFileUser.id",
|
|
|
+ a.quality_signature_upload_date as "qualitySignatureUploadDate",
|
|
|
+ a.belonging_department as "belongingDepartment"
|
|
|
+ </sql>
|
|
|
+
|
|
|
<sql id="recordDownloadSql">
|
|
|
distinct(a.id) AS "id",
|
|
|
a.create_by AS "createBy.id",
|
|
@@ -347,61 +411,37 @@ END) as projectScale*/
|
|
|
</select>
|
|
|
|
|
|
<select id="findList" resultType="RuralProjectRecords" >
|
|
|
+ select * from (
|
|
|
SELECT
|
|
|
- <include refid="projectRecordsColumns"/>
|
|
|
- ,a.record_state as "recordState"
|
|
|
+ <include refid="newProjectRecordsColumns"/>
|
|
|
+ ,concat(ifnull( pfp.STATUS, 0 ),ifnull( ppf.STATUS, 0 )) as "downProjectReportRecordPaperFilingStatus"
|
|
|
+ ,su.name as "leaderNameStr"
|
|
|
+ ,su.id as "leaderNameIds"
|
|
|
,a.submit_money as "submitMoney"
|
|
|
- ,a.submit_scale as "submitScale"
|
|
|
- ,(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",
|
|
|
- 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"
|
|
|
- ,prr.accomplish_date as "projectReportRecordAuditDate"
|
|
|
- ,(case
|
|
|
- when a.submit_money = '1' then
|
|
|
- ifnull(pfp.status,0)
|
|
|
- when a.submit_money = '2' then
|
|
|
- ifnull(prrd.status,0) else 0
|
|
|
- end) as downProjectReportRecordStatus,
|
|
|
- pfp.audit_pass_date as "projectFlingbatchRelationAuditPassDate",
|
|
|
- (case
|
|
|
- when a.submit_money = '1' and pfp.status = '5' then
|
|
|
- '已归档'
|
|
|
- when a.submit_money = '2' and ppf.status = '5' then
|
|
|
- '已归档' else '未归档'
|
|
|
- end) as downArchiveStatus,
|
|
|
- /*,ifnull(prrd.status,0) as "downProjectReportRecordStatus"*/
|
|
|
- prrd.file_num as recodeNum,
|
|
|
- prr.process_instance_id as prrProcessInstanceId,
|
|
|
- prrd.process_instance_id as prrdProcessInstanceId
|
|
|
+ ,a.project_material_storage_status as "projectMaterialStorageStatus"
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus != null and projectReportRecordStatus != ''">
|
|
|
+ ,ifnull(prr.status,#{projectReportRecordStatus}) as "projectReportRecordStatus"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,ifnull(prr.status,0) as "projectReportRecordStatus"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ ,prr.process_instance_id as prrProcessInstanceId
|
|
|
,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
|
|
@@ -410,53 +450,34 @@ END) as projectScale*/
|
|
|
,pmdr.process_instance_id as "pmdrProcessInstanceId"
|
|
|
,pmdr.id as pmdrId
|
|
|
,ifnull(ppf.status,0) as "paperFilingStatus"
|
|
|
- ,ppf.audit_pass_date as "projectPaperAuditPassDate"
|
|
|
,ppf.process_instance_id as "ppfProcessInstanceId"
|
|
|
,ppf.id as "ppfId"
|
|
|
- ,pfp.filing_batch as "filingBatch"
|
|
|
- ,pfp.box_num as "boxNum"
|
|
|
- ,pfp.re_box_num as "reBoxNum"
|
|
|
- ,pfb.id AS "FilingBatchId"
|
|
|
- ,(select group_concat(su.name) from work_project_user wpu left join sys_user su on su.id = wpu.user_id where wpu.project_id = a.id) as "leaderNameStr"
|
|
|
- ,(select group_concat(su.id) from work_project_user wpu left join sys_user su on su.id = wpu.user_id where wpu.project_id = a.id) as "leaderNameIds"
|
|
|
,pfb.process_instance_id AS "filingProcessinstanceId"
|
|
|
- ,pfb.filing_status AS "filingStatus"
|
|
|
,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.audit_pass_date as "prdAuditDate"
|
|
|
,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"
|
|
|
,cb.case_process_id as "caseProcessId"
|
|
|
,cb.case_type as "caseType"
|
|
|
,cb.case_create_by as "caseCreateBy"
|
|
|
,if(case_status > 0 ,case_status,"0") as "caseStatus"
|
|
|
- ,rprr.ZiXunBDE as "ziXunBDE"
|
|
|
- ,rprr.accomplish_date as "projectRecordsReportedAuditPassDate"
|
|
|
- ,a.project_material_storage_status as "projectMaterialStorageStatus"
|
|
|
- ,a.attachment_project_sort as "attachmentProjectSort"
|
|
|
FROM rural_project_records a
|
|
|
- left join case_base cb on a.id = cb.project_id
|
|
|
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 and pfp.del_flag = 0
|
|
|
+ left join case_base cb on a.id = cb.project_id
|
|
|
+ /*LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id*/
|
|
|
+ left join
|
|
|
+ (select id,status,project_id,filing_batch from
|
|
|
+ (
|
|
|
+ select id,create_date,status,project_id,filing_batch
|
|
|
+ from project_flingbatch_relation order by create_date desc
|
|
|
+ )z
|
|
|
+ group by z.project_id desc
|
|
|
+ ) 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
|
|
|
- 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 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 sys_user su on w1.user_id = su.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
|
|
@@ -464,24 +485,9 @@ END) as projectScale*/
|
|
|
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
|
|
|
- /*LEFT JOIN work_invoice_project_relation wip ON wip.project_id = a.id
|
|
|
- LEFT JOIN work_invoice wi ON wi.id = wip.invoice_id*/
|
|
|
<where>
|
|
|
a.status = 5
|
|
|
- <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
- and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
- </if>
|
|
|
- <if test="reportSignatureStatus!=null and reportSignatureStatus!=''">
|
|
|
- and prs.status=#{reportSignatureStatus}
|
|
|
- </if>
|
|
|
- <if test="approvalSignatureStatus!=null and approvalSignatureStatus!=''">
|
|
|
- and pas.status=#{approvalSignatureStatus}
|
|
|
- </if>
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
|
</if>
|
|
@@ -539,6 +545,19 @@ END) as projectScale*/
|
|
|
<if test="endDate !=null">
|
|
|
AND a.create_date < #{endDate}
|
|
|
</if>
|
|
|
+ <if test="attachmentProjectSort !=null and attachmentProjectSort != ''">
|
|
|
+ AND a.attachment_project_sort = #{attachmentProjectSort}
|
|
|
+ </if>
|
|
|
+ <if test="engineeringType !=null and engineeringType !=''">
|
|
|
+ and a.engineering_type= #{engineeringType}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
+ and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
+ </if>
|
|
|
+ <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
+ AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
+ </if>
|
|
|
<if test="emergencyProject !=null and emergencyProject != ''">
|
|
|
<choose>
|
|
|
<when test="emergencyProject == 0">
|
|
@@ -549,6 +568,23 @@ END) as projectScale*/
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
+ <if test="null != defectRecordStatus">
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 0">
|
|
|
+ and pmdr.status is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 2">
|
|
|
+ and pmdr.status in (1,2,3,4,6,7)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and pmdr.status = 5
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
<!--<if test="createBy != null and createBy.id !=null and createBy.id !=''">
|
|
|
AND a.create_by = #{createBy.id}
|
|
|
</if>-->
|
|
@@ -566,9 +602,6 @@ END) as projectScale*/
|
|
|
AND( /*pfp.status is null or*/ ppf.status is null )
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status is null) or (a.submit_money = 1 and pfp.status is null) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
</when>
|
|
|
<otherwise>
|
|
@@ -582,9 +615,6 @@ END) as projectScale*/
|
|
|
and ppf.status = #{downProjectReportRecordStatus}
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status = #{downProjectReportRecordStatus}) or (a.submit_money = 1 and pfp.status = #{downProjectReportRecordStatus}) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
@@ -599,18 +629,13 @@ END) as projectScale*/
|
|
|
<if test="office!=null and office.id=='' and office.name!=null and office.name!='' ">
|
|
|
and o.name like concat('%',#{office.name},'%')
|
|
|
</if>
|
|
|
+
|
|
|
<if test="officeIdList!=null and officeIdList.size!=0">
|
|
|
and a.office_id in
|
|
|
<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
#{officeId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="permissionOfficeIdList!=null and permissionOfficeIdList.size!=0">
|
|
|
- and a.office_id in
|
|
|
- <foreach collection="permissionOfficeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
- #{officeId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
|
|
|
<if test="reportedState !=null and reportedState !=''">
|
|
|
<choose>
|
|
@@ -623,28 +648,10 @@ END) as projectScale*/
|
|
|
</choose>
|
|
|
</if>
|
|
|
|
|
|
- <if test="engineeringType !=null and engineeringType !=''">
|
|
|
- and a.engineering_type= #{engineeringType}
|
|
|
- </if>
|
|
|
- <if test="attachmentProjectSort !=null and attachmentProjectSort !=''">
|
|
|
- and a.attachment_project_sort= #{attachmentProjectSort}
|
|
|
- </if>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus == null">
|
|
|
-
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus != 0">
|
|
|
- AND prd.status = #{projectReportStatus}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- AND prd.status is null
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
|
|
|
+ <if test="projectReportStatus != null and projectReportStatus != ''">
|
|
|
+ AND prd.status = #{projectReportStatus}
|
|
|
+ </if>
|
|
|
<if test="submitMoney != null and submitMoney != ''">
|
|
|
AND a.submit_money = #{submitMoney}
|
|
|
</if>
|
|
@@ -694,10 +701,7 @@ END) as projectScale*/
|
|
|
|
|
|
AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
<if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
|
|
|
- AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
|
|
|
- </if>
|
|
|
- <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
- AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
+ AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id} )${sqlMap.dsf} )
|
|
|
</if>
|
|
|
</where>
|
|
|
<choose>
|
|
@@ -708,64 +712,97 @@ END) as projectScale*/
|
|
|
ORDER BY SUBSTRING(a.project_id,-9) DESC
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
+ ) temporarydb
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <choose>
|
|
|
+ <when test="downProjectReportRecordStatus == 0">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="downProjectReportRecordStatus!=null and downProjectReportRecordStatus !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat(#{downProjectReportRecordStatus},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus}))
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus},'%'))
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="findExportList" resultType="RuralProjectRecordsExport" >
|
|
|
+ select * from (
|
|
|
SELECT
|
|
|
- <include refid="projectRecordsColumns"/>
|
|
|
- ,a.record_state as "recordState"
|
|
|
- ,a.submit_money as "submitMoney"
|
|
|
- ,a.submit_scale as "submitScale"
|
|
|
+ <include refid="newProjectRecordsColumns"/>
|
|
|
+ ,wci.contract_num as "workContractInfo.contractNum"
|
|
|
+ ,(select name from sys_user user where user.id=a.create_by) AS "createByName"
|
|
|
+ ,o.name AS "createByOffice"
|
|
|
+ ,sub.name as "projectMasterName"
|
|
|
,(case when a.submit_money = '1' then 'B级' when a.submit_money = '2' then 'A级' else '' end) as projectScale
|
|
|
+ ,rprr.ZiXunBDE as "ziXunBDE"
|
|
|
+ ,ifnull(prd.review_fee ,"") as "reviewFee"
|
|
|
+ ,ifnull(prd.approval_fee ,"") as "approvalFee"
|
|
|
+ ,ifnull(prd.verify_fee ,"") as "verifyFee"
|
|
|
+ ,ifnull(prd.verify_rate ,"") as "verifyRate"
|
|
|
+
|
|
|
,(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
|
|
|
+ when a.submit_money = '1' and pfp.status = '5' then
|
|
|
+ '已归档'
|
|
|
+ when a.submit_money = '2' and ppf.status = '5' then
|
|
|
+ '已归档' else '未归档'
|
|
|
+ end) as downArchiveStatus
|
|
|
+
|
|
|
+ ,concat(ifnull( pfp.STATUS, 0 ),ifnull( ppf.STATUS, 0 )) as "downProjectReportRecordPaperFilingStatus"
|
|
|
+ ,su.name as "leaderNameStr"
|
|
|
+ ,su.id as "leaderNameIds"
|
|
|
+ ,a.submit_money as "submitMoney"
|
|
|
,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"
|
|
|
- ,ifnull(prr.status,0) as "projectReportRecordStatus"
|
|
|
- ,prr.accomplish_date as "projectReportRecordAuditDate"
|
|
|
- ,(case
|
|
|
- when a.submit_money = '1' then
|
|
|
- ifnull(pfp.status,0)
|
|
|
- when a.submit_money = '2' then
|
|
|
- ifnull(prrd.status,0) else 0
|
|
|
- end) as downProjectReportRecordStatus,
|
|
|
- pfp.audit_pass_date as "projectFlingbatchRelationAuditPassDate",
|
|
|
- (case
|
|
|
- when a.submit_money = '1' and pfp.status = '5' then
|
|
|
- '已归档'
|
|
|
- when a.submit_money = '2' and ppf.status = '5' then
|
|
|
- '已归档' else '未归档'
|
|
|
- end) as downArchiveStatus,
|
|
|
- /*,ifnull(prrd.status,0) as "downProjectReportRecordStatus"*/
|
|
|
- prrd.file_num as recodeNum,
|
|
|
- prr.process_instance_id as prrProcessInstanceId,
|
|
|
- prrd.process_instance_id as prrdProcessInstanceId
|
|
|
+ ,a.project_material_storage_status as "projectMaterialStorageStatus"
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus != null and projectReportRecordStatus != ''">
|
|
|
+ ,ifnull(prr.status,#{projectReportRecordStatus}) as "projectReportRecordStatus"
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ,ifnull(prr.status,0) as "projectReportRecordStatus"
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ ,prr.process_instance_id as prrProcessInstanceId
|
|
|
,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
|
|
@@ -774,53 +811,35 @@ END) as projectScale*/
|
|
|
,pmdr.process_instance_id as "pmdrProcessInstanceId"
|
|
|
,pmdr.id as pmdrId
|
|
|
,ifnull(ppf.status,0) as "paperFilingStatus"
|
|
|
- ,ppf.audit_pass_date as "projectPaperAuditPassDate"
|
|
|
,ppf.process_instance_id as "ppfProcessInstanceId"
|
|
|
,ppf.id as "ppfId"
|
|
|
- ,pfp.filing_batch as "filingBatch"
|
|
|
- ,pfp.box_num as "boxNum"
|
|
|
- ,pfp.re_box_num as "reBoxNum"
|
|
|
- ,pfb.id AS "FilingBatchId"
|
|
|
- ,(select group_concat(su.name) from work_project_user wpu left join sys_user su on su.id = wpu.user_id where wpu.project_id = a.id) as "leaderNameStr"
|
|
|
- ,(select group_concat(su.id) from work_project_user wpu left join sys_user su on su.id = wpu.user_id where wpu.project_id = a.id) as "leaderNameIds"
|
|
|
,pfb.process_instance_id AS "filingProcessinstanceId"
|
|
|
- ,pfb.filing_status AS "filingStatus"
|
|
|
,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.audit_pass_date as "prdAuditDate"
|
|
|
,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"
|
|
|
,cb.case_process_id as "caseProcessId"
|
|
|
,cb.case_type as "caseType"
|
|
|
,cb.case_create_by as "caseCreateBy"
|
|
|
,if(case_status > 0 ,case_status,"0") as "caseStatus"
|
|
|
- ,rprr.ZiXunBDE as "ziXunBDE"
|
|
|
- ,rprr.accomplish_date as "projectRecordsReportedAuditPassDate"
|
|
|
- ,a.project_material_storage_status as "projectMaterialStorageStatus"
|
|
|
- ,a.attachment_project_sort as "attachmentProjectSort"
|
|
|
FROM rural_project_records a
|
|
|
- left join case_base cb on a.id = cb.project_id
|
|
|
LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
+ LEFT JOIN sys_user sub on a.project_master_id = sub.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 and pfp.del_flag = 0
|
|
|
+ left join case_base cb on a.id = cb.project_id
|
|
|
+ /*LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id*/
|
|
|
+ left join
|
|
|
+ (select id,status,project_id,filing_batch from
|
|
|
+ (
|
|
|
+ select id,create_date,status,project_id,filing_batch
|
|
|
+ from project_flingbatch_relation order by create_date desc
|
|
|
+ )z
|
|
|
+ group by z.project_id desc
|
|
|
+ ) 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
|
|
|
- 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 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 sys_user su on w1.user_id = su.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
|
|
@@ -828,24 +847,9 @@ END) as projectScale*/
|
|
|
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
|
|
|
- /*LEFT JOIN work_invoice_project_relation wip ON wip.project_id = a.id
|
|
|
- LEFT JOIN work_invoice wi ON wi.id = wip.invoice_id*/
|
|
|
<where>
|
|
|
a.status = 5
|
|
|
- <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
- and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
- </if>
|
|
|
- <if test="reportSignatureStatus!=null and reportSignatureStatus!=''">
|
|
|
- and prs.status=#{reportSignatureStatus}
|
|
|
- </if>
|
|
|
- <if test="approvalSignatureStatus!=null and approvalSignatureStatus!=''">
|
|
|
- and pas.status=#{approvalSignatureStatus}
|
|
|
- </if>
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
|
</if>
|
|
@@ -903,6 +907,19 @@ END) as projectScale*/
|
|
|
<if test="endDate !=null">
|
|
|
AND a.create_date < #{endDate}
|
|
|
</if>
|
|
|
+ <if test="attachmentProjectSort !=null and attachmentProjectSort != ''">
|
|
|
+ AND a.attachment_project_sort = #{attachmentProjectSort}
|
|
|
+ </if>
|
|
|
+ <if test="engineeringType !=null and engineeringType !=''">
|
|
|
+ and a.engineering_type= #{engineeringType}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
+ and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
+ </if>
|
|
|
+ <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
+ AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
+ </if>
|
|
|
<if test="emergencyProject !=null and emergencyProject != ''">
|
|
|
<choose>
|
|
|
<when test="emergencyProject == 0">
|
|
@@ -930,9 +947,6 @@ END) as projectScale*/
|
|
|
AND( /*pfp.status is null or*/ ppf.status is null )
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status is null) or (a.submit_money = 1 and pfp.status is null) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
</when>
|
|
|
<otherwise>
|
|
@@ -946,14 +960,28 @@ END) as projectScale*/
|
|
|
and ppf.status = #{downProjectReportRecordStatus}
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status = #{downProjectReportRecordStatus}) or (a.submit_money = 1 and pfp.status = #{downProjectReportRecordStatus}) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
+ <if test="null != defectRecordStatus">
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 0">
|
|
|
+ and pmdr.status is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 2">
|
|
|
+ and pmdr.status in (1,2,3,4,6,7)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and pmdr.status = 5
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
<if test="reportData!=null and reportData.number !=null and reportData.number !=''">
|
|
|
and prd.number like concat('%',#{reportData.number},'%')
|
|
|
</if>
|
|
@@ -963,18 +991,13 @@ END) as projectScale*/
|
|
|
<if test="office!=null and office.id=='' and office.name!=null and office.name!='' ">
|
|
|
and o.name like concat('%',#{office.name},'%')
|
|
|
</if>
|
|
|
+
|
|
|
<if test="officeIdList!=null and officeIdList.size!=0">
|
|
|
and a.office_id in
|
|
|
<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
#{officeId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="permissionOfficeIdList!=null and permissionOfficeIdList.size!=0">
|
|
|
- and a.office_id in
|
|
|
- <foreach collection="permissionOfficeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
- #{officeId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
|
|
|
<if test="reportedState !=null and reportedState !=''">
|
|
|
<choose>
|
|
@@ -987,28 +1010,10 @@ END) as projectScale*/
|
|
|
</choose>
|
|
|
</if>
|
|
|
|
|
|
- <if test="engineeringType !=null and engineeringType !=''">
|
|
|
- and a.engineering_type= #{engineeringType}
|
|
|
- </if>
|
|
|
- <if test="attachmentProjectSort !=null and attachmentProjectSort !=''">
|
|
|
- and a.attachment_project_sort= #{attachmentProjectSort}
|
|
|
- </if>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus == null">
|
|
|
-
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus != 0">
|
|
|
- AND prd.status = #{projectReportStatus}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- AND prd.status is null
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
|
|
|
+ <if test="projectReportStatus != null and projectReportStatus != ''">
|
|
|
+ AND prd.status = #{projectReportStatus}
|
|
|
+ </if>
|
|
|
<if test="submitMoney != null and submitMoney != ''">
|
|
|
AND a.submit_money = #{submitMoney}
|
|
|
</if>
|
|
@@ -1058,10 +1063,7 @@ END) as projectScale*/
|
|
|
|
|
|
AND a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
<if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
|
|
|
- AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
|
|
|
- </if>
|
|
|
- <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
- AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
+ AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id} )${sqlMap.dsf} )
|
|
|
</if>
|
|
|
</where>
|
|
|
<choose>
|
|
@@ -1072,46 +1074,80 @@ END) as projectScale*/
|
|
|
ORDER BY SUBSTRING(a.project_id,-9) DESC
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
+ ) temporarydb
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <choose>
|
|
|
+ <when test="downProjectReportRecordStatus == 0">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="downProjectReportRecordStatus!=null and downProjectReportRecordStatus !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat(#{downProjectReportRecordStatus},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus}))
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus},'%'))
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="queryCount" resultType="int" >
|
|
|
- SELECT count(DISTINCT a.id)
|
|
|
+ <select id="queryCount" resultType="int" >
|
|
|
+ select count( id) from (
|
|
|
+ SELECT (a.id) as id
|
|
|
+ ,concat(ifnull( pfp.STATUS, 0 ),ifnull( ppf.STATUS, 0 )) as "downProjectReportRecordPaperFilingStatus"
|
|
|
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 case_base cb on a.id = cb.project_id
|
|
|
+ /*LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id*/
|
|
|
+ left join
|
|
|
+ (select id,status,project_id,filing_batch from
|
|
|
+ (
|
|
|
+ select id,create_date,status,project_id,filing_batch
|
|
|
+ from project_flingbatch_relation order by create_date desc
|
|
|
+ )z
|
|
|
+ group by z.project_id desc
|
|
|
+ ) pfp ON pfp.project_id = a.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 project_filingbatch pfb on pfb.id=pfp.filing_batch
|
|
|
+ LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
- <if test="workContractInfo !=null">
|
|
|
- LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
- </if>
|
|
|
- <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
|
|
|
- LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
- </if>
|
|
|
+ LEFT JOIN sys_user su on w1.user_id = su.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
|
|
|
- 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 project_paper_filing ppf on ppf.project_id = a.id
|
|
|
- LEFT JOIN sys_office o ON o.id = a.office_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>
|
|
|
a.status = 5
|
|
|
- <if test="reportSignatureStatus!=null and reportSignatureStatus!=''">
|
|
|
- and prs.status=#{reportSignatureStatus}
|
|
|
- </if>
|
|
|
- <if test="approvalSignatureStatus!=null and approvalSignatureStatus!=''">
|
|
|
- and pas.status=#{approvalSignatureStatus}
|
|
|
- </if>
|
|
|
- <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
- and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
- </if>
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
|
</if>
|
|
@@ -1169,6 +1205,22 @@ END) as projectScale*/
|
|
|
<if test="endDate !=null">
|
|
|
AND a.create_date < #{endDate}
|
|
|
</if>
|
|
|
+ <if test="attachmentProjectSort !=null and attachmentProjectSort != ''">
|
|
|
+ AND a.attachment_project_sort = #{attachmentProjectSort}
|
|
|
+ </if>
|
|
|
+ <if test="attachmentProjectSort !=null and attachmentProjectSort !=''">
|
|
|
+ and a.attachment_project_sort= #{attachmentProjectSort}
|
|
|
+ </if>
|
|
|
+ <if test="engineeringType !=null and engineeringType !=''">
|
|
|
+ and a.engineering_type= #{engineeringType}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="bzshbUserId!=null and bzshbUserId!=''">
|
|
|
+ and prd.bzshb_user_id=#{bzshbUserId}
|
|
|
+ </if>
|
|
|
+ <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
+ AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
+ </if>
|
|
|
<if test="emergencyProject !=null and emergencyProject != ''">
|
|
|
<choose>
|
|
|
<when test="emergencyProject == 0">
|
|
@@ -1197,9 +1249,6 @@ END) as projectScale*/
|
|
|
AND( /*pfp.status is null or*/ ppf.status is null )
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status is null) or (a.submit_money = 1 and pfp.status is null) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
</when>
|
|
|
<otherwise>
|
|
@@ -1213,56 +1262,47 @@ END) as projectScale*/
|
|
|
and ppf.status = #{downProjectReportRecordStatus}
|
|
|
</if>
|
|
|
</when>
|
|
|
- <otherwise>
|
|
|
- AND( (a.submit_money = 2 and ppf.status = #{downProjectReportRecordStatus}) or (a.submit_money = 1 and pfp.status = #{downProjectReportRecordStatus}) )
|
|
|
- </otherwise>
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
+
|
|
|
+ <if test="null != defectRecordStatus">
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 0">
|
|
|
+ and pmdr.status is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <choose>
|
|
|
+ <when test="defectRecordStatus == 2">
|
|
|
+ and pmdr.status in (1,2,3,4,6,7)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and pmdr.status = 5
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
<if test="reportData!=null and reportData.number !=null and reportData.number !=''">
|
|
|
and prd.number like concat('%',#{reportData.number},'%')
|
|
|
</if>
|
|
|
- <if test="engineeringType !=null and engineeringType !=''">
|
|
|
- and a.engineering_type= #{engineeringType}
|
|
|
- </if>
|
|
|
- <if test="attachmentProjectSort !=null and attachmentProjectSort !=''">
|
|
|
- and a.attachment_project_sort= #{attachmentProjectSort}
|
|
|
- </if>
|
|
|
<!--<if test="office!=null and office.id!=null and office.id!=''">
|
|
|
and a.office_id = #{office.id}
|
|
|
</if>-->
|
|
|
<if test="office!=null and office.id=='' and office.name!=null and office.name!='' ">
|
|
|
and o.name like concat('%',#{office.name},'%')
|
|
|
</if>
|
|
|
- <if test="permissionOfficeIdList!=null and permissionOfficeIdList.size!=0">
|
|
|
- and a.office_id in
|
|
|
- <foreach collection="permissionOfficeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
- #{officeId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
<if test="officeIdList!=null and officeIdList.size!=0">
|
|
|
and a.office_id in
|
|
|
<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
|
|
|
#{officeId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus == null">
|
|
|
-
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <choose>
|
|
|
- <when test="projectReportStatus != 0">
|
|
|
- AND prd.status = #{projectReportStatus}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- AND prd.status is null
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
+ <if test="projectReportStatus != null and projectReportStatus != ''">
|
|
|
+ AND prd.status = #{projectReportStatus}
|
|
|
+ </if>
|
|
|
<if test="reportedState !=null and reportedState !=''">
|
|
|
<choose>
|
|
|
<when test="reportedState == 0">
|
|
@@ -1322,11 +1362,47 @@ END) as projectScale*/
|
|
|
<if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
|
|
|
AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
|
|
|
</if>
|
|
|
- <if test="projectMaterialStorageStatus !=null and projectMaterialStorageStatus!=''">
|
|
|
- AND a.project_material_storage_status= #{projectMaterialStorageStatus}
|
|
|
- </if>
|
|
|
+ </where>) temporarydb
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <choose>
|
|
|
+ <when test="downProjectReportRecordStatus == 0">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus = '00')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="downProjectReportRecordStatus!=null and downProjectReportRecordStatus !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat(#{downProjectReportRecordStatus},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus}))
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( temporarydb.downProjectReportRecordPaperFilingStatus like concat('%',#{downProjectReportRecordStatus},'%'))
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
</where>
|
|
|
- </select>
|
|
|
+
|
|
|
+ </select>
|
|
|
|
|
|
<select id="findListOnUndocumentedRecordDownload" resultType="DownloadProjectRecords" >
|
|
|
SELECT
|