|
@@ -739,6 +739,9 @@
|
|
<select id="findPageList" resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords" >
|
|
<select id="findPageList" resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords" >
|
|
SELECT
|
|
SELECT
|
|
<include refid="projectRecordsColumns"/>
|
|
<include refid="projectRecordsColumns"/>
|
|
|
|
+ ,ifnull(prr.status,0) as projectReportRecordStatus
|
|
|
|
+ ,ifnull(a.reported_state,0) as reportedState
|
|
|
|
+ ,prr.process_instance_id as prrProcessInstanceId
|
|
,a.project_type as "projectType"
|
|
,a.project_type as "projectType"
|
|
FROM rural_project_records a
|
|
FROM rural_project_records a
|
|
left join work_contract_info wci on a.contract_id = wci.id
|
|
left join work_contract_info wci on a.contract_id = wci.id
|
|
@@ -752,14 +755,16 @@
|
|
left join sys_office so on so.id = su.office_id
|
|
left join sys_office so on so.id = su.office_id
|
|
<where>
|
|
<where>
|
|
a.del_flag = 0
|
|
a.del_flag = 0
|
|
- and (
|
|
|
|
|
|
+ <!--and (
|
|
(((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
(((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
- )
|
|
|
|
|
|
+ )-->
|
|
|
|
+ and ((prr.status != 5 or prr.status is null) or (a.reported_state is null or a.reported_state = '6'))
|
|
|
|
+ and a.status = 5
|
|
and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
<if test="projectId != null and projectId != ''">
|
|
<if test="projectId != null and projectId != ''">
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
@@ -833,14 +838,187 @@
|
|
left join sys_office so on so.id = su.office_id
|
|
left join sys_office so on so.id = su.office_id
|
|
<where>
|
|
<where>
|
|
a.del_flag = 0
|
|
a.del_flag = 0
|
|
- and (
|
|
|
|
|
|
+ <!--and (
|
|
(((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
(((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
- )
|
|
|
|
|
|
+ )-->
|
|
|
|
+ and ((prr.status != 5 or prr.status is null) or (a.reported_state is null or a.reported_state = '6'))
|
|
|
|
+ and a.status = 5
|
|
|
|
+ and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
|
|
+ <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="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>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="findPageFinishList" resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords" >
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="projectRecordsColumns"/>
|
|
|
|
+ ,ifnull(prr.status,0) as projectReportRecordStatus
|
|
|
|
+ ,ifnull(a.reported_state,0) as reportedState
|
|
|
|
+ ,prr.process_instance_id as prrProcessInstanceId
|
|
|
|
+ ,a.project_type as "projectType"
|
|
|
|
+ FROM rural_project_records a
|
|
|
|
+ left join work_contract_info wci on a.contract_id = wci.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 sys_user u on u.id = a.create_by
|
|
|
|
+ left join sys_office o on o.id = a.office_id
|
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
|
+ left join sys_user su on su.id = w1.user_id
|
|
|
|
+ left join sys_office so on so.id = su.office_id
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = 0
|
|
|
|
+ <!--and (
|
|
|
|
+ (((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
|
|
+ or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
|
|
+ or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
|
|
+ )-->
|
|
|
|
+ and (prr.status = 5 and (a.reported_state = '5' or a.reported_state = '7'))
|
|
|
|
+ and a.status = 5
|
|
|
|
+ and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
|
|
+ <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="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>
|
|
|
|
+ </where>
|
|
|
|
+ ORDER BY a.create_date DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findPageFinishCount" resultType="java.lang.Integer">
|
|
|
|
+ SELECT count(DISTINCT a.id)
|
|
|
|
+ FROM rural_project_records a
|
|
|
|
+ left join work_contract_info wci on a.contract_id = wci.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 sys_user u on u.id = a.create_by
|
|
|
|
+ left join sys_office o on o.id = a.office_id
|
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
|
+ left join sys_user su on su.id = w1.user_id
|
|
|
|
+ left join sys_office so on so.id = su.office_id
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = 0
|
|
|
|
+ <!--and (
|
|
|
|
+ (((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or ((prr.status != 5 or prr.status is null) and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
|
|
+ or ((prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or (prr.status = 5 and (a.reported_state!=5 or a.reported_state is null) and prd.update_date is null))
|
|
|
|
+ or (((prr.status != 5 or prr.status is null) and a.reported_state=5 and date_add(prd.update_date,interval 40 day)>= now())
|
|
|
|
+ or ((prr.status != 5 or prr.status is null) and a.reported_state=5 and prd.update_date is null))
|
|
|
|
+ )-->
|
|
|
|
+ and (prr.status = 5 and (a.reported_state = '5' or a.reported_state = '7'))
|
|
|
|
+ and a.status = 5
|
|
and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
and (a.create_by = #{createBy.id} or w1.user_id = #{createBy.id})
|
|
<if test="projectId != null and projectId != ''">
|
|
<if test="projectId != null and projectId != ''">
|
|
AND a.project_id like concat('%',#{projectId},'%')
|
|
AND a.project_id like concat('%',#{projectId},'%')
|