树形查询子节点优化
This commit is contained in:
parent
965ef50b86
commit
c058749afd
|
@ -79,7 +79,8 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
|||
private LambdaQueryWrapper<SysCatalogTextbook> buildQueryWrapper(SysCatalogTextbookBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysCatalogTextbook> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getParentId() != null, SysCatalogTextbook::getParentId, bo.getParentId());
|
||||
//lqw.eq(bo.getParentId() != null, SysCatalogTextbook::getParentId, bo.getParentId());
|
||||
lqw.like(bo.getParentId() != null, SysCatalogTextbook::getAncestors, bo.getParentId());
|
||||
lqw.le(bo.getType() != null, SysCatalogTextbook::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
|
@ -96,7 +97,11 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
|||
SysCatalogTextbook add = MapstructUtils.convert(bo, SysCatalogTextbook.class);
|
||||
add.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + add.getParentId());
|
||||
String[] split = StringUtils.split(add.getAncestors(), StringUtils.SEPARATOR);
|
||||
add.setType(split.length);
|
||||
if (split.length < 7) {
|
||||
add.setType(split.length);
|
||||
} else {
|
||||
add.setType(7);
|
||||
}
|
||||
return baseMapper.insert(add) > 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue