部门管理

This commit is contained in:
none
2023-02-19 12:15:57 +08:00
parent 166dc4c1a2
commit 9c97b774a0
15 changed files with 514 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
package xyz.playedu.api.bus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.playedu.api.config.PlayEduConfig;
import xyz.playedu.api.constant.SystemConstant;
/**
* @Author 杭州白书科技有限公司
* @create 2023/2/19 12:06
*/
@Component
public class AppBus {
@Autowired
private PlayEduConfig playEduConfig;
public boolean isDev() {
return !playEduConfig.getEnv().equals(SystemConstant.ENV_PROD);
}
}

View File

@@ -0,0 +1,32 @@
package xyz.playedu.api.bus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.playedu.api.domain.Department;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.service.DepartmentService;
/**
* @Author 杭州白书科技有限公司
* @create 2023/2/19 11:02
*/
@Component
public class DepartmentBus {
@Autowired
private DepartmentService departmentService;
public String compParentChain(Integer parentId) throws NotFoundException {
String parentChain = "";
if (parentId != 0) {
Department parentDepartment = departmentService.getById(parentId);
if (parentDepartment == null) {
throw new NotFoundException("父级部门不存在");
}
parentChain = parentDepartment.getParentChain() + "," + parentId;
}
return parentChain;
}
}