Kaynağa Gözat

修复仓库订单列表的bug

mac 2 yıl önce
ebeveyn
işleme
d8cd0fc6ba

+ 5 - 7
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/dto/kxsapp/storeOrder/StoreOrderListDTO.java

@@ -6,6 +6,8 @@ import jakarta.validation.constraints.Min;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
+import java.util.List;
+
 
 /**
  * 订单管理-订单列表-dto
@@ -17,20 +19,15 @@ import lombok.Data;
 public class StoreOrderListDTO {
 
     /**
-     * 品牌ID
+     * 所有仓库ID
      */
-    @Schema(description = "品牌ID")
-    @NotNull(message = "品牌ID不能为空")
-    @Min(value = 1)
-    private Integer brandId;
+    private List<Integer> whsIds;
 
 
     /**
      * 仓库ID
      */
     @Schema(description = "仓库ID")
-    @NotNull(message = "仓库ID不能为空")
-    @Min(value = 1)
     private Integer warehouseId;
 
 
@@ -38,6 +35,7 @@ public class StoreOrderListDTO {
      * 订单状态 0待审核 1申请成功 2已驳回
      */
     @Schema(description = "订单状态 0待审核 1申请成功 2已驳回")
+    @NotNull(message = "状态不能为空")
     private Integer status;
 
 

+ 2 - 2
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/storeOrder/StoreOrderListVO.java

@@ -118,12 +118,12 @@ public class StoreOrderListVO implements Serializable {
      * 品牌id
      */
     @Schema(description = "品牌id")
-    private Long brandId;
+    private Integer brandId;
 
     /**
      * 品牌
      */
-    private Long brandName;
+    private String brandName;
 
 
 

+ 1 - 1
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/mapper/KxsMachineApplyMapper.java

@@ -30,7 +30,7 @@ public interface KxsMachineApplyMapper extends BaseMapper<KxsMachineApply> {
      * @param param 参数
      * @return {@link IPage}<{@link StoreOrderListVO}>
      */
-    IPage<StoreOrderListVO> getByPage(Page<StoreOrderListVO> page, @Param("query") StoreOrderListDTO param,@Param("userId") Long userId);
+    IPage<StoreOrderListVO> getByPage(Page<StoreOrderListVO> page, @Param("query") StoreOrderListDTO param);
 
     /**
      * 发货统计

+ 8 - 2
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsMachineApplyServiceImpl.java

@@ -391,8 +391,14 @@ public class KxsMachineApplyServiceImpl extends ServiceImpl<KxsMachineApplyMappe
 
     @Override
     public IPage<StoreOrderListVO> getByPage(Page<StoreOrderListVO> page, StoreOrderListDTO param) {
-        Long userId = SecurityUtils.getUser().getId();
-        IPage<StoreOrderListVO> byPage = baseMapper.getByPage(page, param, userId);
+        //查询用户下的所有仓库
+        if(param.getWarehouseId() == null || param.getWarehouseId() == 0){
+            Long userId = SecurityUtils.getUser().getId();
+            List<KxsWarehouse> kxsWarehouses = kxsWarehouseMapper.selectList(Wrappers.<KxsWarehouse>lambdaQuery().eq(KxsWarehouse::getUserId, userId));
+            param.setWhsIds(kxsWarehouses.stream().map(KxsWarehouse::getId).collect(Collectors.toList()));
+        }
+
+        IPage<StoreOrderListVO> byPage = baseMapper.getByPage(page, param);
         //如果已完成的订单才去查询机具号
         for (StoreOrderListVO orderListVo : byPage.getRecords()) {
             if (Objects.equals(orderListVo.getStatus(), MachineOrderStatusEnum.APPLY_SUCCESSFUL.getType())) {

+ 33 - 29
kxs-store/kxs-store-biz/src/main/resources/mapper/KxsMachineApplyMapper.xml

@@ -3,46 +3,50 @@
 <mapper namespace="com.kxs.store.biz.mapper.KxsMachineApplyMapper">
 
     <resultMap type="com.kxs.store.api.model.KxsMachineApply" id="KxsMachineApplyMap">
-        <result column="id" property="id" />
-        <result column="create_time" property="createTime" />
-        <result column="update_time" property="updateTime" />
-        <result column="del_flag" property="delFlag" />
-        <result column="version" property="version" />
-        <result column="order_sn" property="orderSn" />
-        <result column="user_id" property="userId" />
-        <result column="brand_id" property="brandId" />
-        <result column="brand_name" property="brandName" />
-        <result column="warehouse_id" property="warehouseId" />
-        <result column="get_mode" property="getMode" />
-        <result column="apply_num" property="applyNum" />
-        <result column="contacts" property="contacts" />
-        <result column="phone" property="phone" />
-        <result column="address" property="address" />
-        <result column="apply_type" property="applyType" />
-        <result column="status" property="status" />
-        <result column="top_user_id" property="topUserId" />
-        <result column="is_advance" property="isAdvance" />
-        <result column="remark" property="remark" />
-        <result column="username" property="username" />
-        <result column="user_code" property="userCode" />
-        <result column="partner_id" property="partnerId" />
+        <result column="id" property="id"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="del_flag" property="delFlag"/>
+        <result column="version" property="version"/>
+        <result column="order_sn" property="orderSn"/>
+        <result column="user_id" property="userId"/>
+        <result column="brand_id" property="brandId"/>
+        <result column="brand_name" property="brandName"/>
+        <result column="warehouse_id" property="warehouseId"/>
+        <result column="get_mode" property="getMode"/>
+        <result column="apply_num" property="applyNum"/>
+        <result column="contacts" property="contacts"/>
+        <result column="phone" property="phone"/>
+        <result column="address" property="address"/>
+        <result column="apply_type" property="applyType"/>
+        <result column="status" property="status"/>
+        <result column="top_user_id" property="topUserId"/>
+        <result column="is_advance" property="isAdvance"/>
+        <result column="remark" property="remark"/>
+        <result column="username" property="username"/>
+        <result column="user_code" property="userCode"/>
+        <result column="partner_id" property="partnerId"/>
 
     </resultMap>
     <select id="getByPage" resultType="com.kxs.store.api.vo.kxsapp.storeOrder.StoreOrderListVO">
-        select a.id, a.create_time, a.order_sn, a.get_mode, a.apply_num, a.contacts, a.phone, a.address, a.apply_type, a.status, a.username, a.user_code, a.brand_id, a.brand_name from kxs_machine_apply a
+        select a.id, a.create_time, a.order_sn, a.get_mode, a.apply_num, a.contacts, a.phone, a.address, a.apply_type,
+        a.status, a.username, a.user_code, a.brand_id, a.brand_name from kxs_machine_apply a
         <where>
-            and user_id = #{userId}
-            <if test="query.brandId != null and query.brandId != 0">
-                and a.brand_id = #{query.brandId}
+            <if test="query.whsIds != null and query.whsIds.size() > 0">
+                and warehouse_id in
+                <foreach item="whsId" collection="query.whsIds" open="(" separator="," close=")">
+                    #{whsId}
+                </foreach>
             </if>
-            <if test="query.warehouseId != null and query.brandId != 0">
+            <if test="query.warehouseId != null and query.warehouseId > 0">
                 and a.warehouse_id = #{query.warehouseId}
             </if>
             <if test="query.status != null">
                 and a.status = #{query.status}
             </if>
             <if test="query.keyword != null and query.keyword != ''">
-                and (a.contacts like concat('%', #{query.keyword}, '%') or a.phone like concat('%', #{query.keyword}, '%'))
+                and (a.contacts like concat('%', #{query.keyword}, '%') or a.phone like concat('%', #{query.keyword},
+                '%'))
             </if>
         </where>
     </select>