File was renamed from ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminDepartServiceImpl.java |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.api.BasePageDTO; |
| | | import com.ycl.api.CommonPage; |
| | | import com.ycl.dto.user.AdminDepartInfoDTO; |
| | | import com.ycl.entity.depart.SccgDepart; |
| | | import com.ycl.entity.user.UmsAdmin; |
| | | import com.ycl.entity.user.UmsAdminDepart; |
| | | import com.ycl.mapper.user.UmsAdminDepartMapper; |
| | | import com.ycl.entity.user.UmsDepartManage; |
| | | import com.ycl.mapper.user.UmsDepartManageMapper; |
| | | import com.ycl.service.depart.SccgDepartService; |
| | | import com.ycl.service.user.UmsAdminDepartService; |
| | | import com.ycl.service.user.UmsDepartManageService; |
| | | import com.ycl.service.user.UmsAdminService; |
| | | import com.ycl.vo.depart.DepartVO; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @since 2022-09-09 |
| | | */ |
| | | @Service |
| | | public class UmsAdminDepartServiceImpl extends ServiceImpl<UmsAdminDepartMapper, UmsAdminDepart> implements UmsAdminDepartService { |
| | | public class UmsDepartManageServiceImpl extends ServiceImpl<UmsDepartManageMapper, UmsDepartManage> implements UmsDepartManageService { |
| | | |
| | | @Resource |
| | | private UmsAdminDepartMapper umsAdminDepartMapper; |
| | | private UmsDepartManageMapper umsDepartManageMapper; |
| | | @Resource |
| | | private SccgDepartService sccgDepartService; |
| | | @Resource |
| | | private UmsAdminService umsAdminService; |
| | | |
| | | @Override |
| | | public List<UmsAdminDepart> queryByDepartId(Long departId) { |
| | | List<UmsAdminDepart> umsAdminDeparts = umsAdminDepartMapper.selectList(new LambdaQueryWrapper<UmsAdminDepart>() |
| | | .eq(UmsAdminDepart::getDepartId, departId) |
| | | .eq(UmsAdminDepart::getIsManager, 1)); |
| | | public List<UmsDepartManage> queryByDepartId(Long departId) { |
| | | List<UmsDepartManage> umsAdminDeparts = umsDepartManageMapper.selectList(new LambdaQueryWrapper<UmsDepartManage>() |
| | | .eq(UmsDepartManage::getDepartId, departId)); |
| | | if (CollUtil.isNotEmpty(umsAdminDeparts)) { |
| | | return umsAdminDeparts; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UmsAdminDepart> queryByUserId(long userId) { |
| | | List<UmsAdminDepart> umsAdminDeparts = umsAdminDepartMapper.selectList(new LambdaQueryWrapper<UmsAdminDepart>().eq(UmsAdminDepart::getUserId, userId)); |
| | | public List<UmsDepartManage> queryByUserId(long userId) { |
| | | List<UmsDepartManage> umsAdminDeparts = umsDepartManageMapper.selectList(new LambdaQueryWrapper<UmsDepartManage>().eq(UmsDepartManage::getUserId, userId)); |
| | | if (CollUtil.isNotEmpty(umsAdminDeparts)) { |
| | | return umsAdminDeparts; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void deletedByDepartId(long departId) { |
| | | umsAdminDepartMapper.deletedByDepartId(departId); |
| | | umsDepartManageMapper.deletedByDepartId(departId); |
| | | } |
| | | |
| | | @Override |
| | | public BasePageDTO belongDepart(long userId, int current, int pageSize) { |
| | | BasePageDTO basePageDTO = new BasePageDTO(); |
| | | Long count = umsAdminDepartMapper.selectCount(new LambdaQueryWrapper<UmsAdminDepart>().eq(UmsAdminDepart::getUserId, userId)); |
| | | Long count = umsDepartManageMapper.selectCount(new LambdaQueryWrapper<UmsDepartManage>().eq(UmsDepartManage::getUserId, userId)); |
| | | basePageDTO.setTotal(count); |
| | | if (count > 0) { |
| | | current = (current - 1) * pageSize; |
| | | List<UmsAdminDepart> departList = umsAdminDepartMapper.selectPageByUserId(userId, current, pageSize); |
| | | List<UmsDepartManage> departList = umsDepartManageMapper.selectPageByUserId(userId, current, pageSize); |
| | | List<DepartVO.AdminDepartInfoVO> adminDepartInfoVOS = new ArrayList<>(); |
| | | DepartVO.AdminDepartInfoVO adminDepartInfoVO = null; |
| | | for (UmsAdminDepart umsAdminDepart : departList) { |
| | | for (UmsDepartManage umsAdminDepart : departList) { |
| | | adminDepartInfoVO = new DepartVO.AdminDepartInfoVO(); |
| | | SccgDepart sccgDepart = sccgDepartService.loadDepartById(umsAdminDepart.getDepartId()); |
| | | UmsAdmin umsAdmin = umsAdminService.getById(userId); |