From ea54832a288b9a55febd22072cfeaf6df3a99d64 Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Jun 2020 14:52:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AE=8C=E6=88=90=20CustomerService=20?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cloudservice/ccs/biz/ICustomerServiceBiz.java | 3 +++ .../cloudservice/ccs/biz/impl/CustomerServiceImpl.java | 6 ++++++ .../ccs/controller/CustomerServiceController.java | 5 +++++ .../com/cloudservice/ccs/entity/CustomerService.java | 3 +++ .../cloudservice/ccs/mapper/CustomerServiceMapper.java | 3 +++ src/main/resources/application.yml | 3 +++ src/main/resources/mapper/CustomerServiceMapper.xml | 10 ++++++++++ 7 files changed, 33 insertions(+) diff --git a/src/main/java/com/cloudservice/ccs/biz/ICustomerServiceBiz.java b/src/main/java/com/cloudservice/ccs/biz/ICustomerServiceBiz.java index 9a93462..3028d3e 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ICustomerServiceBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ICustomerServiceBiz.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.CustomerService; import java.util.List; +import java.util.Map; public interface ICustomerServiceBiz { @@ -10,6 +11,8 @@ public interface ICustomerServiceBiz { void update(Integer id, CustomerService customerService); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); CustomerService getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java index 5064744..659f11e 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.PathVariable; import java.util.List; +import java.util.Map; @Service public class CustomerServiceImpl implements ICustomerServiceBiz { @@ -33,6 +34,11 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = customerServiceMapper.partialUpdate(id, fields); + } + @Override public void delete(Integer id) { int result = customerServiceMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java b/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java index 479a572..6299c11 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java @@ -30,6 +30,11 @@ public class CustomerServiceController { customerServiceBiz.update(id, customerService); } + @PutMapping("/{id}/partial") + void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + customerServiceBiz.partialUpdate(id, fields); + } + @DeleteMapping("/{id}") void delete(@PathVariable Integer id) { customerServiceBiz.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/entity/CustomerService.java b/src/main/java/com/cloudservice/ccs/entity/CustomerService.java index e8ceaca..8d15fbb 100644 --- a/src/main/java/com/cloudservice/ccs/entity/CustomerService.java +++ b/src/main/java/com/cloudservice/ccs/entity/CustomerService.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.entity; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -16,7 +17,9 @@ public class CustomerService { private String customerServicePhone; private Integer customerServiceId; private Integer totalOnlineTime; + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date onlineTimeBegin; + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date onlineTimeEnd; private Integer sessionCount; private Integer msgCount; diff --git a/src/main/java/com/cloudservice/ccs/mapper/CustomerServiceMapper.java b/src/main/java/com/cloudservice/ccs/mapper/CustomerServiceMapper.java index 45c9779..f710af5 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/CustomerServiceMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/CustomerServiceMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.CustomerService; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface CustomerServiceMapper { @@ -12,6 +13,8 @@ public interface CustomerServiceMapper { int update(Integer id, CustomerService customerService); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); CustomerService getOne(Integer id); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c1d2d22..635175f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,6 +3,9 @@ spring: password: Biri-biri&Sisters url: jdbc:mysql://bank.accelerator.wtf/ccs username: misaka + jackson: + date-format: 'yyyy-MM-dd' + time-zone: 'Asia/Shanghai' mybatis: mapper-locations: classpath:mapper/*.xml diff --git a/src/main/resources/mapper/CustomerServiceMapper.xml b/src/main/resources/mapper/CustomerServiceMapper.xml index 970a5e6..9a19c9d 100644 --- a/src/main/resources/mapper/CustomerServiceMapper.xml +++ b/src/main/resources/mapper/CustomerServiceMapper.xml @@ -13,7 +13,9 @@ UPDATE customer_service SET + phone = #{customerService.phone}, + password = #{customerService.password}, headImg = #{customerService.headImg}, email = #{customerService.email}, @@ -31,6 +33,14 @@ WHERE customerServiceId = #{id}; + + UPDATE customer_service SET + + ${field} = #{value} + + WHERE customerServiceId = #{id}; + + DELETE FROM customer_service WHERE customerServiceId = #{id}; -- Gitee From f70c9ebf01cd407ec5cd56e3bd09bc8381fa058e Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Jun 2020 16:51:41 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20WorkOrder=20WorkOrderR?= =?UTF-8?q?eply=20WorkQualityStatistics=20WorkLog=20=E7=9B=B8=E5=85=B3=20C?= =?UTF-8?q?RUD=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cloudservice/ccs/biz/IWorkLogBiz.java | 18 ++++++ .../cloudservice/ccs/biz/IWorkOrderBiz.java | 16 +++++ .../ccs/biz/IWorkOrderReplyBiz.java | 16 +++++ .../ccs/biz/IWorkQualityStatisticsBiz.java | 16 +++++ .../ccs/biz/impl/WorkLogImpl.java | 58 +++++++++++++++++- .../ccs/biz/impl/WorkOrderImpl.java | 58 +++++++++++++++++- .../ccs/biz/impl/WorkOrderReplyImpl.java | 60 ++++++++++++++++++- .../biz/impl/WorkQualityStatisticsImpl.java | 58 +++++++++++++++++- .../ccs/controller/WorkLogController.java | 51 ++++++++++++++++ .../ccs/controller/WorkOrderController.java | 49 +++++++++++++++ .../controller/WorkOrderReplyController.java | 49 +++++++++++++++ .../WorkQualityStatisticsController.java | 49 +++++++++++++++ .../ccs/mapper/WorkLogMapper.java | 3 + .../ccs/mapper/WorkOrderMapper.java | 3 + .../ccs/mapper/WorkOrderReplyMapper.java | 3 + .../mapper/WorkQualityStatisticsMapper.java | 3 + src/main/resources/mapper/WorkLogMapper.xml | 20 +++++-- src/main/resources/mapper/WorkOrderMapper.xml | 31 ++++++---- .../resources/mapper/WorkOrderReplyMapper.xml | 16 +++-- .../mapper/WorkQualityStatisticsMapper.xml | 26 +++++--- 20 files changed, 568 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkLogBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkLogBiz.java index 109c1c5..57dd485 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkLogBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkLogBiz.java @@ -1,4 +1,22 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.CustomerService; +import com.cloudservice.ccs.entity.WorkLog; + +import java.util.List; +import java.util.Map; + public interface IWorkLogBiz { + + void save(WorkLog workLog); + + void update(Integer id, WorkLog workLog); + + void partialUpdate(Integer id, Map fields); + + void delete(Integer id); + + WorkLog getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkOrderBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkOrderBiz.java index 0a243b6..3e4633c 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkOrderBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkOrderBiz.java @@ -1,4 +1,20 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.WorkOrder; + +import java.util.List; +import java.util.Map; + public interface IWorkOrderBiz { + void save(WorkOrder workOrder); + + void update(Integer id, WorkOrder workOrder); + + void partialUpdate(Integer id, Map fields); + + void delete(Integer id); + + WorkOrder getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkOrderReplyBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkOrderReplyBiz.java index 7d4117d..3a9e1b6 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkOrderReplyBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkOrderReplyBiz.java @@ -1,4 +1,20 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.WorkOrderReply; + +import java.util.List; +import java.util.Map; + public interface IWorkOrderReplyBiz { + void save(WorkOrderReply workOrderReply); + + void update(Integer id, WorkOrderReply workOrderReply); + + void partialUpdate(Integer id, Map fields); + + void delete(Integer id); + + WorkOrderReply getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkQualityStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkQualityStatisticsBiz.java index 540fde3..8a03d5e 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkQualityStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkQualityStatisticsBiz.java @@ -1,4 +1,20 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.WorkQualityStatistics; + +import java.util.List; +import java.util.Map; + public interface IWorkQualityStatisticsBiz { + void save(WorkQualityStatistics workQualityStatistics); + + void update(Integer id, WorkQualityStatistics workQualityStatistics); + + void partialUpdate(Integer id, Map fields); + + void delete(Integer id); + + WorkQualityStatistics getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkLogImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkLogImpl.java index edc6251..c5157b3 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkLogImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkLogImpl.java @@ -1,7 +1,63 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IWorkLogBiz; +import com.cloudservice.ccs.entity.WorkLog; +import com.cloudservice.ccs.exception.WorkLogException; +import com.cloudservice.ccs.mapper.WorkLogMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + @Service -public class WorkLogImpl { +public class WorkLogImpl implements IWorkLogBiz { + @Autowired + private WorkLogMapper workLogMapper; + + @Override + public void save(WorkLog workLog) { + int res = workLogMapper.save(workLog); + if (res == 0) { + throw new WorkLogException("Create WorkLog failed"); + } + } + + @Override + public void update(Integer id, WorkLog workLog) { + int res = workLogMapper.update(id, workLog); + if (res == 0) { + throw new WorkLogException("Update WorkLog failed"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int res = workLogMapper.partialUpdate(id, fields); + if (res == 0) { + throw new WorkLogException("Partial update WorkLog failed"); + } + } + + @Override + public void delete(Integer id) { + int res = workLogMapper.delete(id); + if (res == 0) { + throw new WorkLogException("Delete WorkLog failed"); + } + } + + @Override + public WorkLog getOne(Integer id) { + WorkLog workLog = workLogMapper.getOne(id); + if (workLog == null) { + throw new WorkLogException("Requested WorkLog does not exist"); + } + return workLog; + } + + @Override + public List getAll() { + return workLogMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderImpl.java index fe4006a..47b9701 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderImpl.java @@ -1,7 +1,63 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IWorkOrderBiz; +import com.cloudservice.ccs.entity.WorkOrder; +import com.cloudservice.ccs.exception.WorkOrderException; +import com.cloudservice.ccs.mapper.WorkOrderMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + @Service -public class WorkOrderImpl { +public class WorkOrderImpl implements IWorkOrderBiz { + @Autowired + private WorkOrderMapper workOrderMapper; + + @Override + public void save(WorkOrder workOrder) { + int res = workOrderMapper.save(workOrder); + if (res == 0) { + throw new WorkOrderException("Create WorkOrder failed"); + } + } + + @Override + public void update(Integer id, WorkOrder workOrder) { + int res = workOrderMapper.update(id, workOrder); + if (res == 0) { + throw new WorkOrderException("Update WorkOrder failed"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int res = workOrderMapper.partialUpdate(id, fields); + if (res == 0) { + throw new WorkOrderException("Partial update WorkOrder failed"); + } + } + + @Override + public void delete(Integer id) { + int res = workOrderMapper.delete(id); + if (res == 0) { + throw new WorkOrderException("Delete WorkOrder failed"); + } + } + + @Override + public WorkOrder getOne(Integer id) { + WorkOrder workOrder = workOrderMapper.getOne(id); + if (workOrder == null) { + throw new WorkOrderException("Requested WorkOrder does not exist"); + } + return workOrder; + } + + @Override + public List getAll() { + return workOrderMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderReplyImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderReplyImpl.java index aa9f417..87c7f7e 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderReplyImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkOrderReplyImpl.java @@ -1,7 +1,65 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IWorkOrderReplyBiz; +import com.cloudservice.ccs.entity.WorkOrderReply; +import com.cloudservice.ccs.exception.WorkOrderReplyException; +import com.cloudservice.ccs.mapper.WorkOrderMapper; +import com.cloudservice.ccs.mapper.WorkOrderReplyMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + @Service -public class WorkOrderReplyImpl { +public class WorkOrderReplyImpl implements IWorkOrderReplyBiz { + + @Autowired + private WorkOrderReplyMapper workOrderReplyMapper; + + @Override + public void save(WorkOrderReply workOrderReply) { + int res = workOrderReplyMapper.save(workOrderReply); + if (res == 0) { + throw new WorkOrderReplyException("Create WorkOrder failed"); + } + } + + @Override + public void update(Integer id, WorkOrderReply workOrderReply) { + int res = workOrderReplyMapper.update(id, workOrderReply); + if (res == 0) { + throw new WorkOrderReplyException("Update WorkOrder failed"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int res = workOrderReplyMapper.partialUpdate(id, fields); + if (res == 0) { + throw new WorkOrderReplyException("Partial update WorkOrder failed"); + } + } + + @Override + public void delete(Integer id) { + int res = workOrderReplyMapper.delete(id); + if (res == 0) { + throw new WorkOrderReplyException("Delete WorkOrder failed"); + } + } + + @Override + public WorkOrderReply getOne(Integer id) { + WorkOrderReply workOrderReply = workOrderReplyMapper.getOne(id); + if (workOrderReply == null) { + throw new WorkOrderReplyException("Requested WorkOrderReply does not exist"); + } + return workOrderReply; + } + + @Override + public List getAll() { + return workOrderReplyMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkQualityStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkQualityStatisticsImpl.java index d2c4fb7..5354e52 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkQualityStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkQualityStatisticsImpl.java @@ -1,7 +1,63 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IWorkQualityStatisticsBiz; +import com.cloudservice.ccs.entity.WorkQualityStatistics; +import com.cloudservice.ccs.exception.WorkQualityStatisticsException; +import com.cloudservice.ccs.mapper.WorkQualityStatisticsMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + @Service -public class WorkQualityStatisticsImpl { +public class WorkQualityStatisticsImpl implements IWorkQualityStatisticsBiz { + @Autowired + private WorkQualityStatisticsMapper workQualityStatisticsMapper; + + @Override + public void save(WorkQualityStatistics workQualityStatistics) { + int res = workQualityStatisticsMapper.save(workQualityStatistics); + if (res == 0) { + throw new WorkQualityStatisticsException("Create WorkQualityStatistics failed"); + } + } + + @Override + public void update(Integer id, WorkQualityStatistics workQualityStatistics) { + int res = workQualityStatisticsMapper.update(id, workQualityStatistics); + if (res == 0) { + throw new WorkQualityStatisticsException("Update WorkQualityStatistics failed"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int res = workQualityStatisticsMapper.partialUpdate(id, fields); + if (res == 0) { + throw new WorkQualityStatisticsException("Partial update WorkQualityStatistics failed"); + } + } + + @Override + public void delete(Integer id) { + int res = workQualityStatisticsMapper.delete(id); + if (res == 0) { + throw new WorkQualityStatisticsException("Delete WorkQualityStatistics failed"); + } + } + + @Override + public WorkQualityStatistics getOne(Integer id) { + WorkQualityStatistics workQualityStatistics = workQualityStatisticsMapper.getOne(id); + if (workQualityStatistics == null) { + throw new WorkQualityStatisticsException("Requested WorkQualityStatistics does not exist"); + } + return workQualityStatistics; + } + + @Override + public List getAll() { + return workQualityStatisticsMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java b/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java index f6eaf3e..aeae5ff 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java @@ -1,4 +1,55 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IWorkLogBiz; +import com.cloudservice.ccs.entity.CustomerService; +import com.cloudservice.ccs.entity.WorkLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RequestMapping("work-log") public class WorkLogController { + @Autowired + IWorkLogBiz workLogBiz; + + @PostMapping("/") + void save(@RequestBody WorkLog workLog) { + // 接口问题待讨论:是否应当返回生成的 id? + workLogBiz.save(workLog); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody WorkLog workLog) { + workLogBiz.update(id, workLog); + } + + @PutMapping("/{id}/partial") + void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + workLogBiz.partialUpdate(id, fields); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + workLogBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + WorkLog result = workLogBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("customer-services", workLogBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java b/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java index c8b4131..5ab4ba9 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java @@ -1,4 +1,53 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IWorkOrderBiz; +import com.cloudservice.ccs.entity.WorkOrder; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class WorkOrderController { + @Autowired + IWorkOrderBiz workOrderBiz; + + @PostMapping("/") + void save(@RequestBody WorkOrder workOrder) { + // 接口问题待讨论:是否应当返回生成的 id? + workOrderBiz.save(workOrder); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody WorkOrder workOrder) { + workOrderBiz.update(id, workOrder); + } + + @PutMapping("/{id}/partial") + void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + workOrderBiz.partialUpdate(id, fields); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + workOrderBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + WorkOrder result = workOrderBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("customer-services", workOrderBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java b/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java index 0420d03..ec10235 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java @@ -1,4 +1,53 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IWorkOrderReplyBiz; +import com.cloudservice.ccs.entity.WorkOrderReply; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class WorkOrderReplyController { + @Autowired + IWorkOrderReplyBiz workOrderReplyBiz; + + @PostMapping("/") + void save(@RequestBody WorkOrderReply workOrderReply) { + // 接口问题待讨论:是否应当返回生成的 id? + workOrderReplyBiz.save(workOrderReply); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody WorkOrderReply workOrderReply) { + workOrderReplyBiz.update(id, workOrderReply); + } + + @PutMapping("/{id}/partial") + void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + workOrderReplyBiz.partialUpdate(id, fields); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + workOrderReplyBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + WorkOrderReply result = workOrderReplyBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("customer-services", workOrderReplyBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java index c527816..3ee1478 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java @@ -1,4 +1,53 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IWorkQualityStatisticsBiz; +import com.cloudservice.ccs.entity.WorkQualityStatistics; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class WorkQualityStatisticsController { + @Autowired + IWorkQualityStatisticsBiz workQualityStatisticsBiz; + + @PostMapping("/") + void save(@RequestBody WorkQualityStatistics workQualityStatistics) { + // 接口问题待讨论:是否应当返回生成的 id? + workQualityStatisticsBiz.save(workQualityStatistics); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody WorkQualityStatistics workQualityStatistics) { + workQualityStatisticsBiz.update(id, workQualityStatistics); + } + + @PutMapping("/{id}/partial") + void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + workQualityStatisticsBiz.partialUpdate(id, fields); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + workQualityStatisticsBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + WorkQualityStatistics result = workQualityStatisticsBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("customer-services", workQualityStatisticsBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/mapper/WorkLogMapper.java b/src/main/java/com/cloudservice/ccs/mapper/WorkLogMapper.java index 59c02f9..bae1b53 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/WorkLogMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/WorkLogMapper.java @@ -6,6 +6,7 @@ import com.cloudservice.ccs.entity.WorkloadStatistics; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface WorkLogMapper { @@ -13,6 +14,8 @@ public interface WorkLogMapper { int update(Integer id, WorkLog workLog); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); WorkLog getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/WorkOrderMapper.java b/src/main/java/com/cloudservice/ccs/mapper/WorkOrderMapper.java index 3f54881..f2fc612 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/WorkOrderMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/WorkOrderMapper.java @@ -6,6 +6,7 @@ import com.cloudservice.ccs.entity.WorkOrder; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface WorkOrderMapper { @@ -13,6 +14,8 @@ public interface WorkOrderMapper { int update(Integer id, WorkOrder workOrder); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); WorkOrder getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/WorkOrderReplyMapper.java b/src/main/java/com/cloudservice/ccs/mapper/WorkOrderReplyMapper.java index 0a9cd48..3166a26 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/WorkOrderReplyMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/WorkOrderReplyMapper.java @@ -6,6 +6,7 @@ import com.cloudservice.ccs.entity.WorkOrderReply; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface WorkOrderReplyMapper { @@ -13,6 +14,8 @@ public interface WorkOrderReplyMapper { int update(Integer workOrderId, WorkOrderReply WorkOrderReply); + int partialUpdate(Integer id, Map fields); + int delete(Integer workOrderId); WorkOrderReply getOne(Integer workOrderId); diff --git a/src/main/java/com/cloudservice/ccs/mapper/WorkQualityStatisticsMapper.java b/src/main/java/com/cloudservice/ccs/mapper/WorkQualityStatisticsMapper.java index f1cdfef..4166672 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/WorkQualityStatisticsMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/WorkQualityStatisticsMapper.java @@ -6,6 +6,7 @@ import com.cloudservice.ccs.entity.WorkQualityStatistics; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface WorkQualityStatisticsMapper { @@ -13,6 +14,8 @@ public interface WorkQualityStatisticsMapper { int update(Integer id, WorkQualityStatistics workQualityStatistics); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); WorkQualityStatistics getOne(Integer id); diff --git a/src/main/resources/mapper/WorkLogMapper.xml b/src/main/resources/mapper/WorkLogMapper.xml index 5533b04..5613f1e 100644 --- a/src/main/resources/mapper/WorkLogMapper.xml +++ b/src/main/resources/mapper/WorkLogMapper.xml @@ -13,12 +13,20 @@ UPDATE work_log SET - id = #{WorkLog.id}, - operatePerson = #{WorkLog.operatePerson}, - operatorAction = #{WorkLog.operatorAction}, - operatorClass = #{WorkLog.operatorClass}, - operatorTime = #{WorkLog.operatorTime}, - operatorIp = #{WorkLog.operatorIp} + id = #{workLog.id}, + operatePerson = #{workLog.operatePerson}, + operatorAction = #{workLog.operatorAction}, + operatorClass = #{workLog.operatorClass}, + operatorTime = #{workLog.operatorTime}, + operatorIp = #{workLog.operatorIp} + WHERE id = #{id}; + + + + UPDATE work_log SET + + ${field} = #{value} + WHERE id = #{id}; diff --git a/src/main/resources/mapper/WorkOrderMapper.xml b/src/main/resources/mapper/WorkOrderMapper.xml index 70b627a..a28fc07 100644 --- a/src/main/resources/mapper/WorkOrderMapper.xml +++ b/src/main/resources/mapper/WorkOrderMapper.xml @@ -13,19 +13,26 @@ UPDATE work_order SET - id = #{WorkOrder.id}, - workType = #{WorkOrder.workType}, - title = #{WorkOrder.title}, - workDesc = #{WorkOrder.workDesc}, - attachments = #{WorkOrder.attachments}, - cclist = #{WorkOrder.cclist}, - priority = #{WorkOrder.priority}, - state = #{WorkOrder.state}, - customerServiceGroupId = #{WorkOrder.customerServiceGroupId}, - customerServiceId = #{WorkOrder.customerServiceId}, - custmerId = #{WorkOrder.custmerId}, - channel = #{WorkOrder.channel} + id = #{workOrder.id}, + workType = #{workOrder.workType}, + title = #{workOrder.title}, + orderDesc = #{workOrder.orderDesc}, + attachments = #{workOrder.attachments}, + cclist = #{workOrder.cclist}, + priority = #{workOrder.priority}, + state = #{workOrder.state}, + customerServiceGroupId = #{workOrder.customerServiceGroupId}, + customerServiceId = #{workOrder.customerServiceId}, + custmerId = #{workOrder.custmerId}, + channel = #{workOrder.channel} + WHERE id = #{id}; + + + UPDATE work_order SET + + ${field} = #{value} + WHERE id = #{id}; diff --git a/src/main/resources/mapper/WorkOrderReplyMapper.xml b/src/main/resources/mapper/WorkOrderReplyMapper.xml index bb15f9b..cb54abd 100644 --- a/src/main/resources/mapper/WorkOrderReplyMapper.xml +++ b/src/main/resources/mapper/WorkOrderReplyMapper.xml @@ -13,14 +13,22 @@ UPDATE work_order_reply SET - workOrderId = #{WorkOrderReply.workOrderId}, - customerServiceId = #{WorkOrderReply.customerServiceId}, - replyTime = #{WorkOrderReply.replyTime}, - content = #{WorkOrderReply.content} + workOrderId = #{workOrderReply.workOrderId}, + customerServiceId = #{workOrderReply.customerServiceId}, + replyTime = #{workOrderReply.replyTime}, + content = #{workOrderReply.content} WHERE workOrderId = #{workOrderId}; + + UPDATE work_order_reply SET + + ${field} = #{value} + + WHERE workOrderId = #{id}; + + DELETE FROM work_order_reply WHERE workOrderId = #{workOrderId}; diff --git a/src/main/resources/mapper/WorkQualityStatisticsMapper.xml b/src/main/resources/mapper/WorkQualityStatisticsMapper.xml index 21de995..9baf0c7 100644 --- a/src/main/resources/mapper/WorkQualityStatisticsMapper.xml +++ b/src/main/resources/mapper/WorkQualityStatisticsMapper.xml @@ -13,15 +13,23 @@ UPDATE work_quality_statistics SET - id = #{WorkQualityStatistics.id}, - nickName = #{WorkQualityStatistics.nickName}, - effectiveSessionCount = #{WorkQualityStatistics.effectiveSessionCount}, - resolved = #{WorkQualityStatistics.resolved}, - unsolved = #{WorkQualityStatistics.unsolved}, - goodReview = #{WorkQualityStatistics.goodReview}, - mediumReview = #{WorkQualityStatistics.mediumReview}, - badReview = #{WorkQualityStatistics.badReview}, - noReview = #{WorkQualityStatistics.noReview} + id = #{workQualityStatistics.id}, + nickName = #{workQualityStatistics.nickName}, + effectiveSessionCount = #{workQualityStatistics.effectiveSessionCount}, + resolved = #{workQualityStatistics.resolved}, + unsolved = #{workQualityStatistics.unsolved}, + goodReview = #{workQualityStatistics.goodReview}, + mediumReview = #{workQualityStatistics.mediumReview}, + badReview = #{workQualityStatistics.badReview}, + noReview = #{workQualityStatistics.noReview} + WHERE id = #{id}; + + + + UPDATE work_quality_statistics SET + + ${field} = #{value} + WHERE id = #{id}; -- Gitee From 4116598ec966c29c2b7de186c266fbab51e8533e Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Jun 2020 17:12:30 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=83=A8=E5=88=86=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 吴泽霖 --- .../ccs/biz/IAttendanceStatisticsBiz.java | 4 ++ .../cloudservice/ccs/biz/IBlackListBiz.java | 4 ++ .../cloudservice/ccs/biz/ICommonWordBiz.java | 4 ++ .../ccs/biz/ICustomerInfoBiz.java | 4 ++ .../AttendanceStatisticsController.java | 44 +++++++++++++++++ .../ccs/controller/BlackListController.java | 47 ++++++++++++++++++- .../ccs/controller/CommonWordController.java | 44 +++++++++++++++++ .../controller/CustomerInfoController.java | 44 +++++++++++++++++ .../cloudservice/ccs/entity/BlackList.java | 3 ++ .../cloudservice/ccs/entity/CustomerInfo.java | 3 ++ 10 files changed, 199 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java index a44688b..0b87e80 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java @@ -6,8 +6,12 @@ import java.util.List; public interface IAttendanceStatisticsBiz { void save(AttendanceStatistics attendanceStatistics); + void update(Integer id, AttendanceStatistics attendanceStatistics); + void delete(Integer id); + AttendanceStatistics getOne(Integer id); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java b/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java index ece964e..2a68581 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java @@ -6,8 +6,12 @@ import java.util.List; public interface IBlackListBiz { void save(BlackList blackList); + void update(Integer id, BlackList blackList); + void delete(Integer id); + BlackList getOne(Integer id); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java b/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java index 1c3ec6a..bd7ecc0 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java @@ -6,8 +6,12 @@ import java.util.List; public interface ICommonWordBiz { void save(CommonWord commonWord); + void update(Integer id, CommonWord commonWord); + void delete(Integer id); + CommonWord getOne(Integer id); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java b/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java index 7352c0e..602a653 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java @@ -6,8 +6,12 @@ import java.util.List; public interface ICustomerInfoBiz { void save(CustomerInfo customerInfo); + void update(String email, CustomerInfo customerInfo); + void delete(String email); + CustomerInfo getOne(String email); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java index 0761631..ee674e1 100644 --- a/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IAttendanceStatisticsBiz; +import com.cloudservice.ccs.entity.AttendanceStatistics; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/attendance-statistics") public class AttendanceStatisticsController { + @Autowired + private IAttendanceStatisticsBiz attendanceStatisticsBiz; + + @PostMapping("/") + void save(@RequestBody AttendanceStatistics attendanceStatistics) { + // 接口问题待讨论:是否应当返回生成的 id? + attendanceStatisticsBiz.save(attendanceStatistics); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody AttendanceStatistics attendanceStatistics) { + attendanceStatisticsBiz.update(id, attendanceStatistics); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + attendanceStatisticsBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + AttendanceStatistics result = attendanceStatisticsBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("attendance-statistics", attendanceStatisticsBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/BlackListController.java b/src/main/java/com/cloudservice/ccs/controller/BlackListController.java index fb84c94..e08fcf0 100644 --- a/src/main/java/com/cloudservice/ccs/controller/BlackListController.java +++ b/src/main/java/com/cloudservice/ccs/controller/BlackListController.java @@ -1,5 +1,48 @@ package com.cloudservice.ccs.controller; -public class -BlackListController { +import com.cloudservice.ccs.biz.IBlackListBiz; +import com.cloudservice.ccs.entity.BlackList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/black-list") +public class BlackListController { + @Autowired + private IBlackListBiz blackListBiz; + + @PostMapping("/") + void save(@RequestBody BlackList blackList) { + // 接口问题待讨论:是否应当返回生成的 id? + blackListBiz.save(blackList); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody BlackList blackList) { + blackListBiz.update(id, blackList); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + blackListBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + BlackList result = blackListBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("black-list", blackListBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java b/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java index 9f90326..2e5a5f5 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.ICommonWordBiz; +import com.cloudservice.ccs.entity.CommonWord; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/common-word") public class CommonWordController { + @Autowired + private ICommonWordBiz commonWordBiz; + + @PostMapping("/") + void save(@RequestBody CommonWord commonWord) { + // 接口问题待讨论:是否应当返回生成的 id? + commonWordBiz.save(commonWord); + } + +@PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody CommonWord commonWord) { + commonWordBiz.update(id, commonWord); + } + +@DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + commonWordBiz.delete(id); + } + +@GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + CommonWord result = commonWordBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + +@GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("common-word", commonWordBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java b/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java index b04624d..8ff60d6 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.ICustomerInfoBiz; +import com.cloudservice.ccs.entity.CustomerInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/customer-info") public class CustomerInfoController { + @Autowired + private ICustomerInfoBiz customerInfoBiz; + + @PostMapping("/") + void save(@RequestBody CustomerInfo customerInfo) { + // 接口问题待讨论:是否应当返回生成的 id? + customerInfoBiz.save(customerInfo); + } + + @PutMapping("/{email}") + void update(@PathVariable String email, @RequestBody CustomerInfo customerInfo) { + customerInfoBiz.update(email, customerInfo); + } + + @DeleteMapping("/{email}") + void delete(@PathVariable String email) { + customerInfoBiz.delete(email); + } + + @GetMapping("/{email}") + ResponseEntity queryById(@PathVariable String email) { + CustomerInfo result = customerInfoBiz.getOne(email); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("customer-info", customerInfoBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/entity/BlackList.java b/src/main/java/com/cloudservice/ccs/entity/BlackList.java index c2b5620..00507fa 100644 --- a/src/main/java/com/cloudservice/ccs/entity/BlackList.java +++ b/src/main/java/com/cloudservice/ccs/entity/BlackList.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.entity; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -9,6 +10,8 @@ public class BlackList { private Integer customerServiceId; private Integer customerId; private String reason; + + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date time; private String source; } diff --git a/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java b/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java index 8a79038..67efd4d 100644 --- a/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java +++ b/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.entity; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -18,5 +19,7 @@ public class CustomerInfo { private Integer tagsId; private String remark; private Integer customerServiceId; + + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date lastedLoginTime; } -- Gitee From fb2825b83a73d8cd6a9a2e9968f3384fa547b1b6 Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Jun 2020 17:24:42 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 孙东东 --- .../ccs/biz/ISystemMessageBiz.java | 13 +++++ .../com/cloudservice/ccs/biz/ITagsBiz.java | 13 +++++ .../ccs/biz/IViewStatisticsBiz.java | 13 +++++ .../cloudservice/ccs/biz/IVisitorInfoBiz.java | 13 +++++ .../ccs/biz/IWorkloadStatisticsBiz.java | 14 ++++++ .../ccs/biz/impl/SystemMessageImpl.java | 49 ++++++++++++++++++- .../cloudservice/ccs/biz/impl/TagsImpl.java | 49 ++++++++++++++++++- .../ccs/biz/impl/ViewStatisticsImpl.java | 49 ++++++++++++++++++- .../ccs/biz/impl/VisitorInfoImpl.java | 49 ++++++++++++++++++- .../ccs/biz/impl/WorkloadStatisticsImpl.java | 49 ++++++++++++++++++- .../controller/SystemMessageController.java | 47 ++++++++++++++++++ .../ccs/controller/TagsController.java | 47 ++++++++++++++++++ .../controller/ViewStatisticsController.java | 49 +++++++++++++++++++ .../ccs/controller/VisitorInfoController.java | 47 ++++++++++++++++++ .../WorkloadStatisticsController.java | 47 ++++++++++++++++++ .../cloudservice/ccs/entity/VisitorInfo.java | 3 ++ .../ccs/mapper/VisitorInfoMapper.java | 2 +- 17 files changed, 547 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java index 7213f62..64cf013 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.SystemMessage; + +import java.util.List; + public interface ISystemMessageBiz { + void save(SystemMessage systemMessage); + + void update(Integer id, SystemMessage systemMessage); + + void delete(Integer id); + + SystemMessage getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java b/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java index a4b9092..c34314a 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.Tags; + +import java.util.List; + public interface ITagsBiz { + void save(Tags tags); + + void update(Integer id, Tags tags); + + void delete(Integer id); + + Tags getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java index 1ac59d8..c2d4a1b 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.ViewStatistics; + +import java.util.List; + public interface IViewStatisticsBiz { + void save(ViewStatistics viewStatistics); + + void update(Integer id, ViewStatistics viewStatistics); + + void delete(Integer id); + + ViewStatistics getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java b/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java index 0d8ba52..80e7743 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.VisitorInfo; + +import java.util.List; + public interface IVisitorInfoBiz { + void save(VisitorInfo visitorInfo); + + void update(String ip, VisitorInfo visitorInfo); + + void delete(String ip); + + VisitorInfo getOne(String ip); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java index 2578146..ab85feb 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java @@ -1,4 +1,18 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.WorkloadStatistics; + +import java.util.List; + public interface IWorkloadStatisticsBiz { + + void save(WorkloadStatistics workloadStatistics); + + void update(Integer id, WorkloadStatistics workloadStatistics); + + void delete(Integer id); + + WorkloadStatistics getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java index fc84e93..bad518d 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java @@ -1,7 +1,54 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.ISystemMessageBiz; +import com.cloudservice.ccs.entity.SystemMessage; +import com.cloudservice.ccs.exception.SystemMessageException; +import com.cloudservice.ccs.mapper.SystemMessageMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; @Service -public class SystemMessageImpl { +public class SystemMessageImpl implements ISystemMessageBiz { + + @Autowired + SystemMessageMapper systemMessageMapper; + + @Override + public void save(SystemMessage systemMessage) { + int result = systemMessageMapper.save(systemMessage); + if (result == 0) { + throw new SystemMessageException("Create CustomerService entity error"); + } + } + + @Override + public void update(Integer id, SystemMessage systemMessage) { + int result = systemMessageMapper.update(id, systemMessage); + if (result == 0) { + throw new SystemMessageException("Update CustomerService entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = systemMessageMapper.delete(id); + if (result == 0) { + throw new SystemMessageException("Delete CustomerService entity error"); + } + } + + @Override + public SystemMessage getOne(Integer id) { + SystemMessage systemMessage = systemMessageMapper.getOne(id); + if (systemMessage == null) { + throw new SystemMessageException("Get CustomerService entity error: no such entity"); + } + return systemMessage; + } + + @Override + public List getAll() { + return systemMessageMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java index f4542b3..80ba349 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java @@ -1,7 +1,54 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.ITagsBiz; +import com.cloudservice.ccs.entity.Tags; +import com.cloudservice.ccs.exception.TagsException; +import com.cloudservice.ccs.mapper.TagsMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class TagsImpl { +public class TagsImpl implements ITagsBiz { + @Autowired + TagsMapper tagsMapper; + + @Override + public void save(Tags tags) { + int result = tagsMapper.save(tags); + if (result == 0) { + throw new TagsException("Create CustomerService entity error"); + } + } + + @Override + public void update(Integer id, Tags tags) { + int result = tagsMapper.update(id, tags); + if (result == 0) { + throw new TagsException("Update CustomerService entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = tagsMapper.delete(id); + if (result == 0) { + throw new TagsException("Delete CustomerService entity error"); + } + } + + @Override + public Tags getOne(Integer id) { + Tags tags = tagsMapper.getOne(id); + if (tags == null) { + throw new TagsException("Get CustomerService entity error: no such entity"); + } + return tags; + } + + @Override + public List getAll() { + return tagsMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java index 04e2757..0d96b4c 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java @@ -1,7 +1,54 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IViewStatisticsBiz; +import com.cloudservice.ccs.entity.ViewStatistics; +import com.cloudservice.ccs.exception.ViewStatisticsException; +import com.cloudservice.ccs.mapper.ViewStatisticsMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class ViewStatisticsImpl { +public class ViewStatisticsImpl implements IViewStatisticsBiz { + @Autowired + ViewStatisticsMapper viewStatisticsMapper; + + @Override + public void save(ViewStatistics viewStatistics) { + int result = viewStatisticsMapper.save(viewStatistics); + if (result == 0) { + throw new ViewStatisticsException("Create CustomerService entity error"); + } + } + + @Override + public void update(Integer id, ViewStatistics viewStatistics) { + int result = viewStatisticsMapper.update(id, viewStatistics); + if (result == 0) { + throw new ViewStatisticsException("Update CustomerService entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = viewStatisticsMapper.delete(id); + if (result == 0) { + throw new ViewStatisticsException("Delete CustomerService entity error"); + } + } + + @Override + public ViewStatistics getOne(Integer id) { + ViewStatistics viewStatistics = viewStatisticsMapper.getOne(id); + if (viewStatistics == null) { + throw new ViewStatisticsException("Get CustomerService entity error: no such entity"); + } + return viewStatistics; + } + + @Override + public List getAll() { + return viewStatisticsMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java index d276df8..bc02a67 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java @@ -1,7 +1,54 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IVisitorInfoBiz; +import com.cloudservice.ccs.entity.VisitorInfo; +import com.cloudservice.ccs.exception.VisitorInfoException; +import com.cloudservice.ccs.mapper.VisitorInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class VisitorInfoImpl { +public class VisitorInfoImpl implements IVisitorInfoBiz { + @Autowired + VisitorInfoMapper visitorInfoMapper; + + @Override + public void save(VisitorInfo visitorInfo) { + int result = visitorInfoMapper.save(visitorInfo); + if (result == 0) { + throw new VisitorInfoException("Create CustomerService entity error"); + } + } + + @Override + public void update(String ip, VisitorInfo visitorInfo) { + int result = visitorInfoMapper.update(ip, visitorInfo); + if (result == 0) { + throw new VisitorInfoException("Update CustomerService entity error"); + } + } + + @Override + public void delete(String ip) { + int result = visitorInfoMapper.delete(ip); + if (result == 0) { + throw new VisitorInfoException("Delete CustomerService entity error"); + } + } + + @Override + public VisitorInfo getOne(String ip) { + VisitorInfo visitorInfo = visitorInfoMapper.getOne(ip); + if (visitorInfo == null) { + throw new VisitorInfoException("Get CustomerService entity error: no such entity"); + } + return visitorInfo; + } + + @Override + public List getAll() { + return visitorInfoMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java index e0a7cb9..1727b71 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java @@ -1,7 +1,54 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.IWorkloadStatisticsBiz; +import com.cloudservice.ccs.entity.WorkloadStatistics; +import com.cloudservice.ccs.exception.WorkloadStatisticsException; +import com.cloudservice.ccs.mapper.WorkLoadStatisticsMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class WorkloadStatisticsImpl { +public class WorkloadStatisticsImpl implements IWorkloadStatisticsBiz { + @Autowired + WorkLoadStatisticsMapper workLoadStatisticsMapper; + + @Override + public void save(WorkloadStatistics workloadStatistics) { + int result = workLoadStatisticsMapper.save(workloadStatistics); + if (result == 0) { + throw new WorkloadStatisticsException("Create CustomerService entity error"); + } + } + + @Override + public void update(Integer id, WorkloadStatistics workloadStatistics) { + int result = workLoadStatisticsMapper.update(id, workloadStatistics); + if (result == 0) { + throw new WorkloadStatisticsException("Update CustomerService entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = workLoadStatisticsMapper.delete(id); + if (result == 0) { + throw new WorkloadStatisticsException("Delete CustomerService entity error"); + } + } + + @Override + public WorkloadStatistics getOne(Integer id) { + WorkloadStatistics workloadStatistics = workLoadStatisticsMapper.getOne(id); + if (workloadStatistics == null) { + throw new WorkloadStatisticsException("Get CustomerService entity error: no such entity"); + } + return workloadStatistics; + } + + @Override + public List getAll() { + return workLoadStatisticsMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java b/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java index e42eaa0..336b8a7 100644 --- a/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java @@ -1,4 +1,51 @@ package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.ISystemMessageBiz; +import com.cloudservice.ccs.entity.SystemMessage; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/system-message") public class SystemMessageController { + @Autowired + ISystemMessageBiz systemMessageBiz; + + @PostMapping("/") + void save(@RequestBody SystemMessage systemMessage) { + // 接口问题待讨论:是否应当返回生成的 id? + systemMessageBiz.save(systemMessage); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody SystemMessage systemMessage) { + systemMessageBiz.update(id, systemMessage); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + systemMessageBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + SystemMessage result = systemMessageBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("system-message", systemMessageBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/TagsController.java b/src/main/java/com/cloudservice/ccs/controller/TagsController.java index da5dd56..05e93d9 100644 --- a/src/main/java/com/cloudservice/ccs/controller/TagsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/TagsController.java @@ -1,4 +1,51 @@ package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.ITagsBiz; +import com.cloudservice.ccs.entity.Tags; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/tags") public class TagsController { + @Autowired + ITagsBiz tagsBiz; + + @PostMapping("/") + void save(@RequestBody Tags tags) { + // 接口问题待讨论:是否应当返回生成的 id? + tagsBiz.save(tags); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody Tags tags) { + tagsBiz.update(id, tags); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + tagsBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + Tags result = tagsBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("tags", tagsBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java index cb904d1..eb554e8 100644 --- a/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java @@ -1,4 +1,53 @@ package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.ITagsBiz; +import com.cloudservice.ccs.biz.IViewStatisticsBiz; +import com.cloudservice.ccs.entity.Tags; +import com.cloudservice.ccs.entity.ViewStatistics; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/view-statistics") public class ViewStatisticsController { + @Autowired + IViewStatisticsBiz viewStatisticsBiz; + + @PostMapping("/") + void save(@RequestBody ViewStatistics viewStatistics) { + // 接口问题待讨论:是否应当返回生成的 id? + viewStatisticsBiz.save(viewStatistics); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody ViewStatistics viewStatistics) { + viewStatisticsBiz.update(id, viewStatistics); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + viewStatisticsBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + ViewStatistics result = viewStatisticsBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("view-statistics", viewStatisticsBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java b/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java index f217f82..ed0be28 100644 --- a/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java +++ b/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java @@ -1,4 +1,51 @@ package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.IVisitorInfoBiz; +import com.cloudservice.ccs.entity.VisitorInfo; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/visitor-info") public class VisitorInfoController { + @Autowired + IVisitorInfoBiz visitorInfoBiz; + + @PostMapping("/") + void save(@RequestBody VisitorInfo visitorInfo) { + // 接口问题待讨论:是否应当返回生成的 id? + visitorInfoBiz.save(visitorInfo); + } + + @PutMapping("/{ip}") + void update(@PathVariable String ip, @RequestBody VisitorInfo visitorInfo) { + visitorInfoBiz.update(ip, visitorInfo); + } + + @DeleteMapping("/{ip}") + void delete(@PathVariable String ip) { + visitorInfoBiz.delete(ip); + } + + @GetMapping("/{ip}") + ResponseEntity queryById(@PathVariable String ip) { + VisitorInfo result = visitorInfoBiz.getOne(ip); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("visitor-info", visitorInfoBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java index 29dade6..20dd44b 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java @@ -1,4 +1,51 @@ package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.IWorkloadStatisticsBiz; +import com.cloudservice.ccs.entity.WorkloadStatistics; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/workload-statistics") public class WorkloadStatisticsController { + @Autowired + IWorkloadStatisticsBiz workloadStatisticsBiz; + + @PostMapping("/") + void save(@RequestBody WorkloadStatistics workloadStatistics) { + // 接口问题待讨论:是否应当返回生成的 id? + workloadStatisticsBiz.save(workloadStatistics); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody WorkloadStatistics workloadStatistics) { + workloadStatisticsBiz.update(id, workloadStatistics); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + workloadStatisticsBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + WorkloadStatistics result = workloadStatisticsBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @RequiresPermissions("all") + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("workload-statistics", workloadStatisticsBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/entity/VisitorInfo.java b/src/main/java/com/cloudservice/ccs/entity/VisitorInfo.java index 307886d..130c1f8 100644 --- a/src/main/java/com/cloudservice/ccs/entity/VisitorInfo.java +++ b/src/main/java/com/cloudservice/ccs/entity/VisitorInfo.java @@ -13,4 +13,7 @@ public class VisitorInfo { private Integer customerServiceId; private String state; private Integer visitDuration; + + + private Data visitTime; } diff --git a/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java b/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java index c024844..cb538b7 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java @@ -11,7 +11,7 @@ import java.util.List; public interface VisitorInfoMapper { int save(VisitorInfo visitorInfo); - int update(Integer id, VisitorInfo visitorInfo); + int update(String ip, VisitorInfo visitorInfo); int delete(String ip); -- Gitee From 010bddf7f8e1796bb781791db518b1f6288302b5 Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Jun 2020 17:28:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 刘经诚 --- .../cloudservice/ccs/biz/IGroupManageBiz.java | 6 ++- .../com/cloudservice/ccs/biz/INoticeBiz.java | 6 ++- .../cloudservice/ccs/biz/IRoleManageBiz.java | 13 +++++ .../com/cloudservice/ccs/biz/ISessionBiz.java | 14 ++++++ .../ccs/biz/ISessionMessageBiz.java | 13 +++++ .../ccs/biz/impl/RoleManageImpl.java | 47 +++++++++++++++++- .../ccs/biz/impl/SessionImpl.java | 48 ++++++++++++++++++- .../ccs/biz/impl/SessionMessageImpl.java | 48 ++++++++++++++++++- .../ccs/controller/GroupManageController.java | 43 +++++++++++++++++ .../ccs/controller/NoticeController.java | 44 +++++++++++++++++ .../ccs/controller/RoleManageController.java | 44 +++++++++++++++++ .../ccs/controller/SessionController.java | 44 +++++++++++++++++ .../controller/SessionMessageController.java | 48 +++++++++++++++++++ .../ccs/mapper/SessionMapper.java | 4 +- 14 files changed, 415 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java diff --git a/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java b/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java index 6f9479a..f5ceb64 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java @@ -5,9 +5,13 @@ import com.cloudservice.ccs.entity.GroupManage; import java.util.List; public interface IGroupManageBiz { - void save(GroupManage groupManage); + void save( GroupManage groupManage); + void update(Integer id, GroupManage groupManage); + void delete(Integer id); + GroupManage getOne(Integer id); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java b/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java index 19ee88d..d3b5636 100644 --- a/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java @@ -5,9 +5,13 @@ import com.cloudservice.ccs.entity.Notice; import java.util.List; public interface INoticeBiz { - void save(Notice notice); + void save( Notice notice); + void update(Integer id, Notice notice); + void delete(Integer id); + Notice getOne(Integer id); + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java b/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java index 1b9eec2..acf1351 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.RoleManage; + +import java.util.List; + public interface IRoleManageBiz { + void save(RoleManage roleManage); + + void update(Integer id, RoleManage roleManage); + + void delete(Integer id); + + RoleManage getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java index 06dbf88..3b2ed6d 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java @@ -1,4 +1,18 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.Session; +import com.cloudservice.ccs.mapper.SessionMapper; + +import java.util.List; + public interface ISessionBiz { + void save(Session session); + + void update(Integer id, Session session); + + void delete(Integer id); + + Session getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java index b024b7b..7de7475 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java @@ -1,4 +1,17 @@ package com.cloudservice.ccs.biz; +import com.cloudservice.ccs.entity.SessionMessage; + +import java.util.List; + public interface ISessionMessageBiz { + void save(SessionMessage sessionMessage); + + void update(Integer id, SessionMessage sessionMessage); + + void delete(Integer id); + + SessionMessage getOne(Integer id); + + List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java index 0da3966..625a7d8 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java @@ -1,8 +1,53 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IRoleManageBiz; +import com.cloudservice.ccs.entity.RoleManage; +import com.cloudservice.ccs.exception.RoleManageException; +import com.cloudservice.ccs.mapper.RoleManageMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class RoleManageImpl { +public class RoleManageImpl implements IRoleManageBiz{ + @Autowired + private RoleManageMapper roleManageMapper; + @Override + public void save(RoleManage roleManage) { + int result = roleManageMapper.save(roleManage); + if (result == 0) { + throw new RoleManageException( "Create RoleManage entity error"); + } + } + + @Override + public void update(Integer id, RoleManage roleManage) { + int result = roleManageMapper.update(id, roleManage); + if (result == 0) { + throw new RoleManageException("Update RoleManage entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = roleManageMapper.delete(id); + if (result == 0) { + throw new RoleManageException("Delete RoleManage entity error"); + } + } + + @Override + public RoleManage getOne(Integer id) { + RoleManage roleManage = roleManageMapper.getOne(id); + if (roleManage == null) { + throw new RoleManageException("Get RoleManage entity error: no such entity"); + } + return roleManage; + } + + @Override + public List getAll() { + return roleManageMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java index 611fdb2..c751f78 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java @@ -1,7 +1,53 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.ISessionBiz; +import com.cloudservice.ccs.entity.Session; +import com.cloudservice.ccs.exception.SessionException; +import com.cloudservice.ccs.mapper.SessionMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class SessionImpl { +public class SessionImpl implements ISessionBiz { + @Autowired + private SessionMapper sessionMapper; + @Override + public void save(Session session) { + int result = sessionMapper.save(session); + if (result == 0) { + throw new SessionException("Create Session entity error"); + } + } + + @Override + public void update(Integer id, Session session) { + int result = sessionMapper.update(id, session); + if (result == 0) { + throw new SessionException("Update Session entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = sessionMapper.delete(id); + if (result == 0) { + throw new SessionException("Delete Session entity error"); + } + } + + @Override + public Session getOne(Integer id) { + Session session = sessionMapper.getOne(id); + if (session == null) { + throw new SessionException("Get Session entity error: no such entity"); + } + return session; + } + + @Override + public List getAll() { + return sessionMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java index 47f4e55..559d720 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java @@ -1,7 +1,53 @@ package com.cloudservice.ccs.biz.impl; +import com.cloudservice.ccs.biz.ISessionMessageBiz; +import com.cloudservice.ccs.entity.SessionMessage; +import com.cloudservice.ccs.exception.SessionMessageException; +import com.cloudservice.ccs.mapper.SessionMessageMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service -public class SessionMessageImpl { +public class SessionMessageImpl implements ISessionMessageBiz { + @Autowired + private SessionMessageMapper sessionMessageMapper; + @Override + public void save(SessionMessage sessionMessage) { + int result = sessionMessageMapper.save(sessionMessage); + if (result == 0) { + throw new SessionMessageException("Create SessionMessage entity error"); + } + } + + @Override + public void update(Integer id, SessionMessage sessionMessage) { + int result = sessionMessageMapper.update(id, sessionMessage); + if (result == 0) { + throw new SessionMessageException("Update SessionMessage entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = sessionMessageMapper.delete(id); + if (result == 0) { + throw new SessionMessageException("Delete SessionMessage entity error"); + } + } + + @Override + public SessionMessage getOne(Integer id) { + SessionMessage sessionMessage = sessionMessageMapper.getOne(id); + if (sessionMessage == null) { + throw new SessionMessageException("Get SessionMessage entity error: no such entity"); + } + return sessionMessage; + } + + @Override + public List getAll() { + return sessionMessageMapper.getAll(); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java b/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java index 3d19aaf..873c3c6 100644 --- a/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java @@ -1,4 +1,47 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IGroupManageBiz; +import com.cloudservice.ccs.entity.GroupManage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/group-manage") public class GroupManageController { + @Autowired + IGroupManageBiz groupManageBiz; + + @PostMapping("/") + void save(@RequestBody GroupManage groupManage) { + groupManageBiz.save(groupManage); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody GroupManage groupManage) { + groupManageBiz.update(id, groupManage); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + groupManageBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + GroupManage result = groupManageBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("group-manage", groupManageBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/NoticeController.java b/src/main/java/com/cloudservice/ccs/controller/NoticeController.java index e6833c4..78c8b1a 100644 --- a/src/main/java/com/cloudservice/ccs/controller/NoticeController.java +++ b/src/main/java/com/cloudservice/ccs/controller/NoticeController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.INoticeBiz; +import com.cloudservice.ccs.entity.Notice; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/notice") public class NoticeController { + + @Autowired + INoticeBiz noticeBiz; + + @PostMapping("/") + void save(@RequestBody Notice notice) { + noticeBiz.save(notice); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody Notice notice) { + noticeBiz.update(id, notice); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + noticeBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + Notice result = noticeBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("notice", noticeBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java b/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java index ebee282..ec57b7d 100644 --- a/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.IRoleManageBiz; +import com.cloudservice.ccs.entity.RoleManage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/role-manage") public class RoleManageController { + + @Autowired + IRoleManageBiz roleManageBiz; + + @PostMapping("/") + void save(@RequestBody RoleManage roleManage) { + roleManageBiz.save(roleManage); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody RoleManage roleManage) { + roleManageBiz.update(id, roleManage); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + roleManageBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + RoleManage result = roleManageBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("role-manage", roleManageBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SessionController.java b/src/main/java/com/cloudservice/ccs/controller/SessionController.java index df6f476..56d88f8 100644 --- a/src/main/java/com/cloudservice/ccs/controller/SessionController.java +++ b/src/main/java/com/cloudservice/ccs/controller/SessionController.java @@ -1,4 +1,48 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.ISessionBiz; +import com.cloudservice.ccs.entity.Session; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/session") public class SessionController { + + @Autowired + ISessionBiz sessionBiz; + + @PostMapping("/") + void save(@RequestBody Session session) { + sessionBiz.save(session); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody Session session) { + sessionBiz.update(id, session); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + sessionBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + Session result = sessionBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("session", sessionBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java b/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java new file mode 100644 index 0000000..5732685 --- /dev/null +++ b/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java @@ -0,0 +1,48 @@ +package com.cloudservice.ccs.controller; + +import com.cloudservice.ccs.biz.ISessionMessageBiz; +import com.cloudservice.ccs.entity.SessionMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/session-message") +public class SessionMessageController { + + @Autowired + ISessionMessageBiz sessionMessageBiz; + + @PostMapping("/") + void save(@RequestBody SessionMessage sessionMessage) { + sessionMessageBiz.save(sessionMessage); + } + + @PutMapping("/{id}") + void update(@PathVariable Integer id, @RequestBody SessionMessage sessionMessage) { + sessionMessageBiz.update(id, sessionMessage); + } + + @DeleteMapping("/{id}") + void delete(@PathVariable Integer id) { + sessionMessageBiz.delete(id); + } + + @GetMapping("/{id}") + ResponseEntity queryById(@PathVariable Integer id) { + SessionMessage result = sessionMessageBiz.getOne(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @GetMapping("/") + ResponseEntity>> queryAll() { + Map> result = new HashMap<>(); + result.put("session-message", sessionMessageBiz.getAll()); + return new ResponseEntity<>(result, HttpStatus.OK); + } +} diff --git a/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java b/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java index 2875cbd..da915c4 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java @@ -8,9 +8,9 @@ import java.util.List; @Mapper public interface SessionMapper { - int save(SessionMapper sessionMapper); + int save(Session session); - int update(Integer id, SessionMapper sessionMapper); + int update(Integer id, Session session); int delete(Integer id); -- Gitee