| | |
| | | package com.fzzy.igds.service; |
| | | |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.domain.Dept; |
| | | import com.fzzy.igds.repository.DeptRepository; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import org.springframework.stereotype.Service; |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | |
| | | public class CoreDeptService { |
| | | |
| | | @Resource |
| | | private ISysDeptService iSysDeptService; |
| | | @Resource |
| | | private DeptRepository deptRepository; |
| | | |
| | | |
| | | /** |
| | | * jpa查询信息 |
| | | * @param companyId |
| | | * @param parentId |
| | | * @return |
| | | */ |
| | | public List<Dept> getAllData(String companyId) { |
| | | |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getCompanyId(); |
| | | public List<Dept> getDataByParentId(String parentId) { |
| | | return deptRepository.getDataByParentId(parentId + "%"); |
| | | } |
| | | return deptRepository.getAllData(companyId); |
| | | |
| | | |
| | | /** |
| | | * jpa查询信息 |
| | | * @return |
| | | */ |
| | | public List<Dept> getDeptData() { |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | SysDept userDept = iSysDeptService.selectDeptById(user.getDeptId()); |
| | | if (Constant.DEPT_TYPE_20.equals(userDept.getType())) { |
| | | return deptRepository.getDataById(ContextUtil.subDeptId(user)); |
| | | }else { |
| | | return deptRepository.getDataByParentId(user.getDeptId() + "%"); |
| | | } |
| | | } |
| | | |
| | | /** |