Bladeren bron

订单搜索

chao 3 jaren geleden
bovenliggende
commit
7f6ba485ab

+ 39 - 0
src/main/java/com/caimei365/order/controller/OrderClubApi.java

@@ -4,6 +4,7 @@ import com.caimei365.order.model.ResponseJson;
 import com.caimei365.order.model.dto.OrderDto;
 import com.caimei365.order.model.dto.OrderDto;
 import com.caimei365.order.model.vo.AddressVo;
 import com.caimei365.order.model.vo.AddressVo;
 import com.caimei365.order.model.vo.OrderVo;
 import com.caimei365.order.model.vo.OrderVo;
+import com.caimei365.order.model.vo.SearchHistoryVo;
 import com.caimei365.order.service.OrderClubService;
 import com.caimei365.order.service.OrderClubService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -11,8 +12,11 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
+
 /**
 /**
  * 机构订单API
  * 机构订单API
  *
  *
@@ -51,6 +55,28 @@ public class OrderClubApi {
         return orderClubService.getOrderList(userId, orderState, orderNo, beginTime, endTime, pageNum, pageSize);
         return orderClubService.getOrderList(userId, orderState, orderNo, beginTime, endTime, pageNum, pageSize);
     }
     }
 
 
+    /**
+     * 根据关键词搜索订单
+     */
+    @ApiOperation("根据关键词搜索订单(旧:/order/search)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "userId", value = "用户Id"),
+            @ApiImplicitParam(required = false, name = "searchWord", value = "搜索关键词"),
+            @ApiImplicitParam(required = false, name = "pageNum", value = "页码"),
+            @ApiImplicitParam(required = false, name = "pageSize", value = "每页数量")
+    })
+    @GetMapping("/search")
+    public ResponseJson<PageInfo<OrderVo>> getOrderListByKeyword(Integer userId, String searchWord,
+                                                        @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                        @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == userId) {
+            return ResponseJson.error("用户Id不能为空!", null);
+        }
+        if (StringUtils.isEmpty(searchWord)) {
+            return ResponseJson.error("请输入搜索关键词!", null);
+        }
+        return orderClubService.getOrderListByKeyword(userId, searchWord, pageNum, pageSize);
+    }
 
 
     /**
     /**
      * 机构确认订单
      * 机构确认订单
@@ -117,4 +143,17 @@ public class OrderClubApi {
         return orderClubService.receiveGoods(orderDto.getOrderId());
         return orderClubService.receiveGoods(orderDto.getOrderId());
     }
     }
 
 
+    /**
+     * 根据用户Id查找订单搜索历史记录
+     */
+    @ApiOperation("根据用户Id查找订单搜索历史记录(旧:/order/searchHistory)")
+    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @GetMapping("/search/history")
+    public ResponseJson<List<SearchHistoryVo>> getOrderSearchHistory(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("用户Id不能为空!", null);
+        }
+        return orderClubService.getOrderSearchHistory(userId);
+    }
+
 }
 }

+ 36 - 0
src/main/java/com/caimei365/order/mapper/OrderClubMapper.java

