From bd9cf1a87d50cc7cb29118cc85f397a7ab7228e9 Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: 星期一, 16 十二月 2024 16:51:01 +0800
Subject: [PATCH] 增加监管机构数据限制

---
 assess-system/src/main/resources/mapper/AssProjectMapper.xml |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/assess-system/src/main/resources/mapper/AssProjectMapper.xml b/assess-system/src/main/resources/mapper/AssProjectMapper.xml
index 5aa9f2a..4dc1a92 100644
--- a/assess-system/src/main/resources/mapper/AssProjectMapper.xml
+++ b/assess-system/src/main/resources/mapper/AssProjectMapper.xml
@@ -35,6 +35,7 @@
         <result property="businessName"     column="business_name"      />
         <result property="leaderId"     column="leader_id"      />
         <result property="estimateTypeName"     column="estimate_type_name"      />
+        <result property="agencyName"     column="agency_name"      />
         <association property="leader" javaType="com.gkhy.assess.system.domain.SysUser" resultMap="userResult" />
         <association property="contract" javaType="com.gkhy.assess.system.domain.AssContract" resultMap="contractResult" />
     </resultMap>
@@ -55,7 +56,7 @@
                p.actual_location,p.location,p.estimate_type,p.filing_date,
                p.credit_code,p.report_progress,p.phase,p.state,p.introduction,p.is_review,p.del_flag,p.create_by,p.create_time,
                p.update_by,p.update_time,p.remark,d1.label as business_name,d2.label as estimate_type_name,e.leader_id,u.name as leader_name,
-               c.id as contract_id,c.contract_money,c.actual_contract_money,
+               c.id as contract_id,c.contract_money,c.actual_contract_money,a.name as agency_name,
                (select count(*) from ass_project_material m where m.project_id=p.id and m.file_id is not null) as material_cnt
         from ass_project p
         left join ass_estimate_task e on e.project_id=p.id
@@ -63,13 +64,14 @@
         left join sys_dict_data  d1 on d1.id=p.business
         left join sys_dict_data  d2 on d2.id=p.estimate_type
         left join ass_contract c on c.project_id=p.id
+        left join sys_agency a on a.id=p.agency_id
     </sql>
 
 
     <select id="projectList"  resultMap="projectResult">
         <include refid="selectProjectVo"/>
         <if test="params.personId != null and params.personId != ''">
-            left join ass_plan_person a on a.project_id=p.id
+            left join ass_plan_person pp on pp.project_id=p.id
         </if>
         <if test="params.lostMaterial != null">
             left join ass_project_material m on m.project_id=p.id
@@ -110,7 +112,7 @@
                 and date_format(p.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
             </if>
             <if test="params.personId != null and params.personId != ''">
-                and a.person_id=#{params.personId} and a.del_flag=0
+                and pp.person_id=#{params.personId} and pp.del_flag=0
             </if>
             <if test="params.lostMaterial != null and params.lostMaterial==1">
                 and (m.file_id is null)
@@ -129,7 +131,7 @@
 
     <select id="getProjectByName" resultType="com.gkhy.assess.system.domain.AssProject">
         select id,name from ass_project
-        where name=#{name}
+        where name=#{name} and agency_id=#{agencyId} and del_flag=0 limit 1
     </select>
 
     <select id="getReportProgress" resultType="java.lang.Integer">
@@ -138,7 +140,7 @@
     </select>
 
     <select id="getMemberProjectByUserId" resultMap="projectResult">
-        select p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,a.id as plan_person_id,
+        select distinct p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,a.id as plan_person_id,
         e.leader_id,u.name as leader_name
         from ass_project p
         left join ass_plan_person a on a.project_id=p.id
@@ -160,7 +162,7 @@
     </select>
 
     <select id="getLeaderProjectByUserId" resultMap="projectResult">
-        select p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,a.id as plan_person_id,
+        select distinct p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,a.id as plan_person_id,
         e.leader_id,u.name as leader_name
         from ass_project p
         left join ass_plan_person a on a.project_id=p.id
@@ -223,13 +225,15 @@
     </select>
 
     <select id="getProjectByPersonIds" resultType="com.gkhy.assess.system.domain.vo.PersonProjectVO">
-        select a.person_id,count(*) as project_count,max(p.create_time) as last_estimate_time from ass_project p
+        select d.person_id,count(*) as project_count,max(d.create_time) as last_estimate_time from
+        (select a.person_id,a.project_id,max(p.create_time) as create_time from ass_project p
         left join ass_plan_person a on a.project_id=p.id
         where  a.del_flag=0 and p.del_flag=0 and a.person_id in
         <foreach collection="personIds" item="personId" open="(" separator="," close=")">
             #{personId}
         </foreach>
-        group by a.person_id
+        group by a.person_id,a.project_id) d
+        group by d.person_id
     </select>
 
 </mapper>

--
Gitblit v1.9.2