| | |
| | | |
| | | import com.mindskip.xzs.context.WebContext; |
| | | import com.mindskip.xzs.domain.Subject; |
| | | import com.mindskip.xzs.domain.enums.RoleEnum; |
| | | import com.mindskip.xzs.repository.BaseMapper; |
| | | import com.mindskip.xzs.repository.DepartmentMapper; |
| | | import com.mindskip.xzs.repository.SubjectMapper; |
| | |
| | | |
| | | @Override |
| | | public List<Subject> allSubject() { |
| | | // 如果是部门管理员,只查关联该部门的课目 |
| | | boolean deptAdmin = webContext.isDeptAdmin(); |
| | | List<Integer> deptIds = new ArrayList<>(); |
| | | if (deptAdmin) { |
| | | deptIds = webContext.getAdminDeptIds(); |
| | | } |
| | | return subjectMapper.allSubject(deptIds); |
| | | // 只查自己部门的课目 |
| | | List<Integer> deptIds = webContext.getAdminDeptIds(); |
| | | Boolean admin = RoleEnum.ADMIN.getCode().equals(webContext.getCurrentUser().getRole()); |
| | | return subjectMapper.allSubject(deptIds, admin); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return subjectMapper.selectByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<Subject> listByDeptId(Integer deptId) { |
| | | return subjectMapper.listByDeptId(deptId); |
| | | } |
| | | } |