Guo1B0 1 vuosi sitten
vanhempi
commit
3cda0a8ff0

+ 12 - 8
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -40,11 +41,20 @@ public class BusinessOpportunityController {
 
 
     @RequestMapping("insertAndUpdate")
-    public HttpRespMsg insertAndUpdate(@RequestBody BusinessOpportunity bo) {
+    public HttpRespMsg insertAndUpdate(@RequestBody BusinessOpportunity bo, HttpServletRequest request) {
+        User user = userMapper.selectById(request.getHeader("Token"));
         HttpRespMsg msg = new HttpRespMsg();
+        if (bo.getId() == null){
+            //新增
+            bo.setCompanyId(user.getCompanyId());
+            bo.setCreatorId(user.getId());
+            bOservice.insert(bo);
+        }else {
+            //修改
+
+        }
         msg.setMsg("操作成功");
         return msg;
-
     }
 
     @RequestMapping("list")
@@ -96,13 +106,7 @@ public class BusinessOpportunityController {
 
     }
 
-    @RequestMapping("getAllProduct")
-    public HttpRespMsg getAllProduct(@RequestBody BusinessOpportunity bo) {
-        HttpRespMsg msg = new HttpRespMsg();
-        msg.setMsg("操作成功");
-        return msg;
 
-    }
 
 
 }

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

@@ -24,4 +24,7 @@ public interface BusinessOpportunityService extends IService<BusinessOpportunity
     int getTotal(BusinessOpportunity bo);
 
     int getTotal1(BusinessOpportunity bo, User user);
+    int getTotal2(BusinessOpportunity bo, User user);
+
+    void insert(BusinessOpportunity bo);
 }

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

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -47,4 +48,15 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     public int getTotal1(BusinessOpportunity bo, User user) {
         return bOMapper.getTotal1(bo,user.getId());
     }
+
+    @Override
+    public int getTotal2(BusinessOpportunity bo, User user) {
+        return bOMapper.getTotal2(bo,user.getId());
+    }
+
+    @Override
+    public void insert(BusinessOpportunity bo) {
+        bo.setCreateTime(new Date());
+        bOMapper.insert(bo);
+    }
 }

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

@@ -172,7 +172,7 @@
         and b.incharger_id = #{userId}
         and b.incharger_id is null
         <if test="bo.name != null and bo.name != ''">
-            and b.name = #{name}
+            and b.name = #{bo.name}
         </if>
         <if test="bo.stage != null ">
             and b.stage = #{bo.stage}