package cn.cetc54.platform.core.serviceimpl; import cn.cetc54.platform.core.dao.DepartmentDao; import cn.cetc54.platform.core.service.DepartmentService; import cn.cetc54.platform.core.common.utils.SecurityUtil; import cn.cetc54.platform.core.entity.Department; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * 部门接口实现 * @author Exrick */ @Slf4j @Service @Transactional public class DepartmentServiceImpl implements DepartmentService { @Autowired private DepartmentDao departmentDao; @Autowired private SecurityUtil securityUtil; @Override public DepartmentDao getRepository() { return departmentDao; } @Override public List findByParentIdOrderBySortOrder(String parentId, Boolean openDataFilter) { // 数据权限 List depIds = securityUtil.getDeparmentIds(); if(depIds!=null&&depIds.size()>0&&openDataFilter){ return departmentDao.findByParentIdAndIdInOrderBySortOrder(parentId, depIds); } return departmentDao.findByParentIdOrderBySortOrder(parentId); } @Override public List findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status) { return departmentDao.findByParentIdAndStatusOrderBySortOrder(parentId, status); } @Override public List findByTitleLikeOrderBySortOrder(String title, Boolean openDataFilter) { // 数据权限 List depIds = securityUtil.getDeparmentIds(); if(depIds!=null&&depIds.size()>0&&openDataFilter){ return departmentDao.findByTitleLikeAndIdInOrderBySortOrder(title, depIds); } return departmentDao.findByTitleLikeOrderBySortOrder(title); } }