diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictBizController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictBizController.java index bd487fdd..98979c25 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictBizController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictBizController.java @@ -102,8 +102,8 @@ public class DictBizController extends BladeController { }) @ApiOperationSupport(order = 4) @ApiOperation(value = "列表", notes = "传入dict") - public R> childList(@ApiIgnore @RequestParam Map dict, @RequestParam(required = false, defaultValue = "-1") Long parentId, Query query) { - return R.data(dictService.childList(dict, parentId, query)); + public R> childList(@ApiIgnore @RequestParam Map dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) { + return R.data(dictService.childList(dict, parentId)); } /** diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java index 03a51872..d6fc0cf5 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java @@ -104,8 +104,8 @@ public class DictController extends BladeController { }) @ApiOperationSupport(order = 4) @ApiOperation(value = "列表", notes = "传入dict") - public R> childList(@ApiIgnore @RequestParam Map dict, @RequestParam(required = false, defaultValue = "-1") Long parentId, Query query) { - return R.data(dictService.childList(dict, parentId, query)); + public R> childList(@ApiIgnore @RequestParam Map dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) { + return R.data(dictService.childList(dict, parentId)); } /** diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictBizService.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictBizService.java index 6788910f..e254f400 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictBizService.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictBizService.java @@ -82,6 +82,7 @@ public interface IDictBizService extends IService { /** * 顶级列表 + * * @param dict * @param query * @return @@ -90,11 +91,11 @@ public interface IDictBizService extends IService { /** * 子列表 + * * @param dict * @param parentId - * @param query * @return */ - IPage childList(Map dict, Long parentId, Query query); + List childList(Map dict, Long parentId); } diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictService.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictService.java index 5de99109..28d3a33d 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictService.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/IDictService.java @@ -74,6 +74,7 @@ public interface IDictService extends IService { /** * 新增或修改 + * * @param dict * @return */ @@ -89,6 +90,7 @@ public interface IDictService extends IService { /** * 顶级列表 + * * @param dict * @param query * @return @@ -97,11 +99,11 @@ public interface IDictService extends IService { /** * 子列表 + * * @param dict * @param parentId - * @param query * @return */ - IPage childList(Map dict, Long parentId, Query query); + List childList(Map dict, Long parentId); } diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java index de303d6d..9830ebd1 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java @@ -29,6 +29,7 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.node.ForestNodeMerger; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; +import org.springblade.system.cache.DictBizCache; import org.springblade.system.entity.DictBiz; import org.springblade.system.mapper.DictBizMapper; import org.springblade.system.service.IDictBizService; @@ -36,6 +37,7 @@ import org.springblade.system.vo.DictBizVO; import org.springblade.system.wrapper.DictBizWrapper; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -100,9 +102,13 @@ public class DictBizServiceImpl extends ServiceImpl impl } @Override - public IPage childList(Map dict, Long parentId, Query query) { + public List childList(Map dict, Long parentId) { + if (parentId < 0) { + return new ArrayList<>(); + } dict.remove("parentId"); - IPage page = this.page(Condition.getPage(query), Condition.getQueryWrapper(dict, DictBiz.class).lambda().eq(DictBiz::getParentId, parentId).orderByAsc(DictBiz::getSort)); - return DictBizWrapper.build().pageVO(page); + DictBiz parentDict = DictBizCache.getById(parentId); + List list = this.list(Condition.getQueryWrapper(dict, DictBiz.class).lambda().ne(DictBiz::getId, parentId).eq(DictBiz::getCode, parentDict.getCode()).orderByAsc(DictBiz::getSort)); + return DictBizWrapper.build().listNodeVO(list); } } diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java index be91beff..be982f5b 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java @@ -29,6 +29,7 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.node.ForestNodeMerger; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; +import org.springblade.system.cache.DictCache; import org.springblade.system.entity.Dict; import org.springblade.system.mapper.DictMapper; import org.springblade.system.service.IDictService; @@ -36,6 +37,7 @@ import org.springblade.system.vo.DictVO; import org.springblade.system.wrapper.DictWrapper; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -106,9 +108,13 @@ public class DictServiceImpl extends ServiceImpl implements ID } @Override - public IPage childList(Map dict, Long parentId, Query query) { + public List childList(Map dict, Long parentId) { + if (parentId < 0) { + return new ArrayList<>(); + } dict.remove("parentId"); - IPage page = this.page(Condition.getPage(query), Condition.getQueryWrapper(dict, Dict.class).lambda().eq(Dict::getParentId, parentId).orderByAsc(Dict::getSort)); - return DictWrapper.build().pageVO(page); + Dict parentDict = DictCache.getById(parentId); + List list = this.list(Condition.getQueryWrapper(dict, Dict.class).lambda().ne(Dict::getId, parentId).eq(Dict::getCode, parentDict.getCode()).orderByAsc(Dict::getSort)); + return DictWrapper.build().listNodeVO(list); } }