|
@@ -0,0 +1,631 @@
|
|
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
+<mapper namespace="com.jeeplus.modules.projectPerformanceDatabase.dao.ProjectPerformanceDao">
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="businessQuestionsColumns">
|
|
|
|
|
+ a.id as "id",
|
|
|
|
|
+ a.create_by as "createBy.id",
|
|
|
|
|
+ (select name from sys_user user where user.id=a.create_by) as "createBy.name",
|
|
|
|
|
+ a.create_date as "createDate",
|
|
|
|
|
+ a.update_by as "updateBy.id",
|
|
|
|
|
+ a.update_date as "updateDate",
|
|
|
|
|
+ a.remarks as "remarks",
|
|
|
|
|
+ a.del_flag as "delFlag",
|
|
|
|
|
+ a.value as "value",
|
|
|
|
|
+ a.sort as "sort",
|
|
|
|
|
+ a.office_id as "office.id",
|
|
|
|
|
+ a.company_id as "company.id"
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <select id="get" resultType="RuralProjectRecords" >
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.*
|
|
|
|
|
+ FROM rural_project_records a
|
|
|
|
|
+ WHERE a.id = #{id}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="findList" resultType="RuralProjectRecords" >
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id AS "id",
|
|
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
|
|
+ a.create_date AS "createDate",
|
|
|
|
|
+ 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.submit_scale AS "submitScale",
|
|
|
|
|
+ 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",
|
|
|
|
|
+ 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",
|
|
|
|
|
+ a.submit_money as "submitMoney",
|
|
|
|
|
+ a.project_type as projectType,
|
|
|
|
|
+ a.project_material_storage_status as "projectMaterialStorageStatus",
|
|
|
|
|
+
|
|
|
|
|
+ a.paper_filing_status as "apaperFilingStatus",
|
|
|
|
|
+ a.over_paper_filing_status as "overPaperFilingStatus",
|
|
|
|
|
+ sua.name AS "createBy.name",
|
|
|
|
|
+ area.name AS "area.name",
|
|
|
|
|
+ su.name as "leaderNameStr",
|
|
|
|
|
+ su.id as "leaderNameIds",
|
|
|
|
|
+ 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"
|
|
|
|
|
+
|
|
|
|
|
+ ,prd.audit_pass_date as auditPassDate
|
|
|
|
|
+ ,prd.first_audit_date as "reportAuditDate"
|
|
|
|
|
+ ,if(date_add(prd.audit_pass_date,interval #{endingCount} day) >now(),"0","1") as reportedType
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ ,prd.audit_pass_date as "prdAuditDate"
|
|
|
|
|
+ ,prd.ZiXunShouRu as "money"
|
|
|
|
|
+ ,ppd.value as "projectPerformanceName"
|
|
|
|
|
+
|
|
|
|
|
+ FROM rural_project_records a
|
|
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_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_user su on w1.user_id = su.id
|
|
|
|
|
+ LEFT JOIN sys_user suMaster on a.project_master_id = suMaster.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_performance pp on pp.project_id = a.id and pp.del_flag = '0'
|
|
|
|
|
+ left join project_performance_database ppd on ppd.id = pp.project_performance_database_id and ppd.del_flag = '0'
|
|
|
|
|
+ <where>
|
|
|
|
|
+ a.status = 5
|
|
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
|
|
+ AND a.project_id like concat('%',#{projectId},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
|
|
+ AND (area.parent_ids LIKE concat('%',#{area.id},'%')
|
|
|
|
|
+ or a.area_id = #{area.id}
|
|
|
|
|
+ )
|
|
|
|
|
+ </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="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 != '') or (leaderId != null and leaderId != '')">
|
|
|
|
|
+ AND ((w1.user_id = #{leaderId}) or su.name like concat('%',#{leaderNameStr},'%')) AND w1.is_master = '1' AND w1.del_flag='0'
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="(projectMasterName != null and projectMasterName != '') or (projectMasterId != null and projectMasterId != '')">
|
|
|
|
|
+ AND ((a.project_master_id = #{projectMasterId}) or suMaster.name like concat('%',#{projectMasterName},'%')) AND suMaster.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="beginSubmitScale !=null and beginSubmitScale != ''">
|
|
|
|
|
+ AND a.submit_scale >= #{beginSubmitScale}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endSubmitScale !=null and endSubmitScale != ''">
|
|
|
|
|
+ AND a.submit_scale < #{endSubmitScale}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 咨询营业收入 -->
|
|
|
|
|
+ <if test="beginMoney !=null">
|
|
|
|
|
+ AND prd.ZiXunShouRu >= #{beginMoney}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endMoney !=null">
|
|
|
|
|
+ AND prd.ZiXunShouRu < #{endMoney}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 质量复核审核时间 -->
|
|
|
|
|
+ <if test="reportBeginDate !=null">
|
|
|
|
|
+ AND prd.audit_pass_date >= #{reportBeginDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="reportEndDate !=null">
|
|
|
|
|
+ AND prd.audit_pass_date <= #{reportEndDate}
|
|
|
|
|
+ </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="projectPerformanceId!=null and projectPerformanceId!=''">
|
|
|
|
|
+ and pp.project_performance_database_id=#{projectPerformanceId}
|
|
|
|
|
+ </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">
|
|
|
|
|
+ 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 (
|
|
|
|
|
+ <if test="reportData.number == '暂无报告'">
|
|
|
|
|
+ (prd.number = '' or prd.number is null)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="reportData.number != '暂无报告'">
|
|
|
|
|
+ prd.number like concat('%', #{reportData.number}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
|
|
+ </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="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="projectReportStatus != null">
|
|
|
|
|
+ AND
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="projectReportStatus != 0">
|
|
|
|
|
+ prd.status = #{projectReportStatus}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ prd.STATUS is null
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </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>
|
|
|
|
|
+
|
|
|
|
|
+ <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="reportBeginDate !=null or reportEndDate !=null">
|
|
|
|
|
+ AND prd.status in (5,7)
|
|
|
|
|
+ </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 SUBSTRING(a.project_id,6,4) DESC,cast( SUBSTRING(a.project_id,11) as UNSIGNED) DESC
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="queryCount" resultType="java.lang.Integer" >
|
|
|
|
|
+ SELECT count(DISTINCT a.id) <!-- 这里改成 DISTINCT 防止数据膨胀 -->
|
|
|
|
|
+
|
|
|
|
|
+ FROM rural_project_records a
|
|
|
|
|
+
|
|
|
|
|
+ <!-- ===================== 按需 LEFT JOIN 开始 ===================== -->
|
|
|
|
|
+ <!-- 1. 区域:只有传了 area 条件才连表 -->
|
|
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 2. 创建人:只有传了 createBy 条件才连表 -->
|
|
|
|
|
+ <if test="createBy != null and ((createBy.id != null and createBy.id != '') or (createBy.name != null and createBy.name != ''))">
|
|
|
|
|
+ LEFT JOIN sys_user sua on a.create_by = sua.id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 3. 项目成员/负责人:只有传了 leader 相关才连表 -->
|
|
|
|
|
+ <if test="(leaderNameStr != null and leaderNameStr != '') or (leaderId != null and leaderId != '') or sqlMap.dsf != null and sqlMap.dsf != ''">
|
|
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
|
|
+ LEFT JOIN sys_user su on w1.user_id = su.id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 4. 项目负责人:只有传了 projectMaster 才连表 -->
|
|
|
|
|
+ <if test="(projectMasterName != null and projectMasterName != '') or (projectMasterId != null and projectMasterId != '')">
|
|
|
|
|
+ LEFT JOIN sys_user suMaster on a.project_master_id = suMaster.id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 5. 合同 + 客户:只有传了合同/客户条件才连表 -->
|
|
|
|
|
+ <if test="(workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !='')
|
|
|
|
|
+ or (workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !='')
|
|
|
|
|
+ or (workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !='')
|
|
|
|
|
+ or (workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !='')
|
|
|
|
|
+ or (workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !='')">
|
|
|
|
|
+ LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
|
|
+ LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 6. 部门:只有传了 office 条件才连表 -->
|
|
|
|
|
+ <if test="(office!=null and office.id=='' and office.name!=null and office.name!='' ) or (officeIdList!=null and officeIdList.size!=0)">
|
|
|
|
|
+ LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 7. 报告数据:只有传了 prd 报告条件才连表 -->
|
|
|
|
|
+ <if test="beginMoney !=null or endMoney !=null or reportBeginDate !=null or reportEndDate !=null
|
|
|
|
|
+ or bzshbUserId!=null and bzshbUserId!=''
|
|
|
|
|
+ or (reportData!=null and reportData.number !=null and reportData.number !='')
|
|
|
|
|
+ or projectReportStatus != null">
|
|
|
|
|
+ left join project_report_data prd on prd.project_id = a.id
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- ===================== 按需 LEFT JOIN 结束 ===================== -->
|
|
|
|
|
+
|
|
|
|
|
+ left join project_performance pp on pp.project_id = a.id and pp.del_flag = '0'
|
|
|
|
|
+ left join project_performance_database ppd on ppd.id = pp.project_performance_database_id and ppd.del_flag = '0'
|
|
|
|
|
+
|
|
|
|
|
+ <where>
|
|
|
|
|
+ a.status = 5
|
|
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
|
|
+ AND a.project_id like concat('%',#{projectId},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
|
|
+ AND (area.parent_ids LIKE concat('%',#{area.id},'%')
|
|
|
|
|
+ or a.area_id = #{area.id}
|
|
|
|
|
+ )
|
|
|
|
|
+ </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="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 != '') or (leaderId != null and leaderId != '')">
|
|
|
|
|
+ AND ((w1.user_id = #{leaderId}) or su.name like concat('%',#{leaderNameStr},'%')) AND w1.is_master = '1' AND w1.del_flag='0'
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="(projectMasterName != null and projectMasterName != '') or (projectMasterId != null and projectMasterId != '')">
|
|
|
|
|
+ AND ((a.project_master_id = #{projectMasterId}) or suMaster.name like concat('%',#{projectMasterName},'%')) AND suMaster.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="beginSubmitScale !=null and beginSubmitScale != ''">
|
|
|
|
|
+ AND a.submit_scale >= #{beginSubmitScale}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endSubmitScale !=null and endSubmitScale != ''">
|
|
|
|
|
+ AND a.submit_scale < #{endSubmitScale}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 咨询营业收入 -->
|
|
|
|
|
+ <if test="beginMoney !=null">
|
|
|
|
|
+ AND prd.ZiXunShouRu >= #{beginMoney}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endMoney !=null">
|
|
|
|
|
+ AND prd.ZiXunShouRu < #{endMoney}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 质量复核审核时间 -->
|
|
|
|
|
+ <if test="reportBeginDate !=null">
|
|
|
|
|
+ AND prd.audit_pass_date >= #{reportBeginDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="reportEndDate !=null">
|
|
|
|
|
+ AND prd.audit_pass_date <= #{reportEndDate}
|
|
|
|
|
+ </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="projectPerformanceId!=null and projectPerformanceId!=''">
|
|
|
|
|
+ and pp.project_performance_database_id=#{projectPerformanceId}
|
|
|
|
|
+ </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">
|
|
|
|
|
+ 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 (
|
|
|
|
|
+ <if test="reportData.number == '暂无报告'">
|
|
|
|
|
+ (prd.number = '' or prd.number is null)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="reportData.number != '暂无报告'">
|
|
|
|
|
+ prd.number like concat('%', #{reportData.number}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
|
|
+ </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="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="projectReportStatus != null">
|
|
|
|
|
+ AND
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="projectReportStatus != 0">
|
|
|
|
|
+ prd.status = #{projectReportStatus}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ prd.STATUS is null
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </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>
|
|
|
|
|
+
|
|
|
|
|
+ <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="reportBeginDate !=null or reportEndDate !=null">
|
|
|
|
|
+ AND prd.status in (5,7)
|
|
|
|
|
+ </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>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 批量新增关联关系 -->
|
|
|
|
|
+ <insert id="saveProjectPerformance">
|
|
|
|
|
+ INSERT INTO project_performance (
|
|
|
|
|
+ id,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ create_date,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ update_date,
|
|
|
|
|
+ remarks,
|
|
|
|
|
+ del_flag,
|
|
|
|
|
+ project_id,
|
|
|
|
|
+ project_performance_database_id
|
|
|
|
|
+ )
|
|
|
|
|
+ VALUES
|
|
|
|
|
+ <foreach collection="projectPerformanceList" item="item" separator=",">
|
|
|
|
|
+ (
|
|
|
|
|
+ #{item.id},
|
|
|
|
|
+ #{item.createBy.id},
|
|
|
|
|
+ #{item.createDate},
|
|
|
|
|
+ #{item.updateBy.id},
|
|
|
|
|
+ #{item.updateDate},
|
|
|
|
|
+ #{item.remarks},
|
|
|
|
|
+ #{item.delFlag},
|
|
|
|
|
+ #{item.projectId},
|
|
|
|
|
+ #{item.projectPerformanceDatabaseId}
|
|
|
|
|
+ )
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </insert>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 根据项目ID列表查询已存在的关联记录 -->
|
|
|
|
|
+ <select id="findByProjectIdList" resultType="ProjectPerformance">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id AS "id",
|
|
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
|
|
+ a.create_date AS "createDate",
|
|
|
|
|
+ a.update_by AS "updateBy.id",
|
|
|
|
|
+ a.update_date AS "updateDate",
|
|
|
|
|
+ a.remarks AS "remarks",
|
|
|
|
|
+ a.del_flag AS "delFlag",
|
|
|
|
|
+ a.project_id AS "projectId",
|
|
|
|
|
+ a.project_performance_database_id AS "projectPerformanceDatabaseId"
|
|
|
|
|
+ FROM project_performance a
|
|
|
|
|
+ WHERE a.del_flag = '0'
|
|
|
|
|
+ AND a.project_id IN
|
|
|
|
|
+ <foreach collection="projectIdList" item="projectId" open="(" close=")" separator=",">
|
|
|
|
|
+ #{projectId}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 批量逻辑删除关联记录 -->
|
|
|
|
|
+ <update id="deleteByLogicBatch">
|
|
|
|
|
+ UPDATE project_performance SET
|
|
|
|
|
+ del_flag = '1',
|
|
|
|
|
+ update_by = #{projectPerformanceList[0].updateBy.id},
|
|
|
|
|
+ update_date = #{projectPerformanceList[0].updateDate}
|
|
|
|
|
+ WHERE del_flag = '0'
|
|
|
|
|
+ AND project_id IN
|
|
|
|
|
+ <foreach collection="projectPerformanceList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item.projectId}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+</mapper>
|