提交 3306f2a2 authored 作者: zjm's avatar zjm

fix(库房模块): 添加查询所有库房的service

添加查询所有库房的service
上级 8121a990
...@@ -10,6 +10,8 @@ import java.util.List; ...@@ -10,6 +10,8 @@ import java.util.List;
public interface UnitStoreLocationDao extends JpaRepository<UnitStoreLocation, Integer>, JpaSpecificationExecutor<UnitStoreLocation> { public interface UnitStoreLocationDao extends JpaRepository<UnitStoreLocation, Integer>, JpaSpecificationExecutor<UnitStoreLocation> {
List<UnitStoreLocation> findAllByUnitIdAndTypeName(Integer unitId,String typeName); List<UnitStoreLocation> findAllByUnitIdAndTypeName(Integer unitId,String typeName);
List<UnitStoreLocation> findAllByTypeName(String typeName);
List<UnitStoreLocation> findAllByIdIn(List<Integer> ids); List<UnitStoreLocation> findAllByIdIn(List<Integer> ids);
boolean existsByStoreNameAndUnitId(String name,Integer unitId); boolean existsByStoreNameAndUnitId(String name,Integer unitId);
......
...@@ -17,8 +17,11 @@ import java.util.Set; ...@@ -17,8 +17,11 @@ import java.util.Set;
public interface UnitStoreLocationService extends PublicService<UnitStoreLocation>{ public interface UnitStoreLocationService extends PublicService<UnitStoreLocation>{
List<UnitStoreLocation> findAllByUnitIdAndTypeName(UnitStoreLocationVo unitStoreLocationVo); List<UnitStoreLocation> findAllByUnitIdAndTypeName(UnitStoreLocationVo unitStoreLocationVo);
Map<Integer,String> findByUnitIdToDeviceMap(Integer unitId); Map<Integer,String> findByUnitIdToDeviceMap(Integer unitId);
Map<Integer,String> findToDeviceMap();
/** /**
* 根据id查询名称 * 根据id查询名称
* @param ids id集合 * @param ids id集合
......
...@@ -35,11 +35,18 @@ public class UnitStoreLocationServiceImpl implements UnitStoreLocationService { ...@@ -35,11 +35,18 @@ public class UnitStoreLocationServiceImpl implements UnitStoreLocationService {
} }
@Override @Override
public Map<Integer, String> findByUnitIdToDeviceMap(Integer unitId) { public Map<Integer,String> findByUnitIdToDeviceMap(Integer unitId) {
return unitStoreLocationDao.findAllByUnitIdAndTypeName(unitId,"存放位置") return unitStoreLocationDao.findAllByUnitIdAndTypeName(unitId,"存放位置")
.stream() .stream()
.sorted(Comparator.comparing(UnitStoreLocation::getShowOrder)) .collect(Collectors.toMap(UnitStoreLocation::getId,UnitStoreLocation::getStoreName));
}
@Override
public Map<Integer, String> findToDeviceMap() {
return unitStoreLocationDao.findAllByTypeName("存放位置")
.stream()
.collect(Collectors.toMap(UnitStoreLocation::getId,UnitStoreLocation::getStoreName)); .collect(Collectors.toMap(UnitStoreLocation::getId,UnitStoreLocation::getStoreName));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论