Guo1B0 1 gadu atpakaļ
vecāks
revīzija
e9469f9d83

+ 23 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java

@@ -59,22 +59,27 @@ public class ClueController {
         //TODO token待定
         User user = userMapper.selectById(request.getHeader("Token"));
         clue.setCompanyId(user.getCompanyId());
+        clue.setIsDelete(0);
         boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部线索");
         boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门线索");
         List<Clue> list = new ArrayList<>();
+        int i = 0;
         if (!isAll) {
             //查看全部线索
             list = clueService.getList(clue);
+            i = clueService.getTotal(clue);
         } else if (!isNotAll) {
             //查看负责部门线索 找出所处部门下所有的负责人
             list = clueService.getList1(clue, user);
+            i = clueService.getTotal1(clue,user);
         } else {
             // 查看负责人为 自己 和 null的数据
             list = clueService.getList2(clue, user);
+            i = clueService.getTotal2(clue,user);
         }
         HashMap<Object, Object> map = new HashMap<>();
         map.put("data", list);
-        map.put("total", clueService.getTotal(clue));
+        map.put("total", i);
         return map;
     }
 
@@ -83,13 +88,27 @@ public class ClueController {
         //TODO token待定
         User user = userMapper.selectById(request.getHeader("Token"));
         clue.setCompanyId(user.getCompanyId());
-        List<Clue> list = new ArrayList<>();
-        clueService.getDeleterList(clue);
         boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部线索");
         boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门线索");
+        List<Clue> list = new ArrayList<>();
+        clue.setIsDelete(1);
+        int i = 0;
+        if (!isAll) {
+            //查看全部线索
+            list = clueService.getList(clue);
+            i = clueService.getTotal(clue);
+        } else if (!isNotAll) {
+            //查看负责部门线索 找出所处部门下所有的负责人
+            list = clueService.getList1(clue, user);
+            i = clueService.getTotal1(clue,user);
+        } else {
+            // 查看负责人为 自己 和 null的数据
+            list = clueService.getList2(clue, user);
+            i = clueService.getTotal2(clue,user);
+        }
         HashMap<Object, Object> map = new HashMap<>();
         map.put("data", list);
-        map.put("total", clueService.getDeleterTotal(clue));
+        map.put("total",i);
         return map;
     }
 

+ 4 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ClueMapper.java

@@ -23,5 +23,8 @@ public interface ClueMapper extends BaseMapper<Clue> {
     Integer getTotal(Clue clue);
     Integer getDeleterTotal(Clue clue);
 
-    List<Clue> list2(Clue clue, String id);
+    List<Clue> list2(@Param("clue") Clue clue ,@Param("userId") String userId);
+
+    int getTotal1(@Param("clue") Clue clue ,@Param("userId") String userId);
+    int getTotal2(@Param("clue") Clue clue ,@Param("userId") String userId);
 }

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ClueService.java

@@ -37,4 +37,7 @@ public interface ClueService extends IService<Clue> {
     void deleterDelete(List<Integer> ids);
 
     void getAndTransfer(Clue clue,User user);
+
+    int getTotal1(Clue clue, User user);
+    int getTotal2(Clue clue, User user);
 }

+ 11 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java

@@ -177,5 +177,16 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
 
     }
 
+    @Override
+    public int getTotal1(Clue clue, User user) {
+        return clueMapper.getTotal1(clue,user.getId());
+    }
+
+    @Override
+    public int getTotal2(Clue clue, User user) {
+        return clueMapper.getTotal2(clue,user.getId());
+
+    }
+
 
 }

+ 64 - 22
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -53,7 +53,7 @@
                c.create_id
         from Clue c
         where
-            c.company_id = #{companyId} and is_delete = 0
+            c.company_id = #{companyId} and is_delete = #{isDelete}
         <if test="startTime != null and endTime != null ">
         and  c.create_time BETWEEN  #{startTime} and #{endTime}
         </if>
@@ -91,23 +91,23 @@
         c.create_id
         from Clue c
         where
-        c.company_id = #{companyId} and is_delete = 0
+        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and c.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
         and c.incharger_id is null