@@ -111,6 +111,12 @@ public interface OrderClubMapper {
      * @param endTime    截止时间
      * @param endTime    截止时间
      */
      */
     List<OrderVo> getOrderList(Integer userId, Integer orderState, String orderNo, String beginTime, String endTime);
     List<OrderVo> getOrderList(Integer userId, Integer orderState, String orderNo, String beginTime, String endTime);
+    /**
+     * 根据关键词搜索订单
+     * @param searchWord 关键词
+     * @param userId     用户Id
+     */
+    List<OrderVo> getOrderListByKeyword(String searchWord, Integer userId);
     /**
     /**
      * 查询订单发货次数
      * 查询订单发货次数
      * @param orderId 订单Id
      * @param orderId 订单Id
@@ -151,4 +157,34 @@ public interface OrderClubMapper {
      * @param orderId 订单Id
      * @param orderId 订单Id
      */
      */
     List<Double> getShouldPayShopAmountList(Integer orderId);
     List<Double> getShouldPayShopAmountList(Integer orderId);
+    /**
+     * 查询关键字历史记录是否存在
+     * @param searchWord 关键字
+     */
+    Integer getSearchHistoryIdByWord(String searchWord);
+    /**
+     * 更新搜索关键词历史记录
+     * @param historyRecord SearchHistoryVo
+     */
+    void updateSearchHistory(SearchHistoryVo historyRecord);
+    /**
+     * 新增搜索关键词历史记录
+     * @param historyRecord SearchHistoryVo
+     */
+    void insertSearchHistory(SearchHistoryVo historyRecord);
+    /**
+     * 统计搜索关键词数量
+     * @param userId 用户Id
+     */
+    int countSearchHistory(Integer userId);
+    /**
+     * 只保留10条的搜索关键词历史记录
+     * @param userId 用户Id
+     */
+    void deleteSearchHistoryLimit(Integer userId);
+    /**
+     * 根据用户Id查找订单搜索历史记录
+     * @param userId 用户Id
+     */
+    List<SearchHistoryVo> getOrderSearchHistory(Integer userId);
 }
 }

+ 34 - 0
src/main/java/com/caimei365/order/model/vo/SearchHistoryVo.java

@@ -0,0 +1,34 @@
+package com.caimei365.order.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/21
+ */
+@Data
+public class SearchHistoryVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+    /**
+     * 搜索关键词
+     */
+    private String searchWord;
+    /**
+     * 搜索时间
+     */
+    private Date searchDate;
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private Integer delFlag;
+}

+ 16 - 5
src/main/java/com/caimei365/order/service/OrderClubService.java

@@ -2,9 +2,12 @@ package com.caimei365.order.service;
 
 
 import com.caimei365.order.model.ResponseJson;
 import com.caimei365.order.model.ResponseJson;
 import com.caimei365.order.model.vo.OrderVo;
 import com.caimei365.order.model.vo.OrderVo;
+import com.caimei365.order.model.vo.SearchHistoryVo;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
 
 
+import java.util.List;
+
 /**
 /**
  * Description
  * Description
  *
  *
@@ -24,6 +27,14 @@ public interface OrderClubService {
      * @param pageSize   每页数量
      * @param pageSize   每页数量
      */
      */
     ResponseJson<PageInfo<OrderVo>> getOrderList(Integer userId, Integer orderState, String orderNo, String beginTime, String endTime, int pageNum, int pageSize);
     ResponseJson<PageInfo<OrderVo>> getOrderList(Integer userId, Integer orderState, String orderNo, String beginTime, String endTime, int pageNum, int pageSize);
+    /**
+     * 根据关键词搜索订单
+     * @param userId     用户Id
+     * @param searchWord 搜索关键词
+     * @param pageNum    页码
+     * @param pageSize   每页数量
+     */
+    ResponseJson<PageInfo<OrderVo>> getOrderListByKeyword(Integer userId, String searchWord, int pageNum, int pageSize);
     /**
     /**
      * 机构确认订单
      * 机构确认订单
      * @param orderId 订单Id
      * @param orderId 订单Id
@@ -45,9 +56,9 @@ public interface OrderClubService {
      * @param orderId 订单Id
      * @param orderId 订单Id
      */
      */
     ResponseJson<Void> receiveGoods(Integer orderId);
     ResponseJson<Void> receiveGoods(Integer orderId);
-
-
-
-
-
+    /**
+     * 根据用户Id查找订单搜索历史记录
+     * @param userId     用户Id
+     */
+    ResponseJson<List<SearchHistoryVo>> getOrderSearchHistory(Integer userId);
 }
 }

+ 134 - 51
src/main/java/com/caimei365/order/service/impl/OrderClubServiceImpl.java

