|
@@ -4,14 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
|
import cn.hutool.core.lang.tree.TreeNode;
|
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xy.dto.SysDeptDto;
|
|
|
+import com.xy.dto.SysDeptListDto;
|
|
|
import com.xy.entity.SysDept;
|
|
|
import com.xy.entity.SysDeptRelation;
|
|
|
import com.xy.entity.SysUserDept;
|
|
|
import com.xy.mapper.SysDeptMapper;
|
|
|
+import com.xy.redis.RedisCache;
|
|
|
import com.xy.service.SysDeptRelationService;
|
|
|
import com.xy.service.SysDeptRoleService;
|
|
|
import com.xy.service.SysDeptService;
|
|
@@ -96,10 +99,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
return R.ok(saveOrUpdate(sysDept));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "系统部门树", notes = "系统部门树")
|
|
|
- @GetMapping("tree/{sysId}")
|
|
|
- public R<List<Tree<Long>>> deptTree(@PathVariable("sysId") Long sysId) {
|
|
|
- List<Tree<Long>> deptTree = getDeptTree(this.list(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getSysId, sysId)), 0L);
|
|
|
+
|
|
|
+ @ApiOperation(value = "系统部门树下拉列表", notes = "系统部门树下拉列表")
|
|
|
+ @GetMapping("tree/list")
|
|
|
+ public R<List<Tree<Long>>> deptTreeList(@Valid @RequestBody SysDeptListDto sysDeptListDto) {
|
|
|
+ Long sysId = sysDeptListDto.getSysId();
|
|
|
+ String deptName = sysDeptListDto.getName();
|
|
|
+ LambdaQueryWrapper<SysDept> lambdaQueryWrapper = Wrappers.<SysDept>lambdaQuery().eq(SysDept::getSysId, sysId)
|
|
|
+ .likeRight(StrUtil.isNotBlank(deptName), SysDept::getName, deptName);
|
|
|
+ RedisCache.getDataAuth(sysId, lambdaQueryWrapper, SysDept::getCreateUser);
|
|
|
+
|
|
|
+ List<Tree<Long>> deptTree = getDeptTree(this.list(lambdaQueryWrapper), 0L);
|
|
|
return R.ok(deptTree);
|
|
|
}
|
|
|
|