From 1fc874a8ed47951e746b335bb99507cff454982e Mon Sep 17 00:00:00 2001 From: NH-LHG Date: Tue, 6 Jun 2023 13:01:10 +0800 Subject: [PATCH] =?UTF-8?q?[add]=E7=BB=9F=E8=AE=A1=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/erp/controller/OrderController.java | 8 ++++ .../modules/demo/erp/mapper/OrderMapper.java | 9 +++- .../demo/erp/mapper/xml/OrderMapper.xml | 18 +++++++- .../demo/erp/service/IOrderService.java | 17 ++++++-- .../erp/service/impl/OrderServiceImpl.java | 8 ++++ .../modules/demo/erp/vo/OrderStateVo.java | 43 +++++++++++++++++++ 6 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderStateVo.java diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java index 842730b..e3cc64b 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java @@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import org.jeecg.modules.demo.erp.entity.ext.OrderDetailExt; import org.jeecg.modules.demo.erp.entity.ext.OrderExt; +import org.jeecg.modules.demo.erp.vo.OrderStateVo; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -102,6 +103,13 @@ public class OrderController { return Result.OK(pageExt); } + @ApiOperation(value="订单状态统计", notes="订单状态统计") + @GetMapping(value = "/queryState") + public Result queryState(@RequestParam(name="userId",required=true) String userId){ + OrderStateVo orderStateVo = new OrderStateVo(); + orderStateVo = orderService.queryState(userId); + return Result.OK(orderStateVo); + } /** * 添加 * diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/OrderMapper.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/OrderMapper.java index 9b7b068..b3d4f0b 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/OrderMapper.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/OrderMapper.java @@ -1,10 +1,9 @@ package org.jeecg.modules.demo.erp.mapper; -import java.util.List; - import org.apache.ibatis.annotations.Param; import org.jeecg.modules.demo.erp.entity.Order; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.demo.erp.vo.OrderStateVo; /** * @Description: 订单 @@ -13,5 +12,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @Version: V1.0 */ public interface OrderMapper extends BaseMapper { + /** + * 订单状态统计 + * @param userId + * @return + */ + OrderStateVo queryState(@Param("userId") String userId); } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/OrderMapper.xml b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/OrderMapper.xml index 04aaf0f..111368a 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/OrderMapper.xml +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/OrderMapper.xml @@ -2,4 +2,20 @@ - \ No newline at end of file + + + + + diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IOrderService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IOrderService.java index f25824c..3a401dd 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IOrderService.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IOrderService.java @@ -3,6 +3,8 @@ package org.jeecg.modules.demo.erp.service; import org.jeecg.modules.demo.erp.entity.OrderDetail; import org.jeecg.modules.demo.erp.entity.Order; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.demo.erp.vo.OrderStateVo; + import java.io.Serializable; import java.util.Collection; import java.util.List; @@ -22,7 +24,7 @@ public interface IOrderService extends IService { * @param orderDetailList */ public void saveMain(Order order,List orderDetailList) ; - + /** * 修改一对多 * @@ -30,19 +32,26 @@ public interface IOrderService extends IService { * @param orderDetailList */ public void updateMain(Order order,List orderDetailList); - + /** * 删除一对多 * * @param id */ public void delMain (String id); - + + /** + * 订单状态统计 + * @param id + * @return + */ + public OrderStateVo queryState(String id); + /** * 批量删除一对多 * * @param idList */ public void delBatchMain (Collection idList); - + } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/OrderServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/OrderServiceImpl.java index 5beffe8..8956863 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/OrderServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/OrderServiceImpl.java @@ -5,6 +5,7 @@ import org.jeecg.modules.demo.erp.entity.OrderDetail; import org.jeecg.modules.demo.erp.mapper.OrderDetailMapper; import org.jeecg.modules.demo.erp.mapper.OrderMapper; import org.jeecg.modules.demo.erp.service.IOrderService; +import org.jeecg.modules.demo.erp.vo.OrderStateVo; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -65,6 +66,13 @@ public class OrderServiceImpl extends ServiceImpl implements orderMapper.deleteById(id); } + @Override + @Transactional(rollbackFor = Exception.class) + public OrderStateVo queryState(String id) { + return orderMapper.queryState(id); + } + + @Override @Transactional(rollbackFor = Exception.class) public void delBatchMain(Collection idList) { diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderStateVo.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderStateVo.java new file mode 100644 index 0000000..337b451 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderStateVo.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.demo.erp.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +/** + * @author NH-LHG + */ +@Data +@ApiModel(value="订单状态统计", description="订单状态统计") +public class OrderStateVo { + /**总数*/ + @Excel(name = "总数", width = 15) + @ApiModelProperty(value = "总数") + private java.lang.String totalNum; + /**未付款*/ + @Excel(name = "未付款", width = 15) + @ApiModelProperty(value = "未付款") + private java.lang.String unpaid; + /**未发货*/ + @Excel(name = "未发货", width = 15) + @ApiModelProperty(value = "未发货") + private java.lang.String notSend; + /**已发货*/ + @Excel(name = "已发货", width = 15) + @ApiModelProperty(value = "已发货") + private java.lang.String send; + /**完结*/ + @Excel(name = "完结", width = 15) + @ApiModelProperty(value = "完结") + private java.lang.String complete; + /**其他*/ + @Excel(name = "其他", width = 15) + @ApiModelProperty(value = "其他") + private java.lang.String other; + /**取消*/ + @Excel(name = "取消", width = 15) + @ApiModelProperty(value = "取消") + private java.lang.String cancel; + +}