@@ -65,64 +65,136 @@ public class OrderClubServiceImpl implements OrderClubService {
         // 分页请求数据
         // 分页请求数据
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<OrderVo> orderList = orderClubMapper.getOrderList(userId, orderState, orderNo, beginTime, endTime);
         List<OrderVo> orderList = orderClubMapper.getOrderList(userId, orderState, orderNo, beginTime, endTime);
-        for (OrderVo order : orderList) {
-            // 111, 待付待收待发
-            if (11 == order.getStatus() && 1 == order.getPayStatus()) {
-                order.setStatus(111);
-            }
-            // 判断交易全退情况下,是否发过货,77,交易全退可以查看物流
-            int logisticsCount = orderClubMapper.countLogisticsBatch(order.getOrderId());
-            if (7 == order.getStatus() && logisticsCount > 0) {
-                order.setStatus(77);
+        orderList.forEach(order -> {
+            // 设置订单状态
+            setOrderStatus(order);
+            // 设置子订单数据
+            getShopOrderData(order);
+            // 设置付款金额
+            getDiscernReceiptAndSetOrder(order);
+        });
+        PageInfo<OrderVo> pageInfo = new PageInfo(orderList);
+        return ResponseJson.success(pageInfo);
+    }
+
+    /**
+     * 根据关键词搜索订单
+     *
+     * @param userId     用户Id
+     * @param searchWord 搜索关键词
+     * @param pageNum    页码
+     * @param pageSize   每页数量
+     */
+    @Override
+    public ResponseJson<PageInfo<OrderVo>> getOrderListByKeyword(Integer userId, String searchWord, int pageNum, int pageSize) {
+        // 设置搜索关键词历史记录
+        setHistoryRecord(userId, searchWord);
+        PageHelper.startPage(pageNum, pageSize);
+        List<OrderVo> orderList = orderClubMapper.getOrderListByKeyword(searchWord, userId);
+        //获取主订单数据
+        orderList.forEach(order -> {
+            // 设置订单状态
+            setOrderStatus(order);
+            // 设置子订单数据
+            getShopOrderData(order);
+            // 设置付款金额
+            getDiscernReceiptAndSetOrder(order);
+        });
+        PageInfo<OrderVo> pageInfo = new PageInfo(orderList);
+        return ResponseJson.success(pageInfo);
+    }
+
+    /**
+     * 设置订单状态
+     */
+    private void setOrderStatus(OrderVo order) {
+        // 111, 待付待收待发
+        if (11 == order.getStatus() && 1 == order.getPayStatus()) {
+            order.setStatus(111);
+        }
+        // 判断交易全退情况下,是否发过货,77,交易全退可以查看物流
+        int logisticsCount = orderClubMapper.countLogisticsBatch(order.getOrderId());
+        if (7 == order.getStatus() && logisticsCount > 0) {
+            order.setStatus(77);
+        }
+        // 判断二手订单情况下,若部分付款和已付款,排除退货/款的情况,且未确认打款供应商,10,添加确认打款供应商按钮
+        if (1 == order.getSecondHandOrderFlag() && 0 == order.getRefundType() && 0 == order.getAffirmPaymentFlag()) {
+            if (order.getStatus().toString().startsWith("2") || order.getStatus().toString().startsWith("3")) {
+                // 之前是 “00”
+                order.setAffirmPaymentFlag(10);
             }
             }
-            // 判断二手订单情况下,若部分付款和已付款,排除退货/款的情况,且未确认打款供应商,10,添加确认打款供应商按钮
-            if (1 == order.getSecondHandOrderFlag() && 0 == order.getRefundType() && 0 == order.getAffirmPaymentFlag()) {
-                if (order.getStatus().toString().startsWith("2") || order.getStatus().toString().startsWith("3")) {
-                    // 之前是 “00”
-                    order.setAffirmPaymentFlag(10);
-                }
+        }
+    }
+
+    /**
+     * 设置子订单数据
+     */
+    private void getShopOrderData(OrderVo order) {
+        // 子订单
+        String[] shopOrderIdArr = order.getShopOrderIds().split(",");
+        List<String> shopOrderIds = Arrays.asList(shopOrderIdArr);
+        List<ShopOrderVo> shopOrderList = orderClubMapper.getShopOrderList(shopOrderIds);
+        shopOrderList.forEach(shopOrder -> {
+            // 店铺促销活动
+            PromotionsVo shopPromotion = null;
+            if (null != shopOrder.getOrderPromotionsId() && shopOrder.getOrderPromotionsId() > 0) {
+                shopPromotion = orderClubMapper.getOrderPromotionsById(shopOrder.getOrderPromotionsId());
+                shopOrder.setShopPromotion(shopPromotion);
             }
             }
-            // 子订单
-            String[] shopOrderIdArr = order.getShopOrderIds().split(",");
-            List<String> shopOrderIds = Arrays.asList(shopOrderIdArr);
-            List<ShopOrderVo> shopOrderList = orderClubMapper.getShopOrderList(shopOrderIds);
-            shopOrderList.forEach(shopOrder -> {
-                // 店铺促销活动
-                PromotionsVo shopPromotion = null;
-                if (null != shopOrder.getOrderPromotionsId() && shopOrder.getOrderPromotionsId() > 0) {
-                    shopPromotion = orderClubMapper.getOrderPromotionsById(shopOrder.getOrderPromotionsId());
-                    shopOrder.setShopPromotion(shopPromotion);
+            List<OrderProductVo> orderProductList = orderClubMapper.getShopOrderProduct(shopOrder.getShopOrderId());
+            for (OrderProductVo orderProduct : orderProductList) {
+                boolean taxFlag = (0 == orderProduct.getIncludedTax() && (1 == orderProduct.getInvoiceType() || 2 == orderProduct.getInvoiceType()));
+                if (taxFlag) {
+                    orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), orderProduct.getAddedValueTax()).doubleValue());
+                    orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getPrice(), orderProduct.getAddedValueTax()).doubleValue());
                 }
                 }
-                List<OrderProductVo> orderProductList = orderClubMapper.getShopOrderProduct(shopOrder.getShopOrderId());
-                for (OrderProductVo orderProduct : orderProductList) {
-                    boolean taxFlag = (0 == orderProduct.getIncludedTax() && (1 == orderProduct.getInvoiceType() || 2 == orderProduct.getInvoiceType()));
-                    if (taxFlag) {
-                        orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), orderProduct.getAddedValueTax()).doubleValue());
-                        orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getPrice(), orderProduct.getAddedValueTax()).doubleValue());
-                    }
-                    orderProduct.setImage(ImageUtil.getImageUrl("product", orderProduct.getImage(), domain));
-                    // 查询订单下商品的促销活动
-                    if (null != orderProduct.getOrderPromotionsId() && orderProduct.getOrderPromotionsId() > 0) {
-                        PromotionsVo promotions = orderClubMapper.getOrderPromotionsById(orderProduct.getOrderPromotionsId());
-                        if (null != promotions) {
-                            if (1 == promotions.getType() && 1 == promotions.getMode()) {
-                                promotions.setTouchPrice(MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), orderProduct.getTaxRate()), 100)).doubleValue());
-                            }
-                            orderProduct.setProductPromotion(promotions);
+                orderProduct.setImage(ImageUtil.getImageUrl("product", orderProduct.getImage(), domain));
+                // 查询订单下商品的促销活动
+                if (null != orderProduct.getOrderPromotionsId() && orderProduct.getOrderPromotionsId() > 0) {
+                    PromotionsVo promotions = orderClubMapper.getOrderPromotionsById(orderProduct.getOrderPromotionsId());
+                    if (null != promotions) {
+                        if (1 == promotions.getType() && 1 == promotions.getMode()) {
+                            promotions.setTouchPrice(MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), orderProduct.getTaxRate()), 100)).doubleValue());
                         }
                         }
