Compare commits
No commits in common. "4712f744769329113d4ecc3ab75ccd681c459892" and "8f22c874518eadfdf1c22bdebcc7fdf658c45152" have entirely different histories.
4712f74476
...
8f22c87451
@ -95,9 +95,4 @@ public interface DeptApi {
|
|||||||
@GetMapping("/getCompanyDept")
|
@GetMapping("/getCompanyDept")
|
||||||
@Operation(summary = "获取部门类型为公司的部门信息")
|
@Operation(summary = "获取部门类型为公司的部门信息")
|
||||||
CommonResult<List<DeptRespDTO>> getCompanyDept();
|
CommonResult<List<DeptRespDTO>> getCompanyDept();
|
||||||
|
|
||||||
@GetMapping("/getUserCompanyDept")
|
|
||||||
@Operation(summary = "获取用户所在公司的信息")
|
|
||||||
@Parameter(name = "userId", description = "用户编号", example = "1024", required = true)
|
|
||||||
CommonResult<DeptRespDTO> getUserCompanyDept(@RequestParam("userId") Long userId);
|
|
||||||
}
|
}
|
||||||
|
@ -134,12 +134,4 @@ public class DeptApiImpl implements DeptApi {
|
|||||||
List<DeptDO> deptDOS = deptService.getCompanyDept();
|
List<DeptDO> deptDOS = deptService.getCompanyDept();
|
||||||
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
|
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@DataPermission(enable = false)
|
|
||||||
public CommonResult<DeptRespDTO> getUserCompanyDept(Long userId) {
|
|
||||||
|
|
||||||
DeptDO deptDO = deptService.getUserCompanyDept(userId);
|
|
||||||
return success(BeanUtils.toBean(deptDO, DeptRespDTO.class));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.mysql.dept;
|
package cn.iocoder.yudao.module.system.dal.mysql.dept;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -49,15 +46,4 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
|||||||
|
|
||||||
return selectList(new LambdaQueryWrapperX<DeptDO>().orderByAsc(DeptDO::getFlag));
|
return selectList(new LambdaQueryWrapperX<DeptDO>().orderByAsc(DeptDO::getFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
default DeptDO selectDeptByUserId(Long userId) {
|
|
||||||
|
|
||||||
MPJLambdaWrapperX<DeptDO> query = new MPJLambdaWrapperX<DeptDO>();
|
|
||||||
query.selectAll(DeptDO.class);
|
|
||||||
query.innerJoin(AdminUserDO.class, on -> on
|
|
||||||
.eq(AdminUserDO::getDeptId, DeptDO::getId)
|
|
||||||
.eq(AdminUserDO::getId, userId));
|
|
||||||
|
|
||||||
return selectJoinOne(DeptDO.class, query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ public class DataPermissionConfiguration {
|
|||||||
// dept
|
// dept
|
||||||
rule.addDeptColumn(AdminUserDO.class);
|
rule.addDeptColumn(AdminUserDO.class);
|
||||||
rule.addDeptColumn(DeptDO.class, "id");
|
rule.addDeptColumn(DeptDO.class, "id");
|
||||||
|
rule.addDeptColumn(LogUseDO.class, "use_user_dept");
|
||||||
rule.addDeptColumn(LogStatisticsDO.class, "dept_id");
|
rule.addDeptColumn(LogStatisticsDO.class, "dept_id");
|
||||||
rule.addDeptColumn(LogInstanceDO.class, "dept_id");
|
rule.addDeptColumn(LogInstanceDO.class, "dept_id");
|
||||||
rule.addDeptColumn(DeptAssetsDO.class, "dept_id");
|
rule.addDeptColumn(DeptAssetsDO.class, "dept_id");
|
||||||
@ -30,6 +31,7 @@ public class DataPermissionConfiguration {
|
|||||||
|
|
||||||
// user
|
// user
|
||||||
rule.addUserColumn(AdminUserDO.class, "id");
|
rule.addUserColumn(AdminUserDO.class, "id");
|
||||||
|
rule.addUserColumn(LogUseDO.class, "use_user_id");
|
||||||
rule.addUserColumn(LogStatisticsDO.class, "user_id");
|
rule.addUserColumn(LogStatisticsDO.class, "user_id");
|
||||||
rule.addUserColumn(LogInstanceDO.class, "start_user_id");
|
rule.addUserColumn(LogInstanceDO.class, "start_user_id");
|
||||||
};
|
};
|
||||||
|
@ -160,11 +160,4 @@ public interface DeptService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getDeptListByFactoryIds(List<Long> factoryIds);
|
List<DeptDO> getDeptListByFactoryIds(List<Long> factoryIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户所在公司的信息
|
|
||||||
* @param userId 用户编号
|
|
||||||
* @return 公司信息
|
|
||||||
*/
|
|
||||||
DeptDO getUserCompanyDept(Long userId);
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.dept;
|
package cn.iocoder.yudao.module.system.service.dept;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@ -25,7 +24,6 @@ import java.util.*;
|
|||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.TASK_OPERATE_FAIL_USER_NO_DEPT;
|
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -321,7 +319,6 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DataPermission(enable = false)
|
|
||||||
public List<DeptDO> getCompanyDept() {
|
public List<DeptDO> getCompanyDept() {
|
||||||
|
|
||||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||||
@ -348,27 +345,4 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
return deptMapper.selectList(new LambdaQueryWrapper<DeptDO>()
|
return deptMapper.selectList(new LambdaQueryWrapper<DeptDO>()
|
||||||
.in(DeptDO::getFactoryId, factoryIds));
|
.in(DeptDO::getFactoryId, factoryIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@DataPermission(enable = false)
|
|
||||||
public DeptDO getUserCompanyDept(Long userId) {
|
|
||||||
|
|
||||||
// 获取用户所在部门信息
|
|
||||||
DeptDO deptDo = deptMapper.selectDeptByUserId(userId);
|
|
||||||
|
|
||||||
if (deptDo == null) {
|
|
||||||
throw exception(TASK_OPERATE_FAIL_USER_NO_DEPT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据所在部门信息获取 所在公司信息
|
|
||||||
List<DeptDO> companyDeptList = deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
|
||||||
.likeIfPresent(DeptDO::getFlag, deptDo.getFlag())
|
|
||||||
.eq(DeptDO::getType, 0));
|
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(companyDeptList)) {
|
|
||||||
return new DeptDO();
|
|
||||||
}
|
|
||||||
|
|
||||||
return companyDeptList.get(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user