提交 ed83577e authored 作者: zjm's avatar zjm

fix(单位模块): 添加根据单位id查询下级单位对象

添加根据单位id查询下级单位对象
上级 b5ee39c8
...@@ -42,6 +42,14 @@ public class UnitsCache { ...@@ -42,6 +42,14 @@ public class UnitsCache {
return new ArrayList<>(idMap.values()).stream().filter(units -> units.getExhibitionId().equals(areaExhibitionId)).collect(Collectors.toList()); return new ArrayList<>(idMap.values()).stream().filter(units -> units.getExhibitionId().equals(areaExhibitionId)).collect(Collectors.toList());
} }
/**
* 根据当前单位id查询下级以及本级
*/
public List<Units> findByIdSubordinateAndOneself(Integer unitId){
Units units=idMap.get(unitId);
return new ArrayList<>(idMap.values()).stream().filter(units1 -> units1.getExhibitionId().equals(units.getExhibitionId())).collect(Collectors.toList());
}
/** /**
* 查询大于等新序号,小于原序号 * 查询大于等新序号,小于原序号
* @return * @return
......
...@@ -174,10 +174,10 @@ public class UnitsController { ...@@ -174,10 +174,10 @@ public class UnitsController {
/** /**
* 查询添加单位中所有单位的下拉列表 * 查询添加单位中所有单位的下拉列表
*/ */
@GetMapping("/belongsUnits") @GetMapping("/belongsUnits/{unitId}")
@ApiOperation(value = "[单位管理]查询添加单位中所属单位的下拉列表", notes = "查询添加单位中所属单位的下拉列表") @ApiOperation(value = "[单位管理]查询添加单位中所属单位的下拉列表", notes = "查询添加单位中所属单位的下拉列表")
public ResponseEntity belongsUnits(){ public ResponseEntity belongsUnits(@PathVariable Integer unitId){
return ResponseEntity.ok(unitsService.belongsUnits()); return ResponseEntity.ok(unitsService.belongsUnits(unitId));
} }
/** /**
......
...@@ -203,7 +203,7 @@ public interface UnitsService extends PublicService<Units> { ...@@ -203,7 +203,7 @@ public interface UnitsService extends PublicService<Units> {
/** /**
* 添加单位所有单位列表 * 添加单位所有单位列表
*/ */
List<Units> belongsUnits(); List<Units> belongsUnits(Integer unitId);
/** /**
* 更新单位对象 * 更新单位对象
......
...@@ -509,8 +509,8 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -509,8 +509,8 @@ public class UnitsServiceImpl implements UnitsService {
} }
@Override @Override
public List<Units> belongsUnits() { public List<Units> belongsUnits(Integer unitId) {
return unitsDao.findAll().stream().filter(units -> units.getLevel()==1 || units.getLevel()==2).sorted(Comparator.comparing(Units::getShowOrder)).collect(Collectors.toList()); return unitsDao.findAll().stream().filter(units -> (units.getLevel()==1 || units.getLevel()==2)&& !units.getUnitId().equals(unitId)).sorted(Comparator.comparing(Units::getShowOrder)).collect(Collectors.toList());
} }
private Units findByParentUnit(Units units){ private Units findByParentUnit(Units units){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论