From 9fd1f39733e671cfaf0a9e10c2df8c9bf0f3cd36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=85=B4?= Date: Sun, 15 Aug 2021 15:54:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=8E=B7=E5=8F=96=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8E=A5=E5=8F=A3=E7=9A=84=E8=BF=94=E5=9B=9E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seven/controller/CustomerController.java | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/HMS/src/main/java/com/hqyj/seven/controller/CustomerController.java b/HMS/src/main/java/com/hqyj/seven/controller/CustomerController.java index 3c8d9c9..ba475ee 100644 --- a/HMS/src/main/java/com/hqyj/seven/controller/CustomerController.java +++ b/HMS/src/main/java/com/hqyj/seven/controller/CustomerController.java @@ -9,6 +9,7 @@ import org.apache.shiro.session.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; @@ -22,8 +23,20 @@ public class CustomerController { CustomerService customerService; @RequestMapping("/getallcus") @ResponseBody - public Map getAllcus(){ - List customerList = customerService.queryAll(); + public Map getAllCus(@RequestParam("page") Integer pageNumber, @RequestParam("limit")Integer pageSize){ + int number; + int size; + if (pageNumber == null){ + number = 1; + }else { + number = pageNumber; + } + if (pageSize == null){ + size = 10; + }else { + size = pageSize; + } + PageData customerList = customerService.queryAll(number,size); Map customer = new HashMap<>(); if (customerList == null){ customer.put("code",-1); @@ -44,15 +57,15 @@ public class CustomerController { public Map getonecus(String name){ Map customer = new HashMap<>(); if (name==null){ - customer.put("code",-1); + customer.put("code",-9); customer.put("message","查询名不为空"); } else { List customerList = customerService.queryByCusName(name); if (customerList.size() == 0) { - customer.put("code", 0); - customer.put("message", "没有查询到姓名为:" + name + "的客户信息"); + customer.put("code", -1); + customer.put("msg", "没有查询到姓名为:" + name + "的客户信息"); } else { - customer.put("code", 1); + customer.put("code", 0); customer.put("message", "查询成功"); customer.put("data", customerList); } @@ -66,10 +79,10 @@ public class CustomerController { Map customermap = new HashMap<>(); if (customernum == 0){ customermap.put("code",-1); - customermap.put("message","修改失败"); + customermap.put("message","修改失败!"); }else { customermap.put("code",200); - customermap.put("message","修改成功"); + customermap.put("message","修改成功!"); } return customermap; } @@ -80,26 +93,26 @@ public class CustomerController { Map customermap = new HashMap<>(); if (customernum == 0){ customermap.put("code",-1); - customermap.put("message","插入失败"); + customermap.put("message","添加失败!"); }else { customermap.put("code",200); - customermap.put("message","插入成功"); + customermap.put("message","添加成功!"); } return customermap; } //客户信息的删除 - @RequestMapping("/deleteHouse") + @RequestMapping("/deleteCustomer") @ResponseBody - public Map deleteHousei(int customer_id){ - Map customermap = new HashMap<>(); + public Map deleteCustomer(int customer_id){ + Map customerMap = new HashMap<>(); int num = customerService.deleteOneCus(customer_id); if (num==0){ - customermap.put("code",0); - customermap.put("message","删除失败!"); + customerMap.put("code",-1); + customerMap.put("message","删除失败!"); }else { - customermap.put("code",200); - customermap.put("message","删除成功!"); + customerMap.put("code",200); + customerMap.put("message","删除成功!"); } - return customermap; + return customerMap; } } -- GitLab