From 7a96bee5cc1fbf601db584b223a74ffc96b55047 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 18 Aug 2021 14:39:27 +0800
Subject: [PATCH] 20210818

---
 gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryOrderListDto.java   |    9 ++++
 gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreOrderMapper.java |    9 +++-
 gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java    |   17 +++++++-
 gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml        |   26 +++++++++++--
 4 files changed, 51 insertions(+), 10 deletions(-)

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
index 24cbe1f..fafab47 100644
--- 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
@@ -5,6 +5,7 @@
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class QueryOrderListDto {
@@ -15,8 +16,14 @@
     @ApiModelProperty(value="客户姓名")
     private String name;
 
+    @ApiModelProperty(value="排序字段 1:客户名称 2:下单时间")
+    private Integer namePx;
+
+    @ApiModelProperty(value="排序方式 1: asc  ,  2 :aesc")
+    private Integer typePx;
+
     @ApiModelProperty(value="状态 1-待发货2-待收货3-已收货4-已完成5-已评价6-已取消")
-    private Integer status;
+    private List<Integer> status;
 
     @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     @ApiModelProperty(value="下单时间开始时间")
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 3234fe7..a374f8f 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,6 @@
 package com.xzx.gc.shop.mapper;
 
 import com.xzx.gc.entity.ScoreOrder;
-import com.xzx.gc.shop.dto.QueryOrderListDto;
 import com.xzx.gc.shop.dto.XcxOrderListDto;
 import com.xzx.gc.shop.vo.QueryOrderListVo;
 import com.xzx.gc.shop.vo.XcxOrderDetailsVo;
@@ -16,10 +15,13 @@
 public interface ScoreOrderMapper extends GcMapper<ScoreOrder> {
 
     List<QueryOrderListVo> queryOrderList(@Param("name")String name,
+                                          @Param("accountName")String accountName,
                                           @Param("orderNo")String orderNo,
-                                          @Param("status")Integer status,
+                                          @Param("status") List status,
                                           @Param("createdTimeStart")Date createdTimeStart,
-                                          @Param("createdTimeEnd")Date createdTimeEnd);
+                                          @Param("createdTimeEnd")Date createdTimeEnd,
+                                          @Param("namePx")Integer namePx,
+                                          @Param("typePx")Integer typePx);
 
     List<XcxOrderListVo> selectXcxOrderList(@Param("record") XcxOrderListDto xcxOrderListDto);
 
@@ -30,4 +32,5 @@
     Map<String, Object> selectOrderStastics(@Param("userId") String userId);
 
     Integer selectScoreOrderCnt(@Param("userId") String userId);
+
 }
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
index f0f17d6..dd4d79c 100644
--- 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
@@ -61,13 +61,26 @@
     private IdUtils idUtils;
 
     public Map<String, Object> queryOrderList(QueryOrderListDto model) {
+        String accountName = model.getName();
         String name = StrUtil.isEmpty(model.getName())?model.getName():StringUtils.encode(model.getName());
         String orderNo = model.getOrderNo();
-        Integer status = model.getStatus() == null ? 0 : model.getStatus();
+        List<Integer> status = new ArrayList<>();
+        if(CollUtil.isNotEmpty(status)){
+            status = model.getStatus();
+        }else{
+            status.add(1);
+            status.add(2);
+            status.add(3);
+            status.add(4);
+            status.add(5);
+            status.add(6);
+        }
         Date createdTimeStart = model.getCreatedTimeStart();
         Date createdTimeEnd = model.getCreatedTimeEnd();
         PageHelper.startPage(model.getPage(), model.getLimit());
-        List<QueryOrderListVo> maps = scoreOrderMapper.queryOrderList(name,orderNo,status,createdTimeStart,createdTimeEnd);
+        Integer namePx = model.getNamePx() == null ? 2 : model.getNamePx();
+        Integer typePx = model.getTypePx() == null ? 2 : model.getTypePx();
+        List<QueryOrderListVo> maps = scoreOrderMapper.queryOrderList(name,accountName,orderNo,status,createdTimeStart,createdTimeEnd,namePx,typePx);
         if(CollUtil.isNotEmpty(maps)){
             for(QueryOrderListVo queryOrderListVo : maps){
                 String decode = StringUtils.decode(queryOrderListVo.getName());
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
index 662b086..41526d6 100644
--- a/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreOrderMapper.xml
@@ -21,10 +21,14 @@
         </if>
 
         <if test="name != null and name != ''">
-            and b.nick_name like concat('%',#{name},'%')
+            and (b.nick_name like concat('%',#{name},'%')
+                     or b.mobile_phone like concat('%',#{accountName},'%') )
         </if>
-        <if test="status != null and status != ''">
-            and a.status = #{status}
+        <if test="status.size > 0">
+            and a.status in
+            <foreach collection="status" item="sta" open="(" separator="," close=")">
+                #{sta}
+            </foreach>
         </if>
         <if test="createdTimeStart != null">
             and a.CREATED_TIME >= #{createdTimeStart}
@@ -33,7 +37,21 @@
         <if test="createdTimeEnd != null">
             and a.CREATED_TIME &lt;= #{createdTimeEnd}
         </if>
-        order by a.CREATED_TIME desc
+        order by
+            <if test="namePx != null and namePx != '' and namePx == 1">
+                a.CREATED_TIME
+            </if>
+            <if test="namePx != null and namePx != '' and namePx == 2">
+                from_base64(b.nick_name)
+            </if>
+
+            <if test="typePx != null and typePx != '' and typePx == 1">
+                asc
+            </if>
+            <if test="typePx != null and typePx != '' and typePx == 2">
+                desc
+            </if>
+
     </select>
 
     <select id="selectXcxOrderList" resultType="com.xzx.gc.shop.vo.XcxOrderListVo">

--
Gitblit v1.9.1