字典树接口
This commit is contained in:
@@ -19,6 +19,7 @@ import com.njcn.user.pojo.param.FunctionParam;
|
|||||||
import com.njcn.user.pojo.po.Function;
|
import com.njcn.user.pojo.po.Function;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -83,7 +84,17 @@ public class DicServiceImpl extends ServiceImpl<DicMapper, Dic> implements IDicS
|
|||||||
public List<DicVO> getDicTree(String code) {
|
public List<DicVO> getDicTree(String code) {
|
||||||
List<DicVO> list = dicMapper.getAllDic();
|
List<DicVO> list = dicMapper.getAllDic();
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.filter(fun -> Objects.equals(TemplateTreeEnum.FATHER_PID,fun.getPid())&&fun.getCode().equals(code))
|
.filter(fun -> {
|
||||||
|
boolean flag =true;
|
||||||
|
boolean flag1 =true;
|
||||||
|
flag = Objects.equals(TemplateTreeEnum.FATHER_PID,fun.getPid());
|
||||||
|
if(!StringUtils.isEmpty(code)){
|
||||||
|
flag1 = fun.getCode().equals(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag&&flag1;
|
||||||
|
|
||||||
|
})
|
||||||
.peek(funS -> funS.setChildren(getChildList(funS, list)))
|
.peek(funS -> funS.setChildren(getChildList(funS, list)))
|
||||||
.sorted(Comparator.comparingInt(DicVO::getSort))
|
.sorted(Comparator.comparingInt(DicVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user