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

+ 24 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -50,8 +50,32 @@ public class BusinessOpportunityController {
     @RequestMapping("list")
     public HashMap<Object, Object> list(@RequestBody BusinessOpportunity bo, HttpServletRequest request) {
         HashMap<Object, Object> r = new HashMap<>();
+        User user = userMapper.selectById(request.getHeader("Token"));
+        bo.setIsDelete(0);
+        bo.setCompanyId(user.getCompanyId());
+        List<BusinessOpportunity> list = new ArrayList<>();
+        boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部商机");
+        boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门商机");
+        int i = 0;
+        if (!isAll) {
+            list = bOservice.getAll(bo);
+            i = bOservice.getTotal(bo);
+        } else if (!isNotAll) {
+            list = bOservice.getAll1(bo, user);
+            i = bOservice.getTotal1(bo, user);
+        } else {
+            list = bOservice.getAll2(bo, user);
+        }
+        r.put("data", list);
+        r.put("total",i);
+        return r;
 
+    }
+    @RequestMapping("deleterList")
+    public HashMap<Object, Object> deleterList(@RequestBody BusinessOpportunity bo, HttpServletRequest request) {
+        HashMap<Object, Object> r = new HashMap<>();
         User user = userMapper.selectById(request.getHeader("Token"));
+        bo.setIsDelete(1);
         bo.setCompanyId(user.getCompanyId());
         List<BusinessOpportunity> list = new ArrayList<>();
         boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部商机");

+ 17 - 11
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/BusinessOpportunityMapper.xml

@@ -37,8 +37,9 @@
                  left join business_item_product ip ON ip.business_id = b.id
                  left join product p on p.id = ip.product_id
         WHERE b.company_id = #{companyId}
+          and is_delete = #{isDelete}
         <if test="name != null and name != ''" >
-         and b.name = #{bo.name}
+         and b.name = #{name}
         </if>
         <if test="stage != null " >
             and b.stage = #{stage}
@@ -64,6 +65,7 @@
         left join business_item_product ip ON ip.business_id = b.id
         left join product p on p.id = ip.product_id
         WHERE b.company_id = #{bo.companyId}
+          and b.is_delete = #{bo.isDelete}
         and b.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
         and b.incharger_id is null
@@ -93,8 +95,9 @@
         FROM business_opportunity b
         left join business_item_product ip ON ip.business_id = b.id
         left join product p on p.id = ip.product_id
-        WHERE b.company_id = #{companyId}
+        WHERE b.company_id = #{bo.companyId}
         and b.incharger_id = #{userId}
+        and b.is_delete = #{bo.isDelete}
         and b.incharger_id is null
         <if test="bo.name != null and bo.name != ''">
             and b.name = #{bo.name}
@@ -117,18 +120,19 @@
         FROM business_opportunity b
         left join business_item_product ip ON ip.business_id = b.id
         left join product p on p.id = ip.product_id
-        WHERE b.company_id = #{bo.companyId}
-        <if test="bo.name != null and bo.name != ''" >
-            and b.name = #{bo.name}
+        WHERE b.company_id = #{companyId}
+          and b.is_delete = #{isDelete}
+        <if test="name != null and name != ''" >
+            and b.name = #{name}
         </if>
-        <if test="bo.stage != null " >
-            and b.stage = #{bo.stage}
+        <if test="stage != null " >
+            and b.stage = #{stage}
         </if>
-        <if test="bo.startTime != null and bo.endTime != null " >
-            and b.expected_transaction_date BETWEEN #{bo.startTime} and #{bo.endTime}
+        <if test="startTime != null and endTime != null " >
+            and b.expected_transaction_date BETWEEN #{startTime} and #{endTime}
         </if>
-        <if test="bo.productId != null ">
-            and p.id = #{bo.productId}
+        <if test="productId != null ">
+            and p.id = #{productId}
         </if>
         GROUP BY b.id
     </select>
@@ -139,6 +143,7 @@
         left join business_item_product ip ON ip.business_id = b.id
         left join product p on p.id = ip.product_id
         WHERE b.company_id = #{bo.companyId}
+          and b.is_delete = #{bo.isDelete}
         and b.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
         and b.incharger_id is null
@@ -163,6 +168,7 @@
         left join business_item_product ip ON ip.business_id = b.id
         left join product p on p.id = ip.product_id
         WHERE b.company_id = #{bo.companyId}
+        and b.is_delete = #{bo.isDelete}
         and b.incharger_id = #{userId}
         and b.incharger_id is null
         <if test="bo.name != null and bo.name != ''">