From 3df48185231b49359be9ba843978e3450f36e1ed Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 24 Jun 2021 16:37:50 +0800
Subject: [PATCH] 20210624 商品分类
---
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminOrderController.java | 43 ++++++++++++++
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java | 3 +
gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryOrderListVo.java | 9 +++
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java | 6 +
gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryOrderListDto.java | 35 +++++++++++
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java | 12 ++++
gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java | 44 ++++++++++++++
gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml | 17 +++++
gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java | 9 ++
9 files changed, 175 insertions(+), 3 deletions(-)
diff --git a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
index 8f534a1..61cf63f 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
@@ -27,7 +27,11 @@
private String details;
- private String priceRange;
+// private String priceRange;
+
+ private String originalPrice;
+
+ private String presentPrice;
private String categoryId;
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
index 30087a0..5738997 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
@@ -162,6 +162,9 @@
if(!parentId.equals(scoreGoodsCategory.getParentId())){
scoreGoodsCategory.setParentId(parentId);
}
+ if(parentId.equals(id)){
+ return JsonResult.failMessage("父类不能为自己!");
+ }
GoodsCategoryModel goodsCategoryModel = new GoodsCategoryModel();
goodsCategoryModel.setName(name);
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminOrderController.java b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminOrderController.java
new file mode 100644
index 0000000..8047c64
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminOrderController.java
@@ -0,0 +1,43 @@
+package com.xzx.gc.shop.controller;
+
+import com.xzx.gc.common.constant.Constants;
+import com.xzx.gc.common.request.BaseController;
+import com.xzx.gc.model.JsonResult;
+import com.xzx.gc.shop.dto.QueryGoodsListDto;
+import com.xzx.gc.shop.dto.QueryOrderListDto;
+import com.xzx.gc.shop.service.OrderService;
+import com.xzx.gc.shop.vo.QueryGoodsListVo;
+import com.xzx.gc.shop.vo.QueryOrderListVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+@RestController
+@Api(tags = {"积分商城--订单管理"})
+@Slf4j
+public class AdminOrderController extends BaseController {
+
+ @Resource
+ private OrderService orderService;
+
+ /**
+ * 查询订单列表
+ * xzx_score_order 积分商城订单
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/queryOrderList.json")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = QueryOrderListVo.class)})
+ @ApiOperation(value = "订单管理-查询订单列表", notes = "test: 仅0有正确返回")
+ public JsonResult<Map<String, Object>> queryOrderList(@RequestBody QueryOrderListDto model) {
+ Map<String, Object> result = orderService.queryOrderList(model);
+ return JsonResult.success(result);
+ }
+
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
index 8dc1826..2b48c4f 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
@@ -32,9 +32,14 @@
@ApiModelProperty(value="商品详情",required=true)
private String details;
- @ApiModelProperty(value="积分范围",required=true)
- private String priceRange;
+// @ApiModelProperty(value="积分范围",required=true)
+// private String priceRange;
+ @ApiModelProperty(value="原价",required=true)
+ private String originalPrice;
+
+ @ApiModelProperty(value="现价",required=true)
+ private String presentPrice;
@ApiModelProperty(value="商品分类ID",required=true)
private String categoryId;
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryOrderListDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryOrderListDto.java
new file mode 100644
index 0000000..d29ab50
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryOrderListDto.java
@@ -0,0 +1,35 @@
+package com.xzx.gc.shop.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class QueryOrderListDto {
+
+ @ApiModelProperty(value="订单编号")
+ private String orderNo;
+
+ @ApiModelProperty(value="客户姓名")
+ private String name;
+
+ @ApiModelProperty(value="状态 2-待收货3-已完成4-已取消")
+ private Integer status;
+
+ @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @ApiModelProperty(value="下单时间开始时间")
+ private Date createdTimeStart;
+
+ @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @ApiModelProperty(value="下单时间结束时间")
+ private Date createdTimeEnd;
+
+ @ApiModelProperty(value="第几页",required=true)
+ private int page;
+ @ApiModelProperty(value="每一页数量",required=true)
+ private int limit;
+
+
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java
index 204c01a..3c37cf7 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java
@@ -1,7 +1,19 @@
package com.xzx.gc.shop.mapper;
import com.xzx.gc.entity.ScoreOrder;
+import com.xzx.gc.shop.dto.QueryOrderListDto;
+import com.xzx.gc.shop.vo.QueryOrderListVo;
import com.xzx.gc.util.GcMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
public interface ScoreOrderMapper extends GcMapper<ScoreOrder> {
+
+ List<QueryOrderListVo> queryOrderList(@Param("name")String name,
+ @Param("orderNo")String orderNo,
+ @Param("status")Integer status,
+ @Param("createdTimeStart")Date createdTimeStart,
+ @Param("createdTimeEnd")Date createdTimeEnd);
}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java
new file mode 100644
index 0000000..3f08d63
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java
@@ -0,0 +1,44 @@
+package com.xzx.gc.shop.service;
+
+import cn.hutool.core.convert.Convert;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.xzx.gc.shop.dto.QueryOrderListDto;
+import com.xzx.gc.shop.mapper.ScoreOrderMapper;
+import com.xzx.gc.shop.vo.QueryOrderListVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Transactional
+@Slf4j
+public class OrderService {
+
+ @Resource
+ ScoreOrderMapper scoreOrderMapper;
+
+ public Map<String, Object> queryOrderList(QueryOrderListDto model) {
+ String name = model.getName();
+ String orderNo = model.getOrderNo();
+ Integer status = model.getStatus() == null ? 0 : model.getStatus();
+ Date createdTimeStart = model.getCreatedTimeStart();
+ Date createdTimeEnd = model.getCreatedTimeEnd();
+ PageHelper.startPage(model.getPage(), model.getLimit());
+ List<QueryOrderListVo> maps = scoreOrderMapper.queryOrderList(name,orderNo,status,createdTimeStart,createdTimeEnd);
+ PageInfo pageInfo = new PageInfo(maps);
+ int count = Convert.toInt(pageInfo.getTotal());
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", maps);
+ map.put("count", count);
+ map.put("code", 0);
+ return map;
+ }
+
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryOrderListVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryOrderListVo.java
new file mode 100644
index 0000000..94aa9e7
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryOrderListVo.java
@@ -0,0 +1,9 @@
+package com.xzx.gc.shop.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "QueryOrderListVo", description = "返回")
+public class QueryOrderListVo {
+}
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
new file mode 100644
index 0000000..5b9675b
--- /dev/null
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xzx.gc.shop.mapper.ScoreOrderMapper">
+
+ <select id="queryOrderList" resultType="com.xzx.gc.shop.vo.QueryOrderListVo">
+ SELECT
+ *
+ FROM
+ xzx_score_order a
+ WHERE 1 = 1
+ <if test="orderNo != null and orderNo != ''">
+ and a.order_no like concat('%',#{orderNo},'%')
+ </if>
+ order by a.CREATED_TIME desc
+ </select>
+
+</mapper>
--
Gitblit v1.9.1