+                        orderProduct.setProductPromotion(promotions);
                     }
                     }
                 }
                 }
-                shopOrder.setOrderProductList(orderProductList);
-                shopOrder.setShopLogo(ImageUtil.getImageUrl("shopLogo", shopOrder.getShopLogo(), domain));
-            });
-            // 过滤运费商品
-            shopOrderList.removeIf(shopOrder -> shopOrder.getShopId() == 998);
-            order.setShopOrderList(shopOrderList);
-            // 设置付款金额
-            getDiscernReceiptAndSetOrder(order);
+            }
+            shopOrder.setOrderProductList(orderProductList);
+            shopOrder.setShopLogo(ImageUtil.getImageUrl("shopLogo", shopOrder.getShopLogo(), domain));
+        });
+        // 过滤运费商品
+        shopOrderList.removeIf(shopOrder -> shopOrder.getShopId() == 998);
+        order.setShopOrderList(shopOrderList);
+    }
+
+    /**
+     * 设置搜索关键词历史记录
+     * @param userId 用户Id
+     * @param searchWord 搜索关键词
+     */
+    private void setHistoryRecord(Integer userId, String searchWord) {
+        // 初始化一个搜索关键词历史记录
+        SearchHistoryVo historyRecord = new SearchHistoryVo();
+        historyRecord.setUserId(userId);
+        historyRecord.setSearchDate(new Date());
+        historyRecord.setSearchWord(searchWord);
+        historyRecord.setDelFlag(0);
+        // 查询搜索关键词历史记录是否存在
+        Integer recordId = orderClubMapper.getSearchHistoryIdByWord(searchWord);
+        // 保存搜索关键词历史记录
+        if (null != recordId && recordId >0) {
+            historyRecord.setId(recordId);
+            orderClubMapper.updateSearchHistory(historyRecord);
+        } else {
+            orderClubMapper.insertSearchHistory(historyRecord);
+        }
+        // 查询关键字历史记录条数
+        int count = orderClubMapper.countSearchHistory(userId);
+        // 只保留10条的搜索关键词历史记录
+        if (count > 10) {
+            orderClubMapper.deleteSearchHistoryLimit(userId);
         }
         }
