|
@@ -653,7 +653,351 @@ END) as projectScale*/
|
|
|
ORDER BY ${page.orderBy}
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
- ORDER BY a.update_date DESC
|
|
|
+ ORDER BY SUBSTRING(a.project_id,-9) DESC
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findExportList" resultType="RuralProjectRecordsExport" >
|
|
|
+ SELECT
|
|
|
+ <include refid="projectRecordsColumns"/>
|
|
|
+ ,a.record_state as "recordState"
|
|
|
+ ,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"
|
|
|
+ ,(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,
|
|
|
+ (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
|
|
|
+ ,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"
|
|
|
+ ,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.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"
|
|
|
+ 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 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 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 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
|
|
|
+ /*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>
|
|
|
+ <if test="projectName != null and projectName != ''">
|
|
|
+ AND a.project_name like concat(concat('%',#{projectName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="scaleType != null and scaleType != ''">
|
|
|
+ AND a.scale_type = #{scaleType}
|
|
|
+ </if>
|
|
|
+ <if test="scaleUnit != null and scaleUnit != ''">
|
|
|
+ AND a.scale_unit = #{scaleUnit}
|
|
|
+ </if>
|
|
|
+ <if test="scaleQuantity != null and scaleQuantity != ''">
|
|
|
+ AND a.scale_quantity = #{scaleQuantity}
|
|
|
+ </if>
|
|
|
+ <if test="projectSite != null and projectSite != ''">
|
|
|
+ AND a.project_site LIKE concat('%',#{projectSite},'%')
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND a.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="projectDesc != null and projectDesc != ''">
|
|
|
+ AND a.project_desc LIKE concat('%',#{projectDesc},'%')
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_id = #{area.id}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !=''">
|
|
|
+ AND wci.name like concat(concat('%',#{workContractInfo.name}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !=''">
|
|
|
+ AND wci.contract_num like concat(concat('%',#{workContractInfo.contractNum}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !=''">
|
|
|
+ AND wci.contract_price = #{workContractInfo.contractPrice}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !=''">
|
|
|
+ AND wci.contract_type = #{workContractInfo.contractType}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
|
|
|
+ AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
|
|
|
+ </if>
|
|
|
+ <!--<if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
+ AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
|
|
|
+ </if>-->
|
|
|
+ <if test="(leaderNameStr != null and leaderNameStr != '') or (leaderId != null and leaderId != '')">
|
|
|
+ AND ((w.user_id = #{leaderId}) or su.name like concat('%',#{leaderNameStr},'%')) AND w.is_master = '1' AND w.del_flag='0'
|
|
|
+ </if>
|
|
|
+ <if test="projectStatus !=null">
|
|
|
+ AND a.status = #{projectStatus}
|
|
|
+ </if>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="emergencyProject !=null and emergencyProject != ''">
|
|
|
+ <choose>
|
|
|
+ <when test="emergencyProject == 0">
|
|
|
+ AND (a.emergency_project = #{emergencyProject} or a.emergency_project is null)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND a.emergency_project = #{emergencyProject}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <!--<if test="createBy != null and createBy.id !=null and createBy.id !=''">
|
|
|
+ AND a.create_by = #{createBy.id}
|
|
|
+ </if>-->
|
|
|
+ <if test="createBy != null and((createBy.id != null and createBy.id != '') or (createBy.name != null and createBy.name != ''))">
|
|
|
+ AND (a.create_by = #{createBy.id} or sua.name like concat('%',#{createBy.name},'%'))
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="downProjectReportRecordStatus == 0">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ AND( pfp.status is null)
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ AND( /*pfp.status is null or*/ ppf.status is null )
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND( (a.submit_money = 2 and pfp.status is null) or (a.submit_money = 1 and ppf.status is null) )
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="downProjectReportRecordStatus!=null and downProjectReportRecordStatus !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="submitMoney !=null and submitMoney !=''">
|
|
|
+ <if test="submitMoney == 1">
|
|
|
+ and pfp.status = #{downProjectReportRecordStatus}
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney == 2">
|
|
|
+ and ppf.status = #{downProjectReportRecordStatus}
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and ppf.status = #{downProjectReportRecordStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="reportData!=null and reportData.number !=null and reportData.number !=''">
|
|
|
+ and prd.number like concat('%',#{reportData.number},'%')
|
|
|
+ </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="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>
|
|
|
+ <when test="reportedState == 0">
|
|
|
+ AND a.reported_state is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND a.reported_state = #{reportedState}
|
|
|
+ </otherwise>
|
|
|
+ </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>
|
|
|
+ <if test="projectReportStatus != null and projectReportStatus != ''">
|
|
|
+ AND prd.status = #{projectReportStatus}
|
|
|
+ </if>
|
|
|
+ <if test="submitMoney != null and submitMoney != ''">
|
|
|
+ AND a.submit_money = #{submitMoney}
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus != null and projectReportRecordStatus != '' and projectReportRecordStatus != 0">
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus == 6 or projectReportRecordStatus == 7">
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus == 6">
|
|
|
+ AND a.record_state= #{projectReportRecordStatus} and prr.status is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND prr.status = #{projectReportRecordStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND prr.status = #{projectReportRecordStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportRecordStatus == 0">
|
|
|
+ AND prr.status is null
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <if test="typeList !=null and typeList !=''">
|
|
|
+ and a.project_type in
|
|
|
+ <foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="projectReportStatusTwo == 0">
|
|
|
+ AND prdt.status is null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="projectReportStatusTwo!=null and projectReportStatusTwo !=''">
|
|
|
+ AND prdt.status = #{projectReportStatusTwo}
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ 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>
|
|
|
+ </where>
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ORDER BY SUBSTRING(a.project_id,-9) DESC
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</select>
|