From 76e9e8e05cbe7dafeba51a235386f20ebf986e25 Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期一, 27 十二月 2021 11:54:35 +0800
Subject: [PATCH] 违章记录

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
index df25787..6291084 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
@@ -5,6 +5,8 @@
 import cn.exrick.xboot.core.common.vo.PageVo;
 import cn.exrick.xboot.core.common.vo.Result;
 import cn.exrick.xboot.your.entity.Customer;
+import cn.exrick.xboot.your.entity.CustomerReceive;
+import cn.exrick.xboot.your.service.ICustomerReceiveService;
 import cn.exrick.xboot.your.service.ICustomerService;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -30,12 +32,18 @@
 
     @Autowired
     private ICustomerService iCustomerService;
+    @Autowired
+    private ICustomerReceiveService iCustomerReceiveService;
 
     @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
     @ApiOperation(value = "閫氳繃id鑾峰彇")
     public Result<Customer> get(@PathVariable String id) {
-
         Customer customer = iCustomerService.getById(id);
+        QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
+        wrapper.eq("customer_id",id);
+        wrapper.eq("status",1);
+        List<CustomerReceive> list = iCustomerReceiveService.list(wrapper);
+        customer.setReceives(list);
         return new ResultUtil<Customer>().setData(customer);
     }
 
@@ -50,10 +58,12 @@
     @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
     @ApiOperation(value = "" +
             "")
-    public Result<IPage<Customer>> getByPage(String areaSectionId,PageVo page) {
+    public Result<IPage<Customer>> getByPage(String areaSectionId,String name,PageVo page) {
         QueryWrapper<Customer> wrapper = new QueryWrapper<>();
         if (!StrUtil.isEmpty(areaSectionId))
             wrapper.eq("area_section_id",areaSectionId);
+        if (!StrUtil.isEmpty(name))
+            wrapper.like("name","%"+name+"%");
         IPage<Customer> data = iCustomerService.page(PageUtil.initMpPage(page),wrapper);
         return new ResultUtil<IPage<Customer>>().setData(data);
     }
@@ -68,6 +78,37 @@
         return new ResultUtil<Customer>().setErrorMsg("鎿嶄綔澶辫触");
     }
 
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ApiOperation(value = "鏇存柊鏁版嵁")
+    public Result<Customer> update(String customerId,String lng,String lat,String address,String headImg) {
+        Customer customer = iCustomerService.getById(customerId);
+        if(StrUtil.isNotEmpty(lng)){
+            customer.setLng(lng);
+        }else{
+            return ResultUtil.error("璇峰皢淇℃伅濉啓瀹屾暣");
+        }
+        if(StrUtil.isNotEmpty(lat)){
+            customer.setLat(lat);
+        }else{
+            return ResultUtil.error("璇峰皢淇℃伅濉啓瀹屾暣");
+        }
+        if(StrUtil.isNotEmpty(address)){
+            customer.setRegisteredAddress(address);
+        }else{
+            return ResultUtil.error("璇峰皢淇℃伅濉啓瀹屾暣");
+        }
+        if(StrUtil.isNotEmpty(headImg)){
+            customer.setHeadImg(headImg);
+        }else{
+            return ResultUtil.error("璇峰皢淇℃伅濉啓瀹屾暣");
+        }
+        customer.setKstatus(2);
+        if (iCustomerService.saveOrUpdate(customer)) {
+            return new ResultUtil<Customer>().setData(customer);
+        }
+        return new ResultUtil<Customer>().setErrorMsg("鎿嶄綔澶辫触");
+    }
+
     @RequestMapping(value = "/delByIds", method = RequestMethod.POST)
     @ApiOperation(value = "鎵归噺閫氳繃id鍒犻櫎")
     public Result<Object> delAllByIds(@RequestParam String[] ids) {

--
Gitblit v1.9.1