-        PageInfo<OrderVo> pageInfo = new PageInfo(orderList);
-        return ResponseJson.success(pageInfo);
     }
     }
 
 
     /**
     /**
@@ -424,4 +496,15 @@ public class OrderClubServiceImpl implements OrderClubService {
 
 
         return ResponseJson.success("确认收货成功!", null);
         return ResponseJson.success("确认收货成功!", null);
     }
     }
+
+    /**
+     * 根据用户Id查找订单搜索历史记录
+     *
+     * @param userId 用户Id
+     */
+    @Override
+    public ResponseJson<List<SearchHistoryVo>> getOrderSearchHistory(Integer userId) {
+        List<SearchHistoryVo> historyList = orderClubMapper.getOrderSearchHistory(userId);
+        return ResponseJson.success(historyList);
+    }
 }
 }

+ 85 - 0
src/main/resources/mapper/OrderClubMapper.xml

@@ -87,6 +87,25 @@
         SET status = 1, updateDate = NOW(), receiptTime = NOW()
         SET status = 1, updateDate = NOW(), receiptTime = NOW()
         WHERE orderID = #{orderId}
         WHERE orderID = #{orderId}
     </update>
     </update>
+    <update id="updateSearchHistory">
+        UPDATE user_order_history SET
+            userId = #{userId},
+            searchWord = #{searchWord},
+            searchDate = #{searchDate},
+            delFlag = #{delFlag}
+        WHERE id = #{id}
+    </update>
+    <delete id="deleteSearchHistoryLimit">
+        DELETE FROM user_order_history
+        WHERE userId=#{userId}
+        AND id NOT IN (
+            SELECT temp.id FROM (SELECT id FROM user_order_history WHERE userId=#{userId} ORDER BY id DESC LIMIT 10) AS temp
+        )
+    </delete>
+    <insert id="insertSearchHistory">
+        INSERT INTO user_order_history (userId, searchWord, searchDate, delFlag)
+        VALUES (#{userId}, #{searchWord}, #{searchDate}, #{delFlag})
+    </insert>
     <select id="getMainOrderByOrderId" resultType="com.caimei365.order.model.po.OrderPo">
     <select id="getMainOrderByOrderId" resultType="com.caimei365.order.model.po.OrderPo">
         SELECT
         SELECT
             orderSource,
             orderSource,
@@ -271,6 +290,56 @@
         </if>
         </if>
         ORDER BY orderTime DESC
         ORDER BY orderTime DESC
     </select>
     </select>
+    <select id="getOrderListByKeyword" resultType="com.caimei365.order.model.vo.OrderVo">
+        SELECT
+        co.orderSource,
+        co.orderNo,
+        co.userID AS userId,
+        co.clubID AS clubId,
+        co.buyUserID AS buyUserId,
+        co.orderTime,
+        co.updateDate,
+        co.delFlag,
+        co.userBeans,
+        co.orderType,
+        co.orderSubmitType,
+        co.confirmFlag,
+        co.onlinePayFlag,
+        co.splitFlag,
+        co.payFlag,
+        co.receiptStatus,
+        co.payStatus,
+        co.zeroCostFlag,
+        co.sendOutStatus,
+        co.refundType,
+        co.affirmPaymentFlag,
+        co.productCount,
+        co.presentCount,
+        co.promotionalGiftsCount,
+        co.hasActProduct,
+        co.promotionFullReduction,
+        co.secondHandOrderFlag,
+        co.invoiceFlag,
+        co.freePostFlag AS postageFlag,
+        co.freight AS postage,
+        co.productTotalFee,
+        co.orderTotalFee,
+        co.payTotalFee,
+        co.payableAmount,
+        co.balancePayFee,
+        co.status,
+        co.confirmTime,
+        co.payTime,
+        co.rebateFlag,
+        co.clauseID AS clauseId,
+        co.clauseName
+        FROM cm_order co
+        LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
+        WHERE delFlag = 0 AND userID = #{userId}
+        AND cop.name LIKE CONCAT('%',#{searchWord},'%')
+        GROUP BY co.orderID
+        ORDER BY co.orderTime DESC
+    </select>
     <select id="countLogisticsBatch" resultType="java.lang.Integer">
     <select id="countLogisticsBatch" resultType="java.lang.Integer">
         SELECT COUNT(*) FROM cm_logistics_batch WHERE orderID= #{orderId}
         SELECT COUNT(*) FROM cm_logistics_batch WHERE orderID= #{orderId}
     </select>
     </select>
@@ -416,4 +485,20 @@
     <select id="getShouldPayShopAmountList" resultType="java.lang.Double">
     <select id="getShouldPayShopAmountList" resultType="java.lang.Double">
         SELECT shouldPayShopAmount FROM cm_shop_order WHERE orderID = #{orderId} AND delFlag = '0'
         SELECT shouldPayShopAmount FROM cm_shop_order WHERE orderID = #{orderId} AND delFlag = '0'
     </select>
     </select>
+    <select id="getSearchHistoryIdByWord" resultType="java.lang.Integer">
+        SELECT id FROM user_order_history
+        WHERE searchWord = #{searchWord}
+        ORDER BY id DESC
+        LIMIT 1
+    </select>
+    <select id="countSearchHistory" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM user_order_history WHERE userId = #{userId}
+    </select>
+    <select id="getOrderSearchHistory" resultType="com.caimei365.order.model.vo.SearchHistoryVo">
+        SELECT id, userId, searchWord, searchDate, delFlag
+        FROM user_order_history
+        WHERE userId = #{userId}
+        ORDER BY id DESC
+    </select>
+
 </mapper>
 </mapper>