|
|
@@ -16,6 +16,7 @@
|
|
|
*/
|
|
|
package org.springblade.system.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
@@ -27,12 +28,14 @@ import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.annotation.PreAuth;
|
|
|
import org.springblade.core.secure.constant.AuthConstant;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
|
import org.springblade.core.tool.constant.RoleConstant;
|
|
|
import org.springblade.core.tool.support.Kv;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.system.cache.DictCache;
|
|
|
import org.springblade.system.entity.Dept;
|
|
|
import org.springblade.system.enums.DictEnum;
|
|
|
@@ -106,6 +109,21 @@ public class DeptController extends BladeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 顶级部门列表
|
|
|
+ */
|
|
|
+ @GetMapping("/top-list")
|
|
|
+ @PreAuth(AuthConstant.PERMIT_ALL)
|
|
|
+ public R<List<DeptVO>> topList(Dept dept) {
|
|
|
+ List<Dept> list = deptService.list(new LambdaQueryWrapper<Dept>()
|
|
|
+ .eq(ObjectUtil.isNotEmpty(dept.getDeptCategory()), Dept::getDeptCategory, dept.getDeptCategory())
|
|
|
+ .eq(Dept::getParentId, 0)
|
|
|
+ .eq(Dept::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Dept::getIsDeleted, 0)
|
|
|
+ );
|
|
|
+ return R.data(DeptWrapper.build().listNodeVO(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取部门树形结构
|
|
|
*
|
|
|
* @return
|