-        <if test="startTime != null and endTime != null ">
-            and  c.create_time BETWEEN  #{startTime} and #{endTime}
+        <if test="clue.startTime != null and clue.endTime != null ">
+            and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
-        <if test="clueName != null and clueName != '' ">
-            and  c.clue_name =  #{clueName}
+        <if test="clue.clueName != null and clue.clueName != '' ">
+            and  c.clue_name =  #{clue.clueName}
         </if>
-        <if test="clueSourceId != null">
-            and  c.clue_source_id =  #{clueSourceId}
+        <if test="clue.clueSourceId != null">
+            and  c.clue_source_id =  #{clue.clueSourceId}
         </if>
-        <if test="customerIndustryId != null">
-            and  c.customer_industry_id =  #{customerIndustryId}
+        <if test="clue.customerIndustryId != null">
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        limit #{pageIndex},#{pageFrom}
+        limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="list2" resultType="com.management.platform.entity.Clue">
         select c.id,
@@ -132,21 +132,21 @@
         c.create_id
         from Clue c
         where
-        c.company_id = #{companyId} and is_delete = 0
+        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and c.incharger_id = #{userId} and c.incharger_id is null
-        <if test="startTime != null and endTime != null ">
-            and  c.create_time BETWEEN  #{startTime} and #{endTime}
+        <if test="clue.startTime != null and clue.endTime != null ">
+            and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
-        <if test="clueName != null and clueName != '' ">
-            and  c.clue_name =  #{clueName}
+        <if test="clue.clueName != null and clue.clueName != '' ">
+            and  c.clue_name =  #{clue.clueName}
         </if>
-        <if test="clueSourceId != null">
-            and  c.clue_source_id =  #{clueSourceId}
+        <if test="clue.clueSourceId != null">
+            and  c.clue_source_id =  #{clue.clueSourceId}
         </if>
-        <if test="customerIndustryId != null">
-            and  c.customer_industry_id =  #{customerIndustryId}
+        <if test="clue.customerIndustryId != null">
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        limit #{pageIndex},#{pageFrom}
+        limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="Deleterlist" resultType="com.management.platform.entity.Clue">
         select c.id,
@@ -190,7 +190,7 @@
         select count(*)
         from Clue c
         where
-        c.company_id = #{companyId} and is_delete = 0
+        c.company_id = #{companyId} and is_delete = #{isDelete}
         <if test="startTime != null and endTime != null ">
             and  c.create_time BETWEEN  #{startTime} and #{endTime}
         </if>
@@ -222,5 +222,47 @@
             and  c.customer_industry_id =  #{customerIndustryId}
         </if>
     </select>
+    <select id="getTotal1" resultType="java.lang.Integer">
+        select c.id,
+        COUNT(c.company_id)
+        from Clue c
+        where
+        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        and c.incharger_id in
+        (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
+        and c.incharger_id is null
+        <if test="clue.startTime != null and clue.endTime != null ">
+            and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
+        </if>
+        <if test="clue.clueName != null and clue.clueName != '' ">
+            and  c.clue_name =  #{clue.clueName}
+        </if>
+        <if test="clue.clueSourceId != null">
+            and  c.clue_source_id =  #{clue.clueSourceId}
+        </if>
+        <if test="clue.customerIndustryId != null">
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
+        </if>
+    </select>
+    <select id="getTotal2" resultType="java.lang.Integer">
+        select
+        COUNT(c.id)
+        from Clue c
+        where
+        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        and c.incharger_id = #{userId} and c.incharger_id is null
+        <if test="clue.startTime != null and clue.endTime != null ">
+            and c.create_time BETWEEN #{clue.startTime} and #{clue.endTime}
+        </if>
+        <if test="clue.clueName != null and clue.clueName != '' ">
+            and c.clue_name = #{clue.clueName}
+        </if>
+        <if test="clue.clueSourceId != null">
+            and c.clue_source_id = #{clue.clueSourceId}
+        </if>
+        <if test="clue.customerIndustryId != null">
+            and c.customer_industry_id = #{clue.customerIndustryId}
+        </if>
+    </select>
 
 </mapper>