|
@@ -1520,4 +1520,349 @@ END) as projectScale*/
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
+ <select id="findSignatureList" resultType="RuralProjectRecords" >
|
|
|
+ SELECT 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",
|
|
|
+ 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.record_state AS "recordState",
|
|
|
+ a.submit_money AS "submitMoney",
|
|
|
+ a.submit_scale AS "submitScale",
|
|
|
+ a.project_type AS projectType,
|
|
|
+ o.top_company AS "office.name",
|
|
|
+ o.NAME AS "createByOffice",
|
|
|
+ ifnull( prd.number, "" ) AS "projectReportNumber",
|
|
|
+ prrd.process_instance_id AS prrdProcessInstanceId,
|
|
|
+ prd.id AS prdId,
|
|
|
+ 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",
|
|
|
+ prd.signature_contract_id AS "signatureContractId",
|
|
|
+ prd.signature_url AS "signatureUrl",
|
|
|
+ a.report_signature_url AS "reportSignatureUrl",
|
|
|
+ a.report_signature_contract_id AS "reportSignatureContractId",
|
|
|
+ prsi.id AS "prsiId",
|
|
|
+ (
|
|
|
+ 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"
|
|
|
+ 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 sys_user sua ON a.create_by = sua.id
|
|
|
+ LEFT JOIN work_project_user w1 ON a.id = w1.project_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 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>
|
|
|
+ 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="(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 != '') or (createBy.name != null and createBy.name != ''))">
|
|
|
+ AND (a.create_by = #{createBy.id} or sua.name like concat('%',#{createBy.name},'%'))
|
|
|
+ </if>
|
|
|
+ <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=='' 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="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>
|
|
|
+
|
|
|
+ <if test="typeList !=null and typeList !=''">
|
|
|
+ and a.project_type in
|
|
|
+ <foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ 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 a.update_date DESC
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="querySignatureCount" resultType="int" >
|
|
|
+ SELECT count(DISTINCT a.id)
|
|
|
+ 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 sys_user sua ON a.create_by = sua.id
|
|
|
+ LEFT JOIN work_project_user w1 ON a.id = w1.project_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 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>
|
|
|
+ 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="(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 != '') or (createBy.name != null and createBy.name != ''))">
|
|
|
+ AND (a.create_by = #{createBy.id} or sua.name like concat('%',#{createBy.name},'%'))
|
|
|
+ </if>
|
|
|
+ <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=='' 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="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>
|
|
|
+
|
|
|
+ <if test="typeList !=null and typeList !=''">
|
|
|
+ and a.project_type in
|
|
|
+ <foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ 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>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|