Ver Fonte

功能提交,把客户删除功能跟置无效独立出来

杨六六 há 4 anos atrás
pai
commit
de238313f9

+ 18 - 5
modules/admin/src/main/java/com/fire/admin/rest/CustomerController.java

@@ -49,21 +49,34 @@ public class CustomerController {
     }*/
 
 
-    @ApiOperation("客户修改(包含逻辑删除)")
+    @ApiOperation("客户修改")
     @PutMapping("/update")
     public BaseResponse updCustomer(@RequestBody CustomerDto customerDto) {
         customerService.updateCustomerInfo(customerDto);
         return new BaseResponse();
     }
 
+    @ApiOperation("客户逻辑删除")
+    @PutMapping("/del/{customerId}")
+    public BaseResponse makeDelCustomer(@PathVariable Long customerId) {
+        customerService.deleteCustomer(customerId);
+        return new BaseResponse();
+    }
 
-    @ApiOperation("获取所有的客户信息{用于各种对客户条件的查询}")
-    @GetMapping("/{customerName}")
-    public  BaseRestResponse getCustomerInfo(  @RequestParam(value = "customerName",required = false)  String customerName){
-    return  new BaseRestResponse<>(customerService.queryCustomerInfo(customerName));
+
+    @ApiOperation("客户置无效")
+    @PutMapping("/valid/{customerId}/{status}")
+    public BaseResponse makeValCustomer(@PathVariable Long customerId, @PathVariable Integer status) {
+        customerService.validCustomer(customerId, status);
+        return new BaseResponse();
     }
 
 
+    @ApiOperation("获取所有的客户信息{用于各种对客户条件的查询}")
+    @GetMapping("/{customerName}")
+    public BaseRestResponse getCustomerInfo(@RequestParam(value = "customerName", required = false) String customerName) {
+        return new BaseRestResponse<>(customerService.queryCustomerInfo(customerName));
+    }
 
 
 }

+ 20 - 0
modules/admin/src/main/java/com/fire/admin/service/CustomerService.java

@@ -75,5 +75,25 @@ public interface CustomerService extends IService<CustomerInfo> {
     * @Date: 2021/6/8 16:21
     */
     CustomerInfo getcustomerOne(Long customerId);
+    
+    
+    /**
+    * @Description:  TODO 逻辑删除客户信息
+    * @Param: [customerId]
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/6/10 18:06
+    */
+    void deleteCustomer(Long customerId);
 
+
+    /**
+    * @Description:  TODO 客户置无效
+    * @Param: [customerId]
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/6/10 18:08
+    */
+    void validCustomer(Long customerId,Integer status);
+    
 }

+ 35 - 0
modules/admin/src/main/java/com/fire/admin/service/impl/CustomerServiceImpl.java

@@ -222,4 +222,39 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
     }
 
 
+    /**
+     * @Description: TODO  逻辑删除客户信息
+     * @Param: [customerId] 客户编号
+     * @return: void
+     * @Author: liuliu
+     * @Date: 2021/6/10 18:04
+     */
+    @Override
+    public void deleteCustomer(Long customerId) {
+        CustomerInfo info = CustomerInfo.builder().customerId(customerId)
+                .isDeleted(1).build();
+        int count = baseMapper.updateById(info);
+        if (count > 0) {
+            log.info("客户编号为:【{}】 执行了删除操作", customerId);
+        }
+    }
+
+    /**
+     * @Description: TODO 客户置无效
+     * @Param: [customerId]
+     * @return: void
+     * @Author: liuliu
+     * @Date: 2021/6/10 18:07
+     */
+    @Override
+    public void validCustomer(Long customerId, Integer status) {
+        CustomerInfo info = CustomerInfo.builder().customerId(customerId)
+                .status(status).build();
+        int count = baseMapper.updateById(info);
+        if (count > 0) {
+            log.info("客户编号为:【{}】 修改了有效性", customerId);
+        }
+    }
+
+
 }