소스 검색

仓库可视化优化

3254194295 9 달 전
부모
커밋
6c4c39a451

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/dto/sqarepartmanage/SparePartInfoDTO.java

@@ -28,6 +28,7 @@ import java.util.List;
 @EqualsAndHashCode(callSuper = true)
 public class SparePartInfoDTO extends BaseDTO implements Serializable {
 
+
     private Integer oldOrNew;
     /**
      * 是否专用备件

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sqarepartmanage/SparePartInfoMapper.java

@@ -20,6 +20,7 @@ import java.util.List;
  */
 @Component
 public interface SparePartInfoMapper extends MyMapper<SparePartInfo> {
+    List<SparePartInfoVO> getByCondition(SparePartInfoDTO sparePartInfoDTO);
     /**
      * 分页查询
      * @param dto

+ 14 - 0
platform-dao/src/main/resources/mapper/sqarepartmanage/SparePartInfoMapper.xml

@@ -363,4 +363,18 @@ store.`spare_id`=info.`id`
 WHERE  info.`parent_id`=#{typeId}
 and store.store_id=#{storeId}
     </select>
+
+    <select id="getByCondition"  parameterType="com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO"
+            resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
+        select info.*,sum(spareStore.num) as totalNum from t_spare_part_info info left join t_spare_store spareStore on spareStore.spare_id = info.id
+        <where>
+            <if test="storeId!=null and storeId!=''">
+                and spareStore.store_id=#{storeId}
+            </if>
+            <if test="typeId!=null and typeId!=''">
+                and info.type_id=#{typeId}
+            </if>
+            group by info.id
+        </where>
+    </select>
 </mapper>

+ 5 - 0
platform-rest/src/main/java/com/platform/rest/controller/sqarepartmanage/SparePartInfoController.java

@@ -57,6 +57,11 @@ public class SparePartInfoController {
         return new R<>(sparePartInfoService.getModelById(id));
     }
 
+    @GetMapping("/store")
+    public R<List<SparePartInfoVO>> getByCondition(SparePartInfoDTO sparePartInfoDTO) {
+        return new R<>(sparePartInfoService.getByCondition(sparePartInfoDTO));
+    }
+
     /**
      * 批量查询记录
      *

+ 1 - 0
platform-rest/src/main/java/com/platform/rest/controller/store/SpareStoreController.java

@@ -60,6 +60,7 @@ public class SpareStoreController {
         return new R<>(spareStoreService.getDetail(id));
     }
 
+
     /**
      * 新增记录
      *

+ 1 - 0
platform-rest/src/main/java/com/platform/rest/controller/store/StoreController.java

@@ -71,6 +71,7 @@ public class StoreController {
       return new R<>(storeService.getById(id));
   }
 
+
   /**
    * 新增记录
    *

+ 1 - 0
platform-service/src/main/java/com/platform/service/sqarepartmanage/SparePartInfoService.java

@@ -21,6 +21,7 @@ import java.util.List;
  * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
  */
 public interface SparePartInfoService extends IBaseService<SparePartInfo, SparePartInfoDTO> {
+    List<SparePartInfoVO> getByCondition(SparePartInfoDTO sparePartInfoDTO);
 
    /**
     * 批量删除

+ 6 - 0
platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java

@@ -101,6 +101,12 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
     private FirmProducerMapper firmProducerMapper;
 
 
+    @Override
+    public List<SparePartInfoVO> getByCondition(SparePartInfoDTO sparePartInfoDTO) {
+        List<SparePartInfoVO> sparePartInfoVOS = mapper.getByCondition(sparePartInfoDTO);
+        return sparePartInfoVOS;
+    }
+
     @Override
     public int batchDelete(List<String> ids) {