mirror of https://gitee.com/stylefeng/roses
【org】【position】更新模块实体和数据库对应
parent
adb9b4096b
commit
ffd0f854e9
|
@ -17,8 +17,8 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_organization")
|
@TableName("hr_organization")
|
||||||
public class SysOrganization extends BaseEntity {
|
public class HrOrganization extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
|
@ -17,8 +17,8 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_position")
|
@TableName("hr_position")
|
||||||
public class SysPosition extends BaseEntity {
|
public class HrPosition extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.organization.mapper;
|
package cn.stylefeng.roses.kernel.system.modular.organization.mapper;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganization;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统组织机构表 Mapper 接口
|
* 系统组织机构表 Mapper 接口
|
||||||
|
@ -9,6 +9,6 @@ import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganizat
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
public interface SysOrganizationMapper extends BaseMapper<SysOrganization> {
|
public interface SysOrganizationMapper extends BaseMapper<HrOrganization> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.organization.mapper;
|
package cn.stylefeng.roses.kernel.system.modular.organization.mapper;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrPosition;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统职位表 Mapper 接口
|
* 系统职位表 Mapper 接口
|
||||||
|
@ -9,6 +9,6 @@ import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
public interface SysPositionMapper extends BaseMapper<SysPosition> {
|
public interface SysPositionMapper extends BaseMapper<HrPosition> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.organization.service;
|
package cn.stylefeng.roses.kernel.system.modular.organization.service;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.organization.SysOrganizationRequest;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.tree.DefaultTreeNode;
|
import cn.stylefeng.roses.kernel.rule.pojo.tree.DefaultTreeNode;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganization;
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||||
|
import cn.stylefeng.roses.kernel.system.pojo.organization.SysOrganizationRequest;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -15,7 +15,7 @@ import java.util.Set;
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
public interface SysOrganizationService extends IService<SysOrganization> {
|
public interface SysOrganizationService extends IService<HrOrganization> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加系统组织机构
|
* 添加系统组织机构
|
||||||
|
@ -61,7 +61,7 @@ public interface SysOrganizationService extends IService<SysOrganization> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
SysOrganization detail(SysOrganizationRequest sysOrganizationRequest);
|
HrOrganization detail(SysOrganizationRequest sysOrganizationRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询系统组织机构
|
* 分页查询系统组织机构
|
||||||
|
@ -71,7 +71,7 @@ public interface SysOrganizationService extends IService<SysOrganization> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
PageResult<SysOrganization> page(SysOrganizationRequest sysOrganizationRequest);
|
PageResult<HrOrganization> page(SysOrganizationRequest sysOrganizationRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有系统组织机构
|
* 查询所有系统组织机构
|
||||||
|
@ -81,7 +81,7 @@ public interface SysOrganizationService extends IService<SysOrganization> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
List<SysOrganization> list(SysOrganizationRequest sysOrganizationRequest);
|
List<HrOrganization> list(SysOrganizationRequest sysOrganizationRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取组织架构树
|
* 获取组织架构树
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.organization.service;
|
package cn.stylefeng.roses.kernel.system.modular.organization.service;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrPosition;
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.organization.SysPositionRequest;
|
import cn.stylefeng.roses.kernel.system.pojo.organization.SysPositionRequest;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
public interface SysPositionService extends IService<SysPosition> {
|
public interface SysPositionService extends IService<HrPosition> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加职位
|
* 添加职位
|
||||||
|
@ -59,7 +59,7 @@ public interface SysPositionService extends IService<SysPosition> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
SysPosition detail(SysPositionRequest sysPositionRequest);
|
HrPosition detail(SysPositionRequest sysPositionRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询职位
|
* 分页查询职位
|
||||||
|
@ -69,7 +69,7 @@ public interface SysPositionService extends IService<SysPosition> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
PageResult<SysPosition> page(SysPositionRequest sysPositionRequest);
|
PageResult<HrPosition> page(SysPositionRequest sysPositionRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有职位
|
* 查询所有职位
|
||||||
|
@ -79,7 +79,7 @@ public interface SysPositionService extends IService<SysPosition> {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
List<SysPosition> list(SysPositionRequest sysPositionRequest);
|
List<HrPosition> list(SysPositionRequest sysPositionRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过职位id列表,获取对应的名称列表
|
* 通过职位id列表,获取对应的名称列表
|
||||||
|
|
|
@ -22,7 +22,7 @@ import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
|
||||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||||
import cn.stylefeng.roses.kernel.system.exception.enums.DataScopeExceptionEnum;
|
import cn.stylefeng.roses.kernel.system.exception.enums.DataScopeExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.exception.enums.OrganizationExceptionEnum;
|
import cn.stylefeng.roses.kernel.system.exception.enums.OrganizationExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganization;
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.SysOrganizationMapper;
|
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.SysOrganizationMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.SysOrganizationService;
|
import cn.stylefeng.roses.kernel.system.modular.organization.service.SysOrganizationService;
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.organization.SysOrganizationRequest;
|
import cn.stylefeng.roses.kernel.system.pojo.organization.SysOrganizationRequest;
|
||||||
|
@ -46,7 +46,7 @@ import java.util.Set;
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMapper, SysOrganization> implements SysOrganizationService {
|
public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMapper, HrOrganization> implements SysOrganizationService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserOrgServiceApi userOrgServiceApi;
|
private UserOrgServiceApi userOrgServiceApi;
|
||||||
|
@ -69,7 +69,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
throw new SystemModularException(DataScopeExceptionEnum.DATA_SCOPE_ERROR, userTip);
|
throw new SystemModularException(DataScopeExceptionEnum.DATA_SCOPE_ERROR, userTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
SysOrganization sysOrganization = new SysOrganization();
|
HrOrganization sysOrganization = new HrOrganization();
|
||||||
BeanUtil.copyProperties(sysOrganizationRequest, sysOrganization);
|
BeanUtil.copyProperties(sysOrganizationRequest, sysOrganization);
|
||||||
|
|
||||||
// 填充parentIds
|
// 填充parentIds
|
||||||
|
@ -84,7 +84,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
@Override
|
@Override
|
||||||
public void edit(SysOrganizationRequest sysOrganizationRequest) {
|
public void edit(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
|
|
||||||
SysOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
|
HrOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
|
||||||
Long id = sysOrganization.getOrgId();
|
Long id = sysOrganization.getOrgId();
|
||||||
|
|
||||||
// 校验数据范围
|
// 校验数据范围
|
||||||
|
@ -109,7 +109,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(SysOrganizationRequest sysOrganizationRequest) {
|
public void delete(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
|
|
||||||
SysOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
|
HrOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
|
||||||
Long organizationId = sysOrganization.getOrgId();
|
Long organizationId = sysOrganization.getOrgId();
|
||||||
|
|
||||||
// 校验数据范围
|
// 校验数据范围
|
||||||
|
@ -127,9 +127,9 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
// 级联删除子节点,逻辑删除
|
// 级联删除子节点,逻辑删除
|
||||||
Set<Long> childIdList = DbOperatorContext.me().findSubListByParentId("sys_organization", "pids", "id", organizationId);
|
Set<Long> childIdList = DbOperatorContext.me().findSubListByParentId("sys_organization", "pids", "id", organizationId);
|
||||||
childIdList.add(organizationId);
|
childIdList.add(organizationId);
|
||||||
LambdaUpdateWrapper<SysOrganization> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<HrOrganization> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.in(SysOrganization::getOrgId, childIdList)
|
updateWrapper.in(HrOrganization::getOrgId, childIdList)
|
||||||
.set(SysOrganization::getDelFlag, YesOrNotEnum.Y.getCode());
|
.set(HrOrganization::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
|
|
||||||
// 删除角色对应的组织架构数据范围
|
// 删除角色对应的组织架构数据范围
|
||||||
|
@ -142,36 +142,36 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
@Override
|
@Override
|
||||||
public void updateStatus(SysOrganizationRequest sysOrganizationRequest) {
|
public void updateStatus(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
|
|
||||||
LambdaUpdateWrapper<SysOrganization> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<HrOrganization> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgId());
|
updateWrapper.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgId());
|
||||||
updateWrapper.set(SysOrganization::getStatusFlag, sysOrganizationRequest.getStatusFlag());
|
updateWrapper.set(HrOrganization::getStatusFlag, sysOrganizationRequest.getStatusFlag());
|
||||||
|
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysOrganization detail(SysOrganizationRequest sysOrganizationRequest) {
|
public HrOrganization detail(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
return this.querySysOrganization(sysOrganizationRequest);
|
return this.querySysOrganization(sysOrganizationRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysOrganization> page(SysOrganizationRequest sysOrganizationRequest) {
|
public PageResult<HrOrganization> page(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
|
|
||||||
// 构造条件
|
// 构造条件
|
||||||
LambdaQueryWrapper<SysOrganization> wrapper = createWrapper(sysOrganizationRequest);
|
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(sysOrganizationRequest);
|
||||||
|
|
||||||
// 获取分页参数
|
// 获取分页参数
|
||||||
Page<SysOrganization> page = PageFactory.defaultPage();
|
Page<HrOrganization> page = PageFactory.defaultPage();
|
||||||
|
|
||||||
// 返回分页结果
|
// 返回分页结果
|
||||||
return PageResultFactory.createPageResult(this.page(page, wrapper));
|
return PageResultFactory.createPageResult(this.page(page, wrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysOrganization> list(SysOrganizationRequest sysOrganizationRequest) {
|
public List<HrOrganization> list(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
|
|
||||||
// 构造条件
|
// 构造条件
|
||||||
LambdaQueryWrapper<SysOrganization> wrapper = createWrapper(sysOrganizationRequest);
|
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(sysOrganizationRequest);
|
||||||
|
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
// 定义返回结果
|
// 定义返回结果
|
||||||
List<DefaultTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
List<DefaultTreeNode> treeNodeList = CollectionUtil.newArrayList();
|
||||||
|
|
||||||
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
// 如果是超级管理员 或 数据范围是所有,则不过滤数据范围
|
// 如果是超级管理员 或 数据范围是所有,则不过滤数据范围
|
||||||
boolean needToDataScope = true;
|
boolean needToDataScope = true;
|
||||||
|
@ -206,18 +206,18 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
Set<Long> allLevelParentIdsByOrganizations = this.findAllLevelParentIdsByOrganizations(dataScope);
|
Set<Long> allLevelParentIdsByOrganizations = this.findAllLevelParentIdsByOrganizations(dataScope);
|
||||||
|
|
||||||
// 拼接查询条件
|
// 拼接查询条件
|
||||||
queryWrapper.in(SysOrganization::getOrgId, allLevelParentIdsByOrganizations);
|
queryWrapper.in(HrOrganization::getOrgId, allLevelParentIdsByOrganizations);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只查询未删除的
|
// 只查询未删除的
|
||||||
queryWrapper.eq(SysOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
queryWrapper.eq(HrOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
||||||
|
|
||||||
// 根据排序升序排列,序号越小越在前
|
// 根据排序升序排列,序号越小越在前
|
||||||
queryWrapper.orderByAsc(SysOrganization::getOrgSort);
|
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||||
|
|
||||||
// 组装节点
|
// 组装节点
|
||||||
List<SysOrganization> list = this.list(queryWrapper);
|
List<HrOrganization> list = this.list(queryWrapper);
|
||||||
for (SysOrganization sysOrganization : list) {
|
for (HrOrganization sysOrganization : list) {
|
||||||
DefaultTreeNode orgTreeNode = new DefaultTreeNode();
|
DefaultTreeNode orgTreeNode = new DefaultTreeNode();
|
||||||
orgTreeNode.setId(String.valueOf(sysOrganization.getOrgId()));
|
orgTreeNode.setId(String.valueOf(sysOrganization.getOrgId()));
|
||||||
orgTreeNode.setPId(String.valueOf(sysOrganization.getOrgParentId()));
|
orgTreeNode.setPId(String.valueOf(sysOrganization.getOrgParentId()));
|
||||||
|
@ -237,17 +237,17 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
Set<Long> allLevelParentIds = new HashSet<>(organizationIds);
|
Set<Long> allLevelParentIds = new HashSet<>(organizationIds);
|
||||||
|
|
||||||
// 查询出这些节点的pids字段
|
// 查询出这些节点的pids字段
|
||||||
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in(SysOrganization::getOrgId, organizationIds);
|
queryWrapper.in(HrOrganization::getOrgId, organizationIds);
|
||||||
queryWrapper.select(SysOrganization::getOrgPids);
|
queryWrapper.select(HrOrganization::getOrgPids);
|
||||||
|
|
||||||
List<SysOrganization> organizationList = this.list(queryWrapper);
|
List<HrOrganization> organizationList = this.list(queryWrapper);
|
||||||
if (organizationList == null || organizationList.isEmpty()) {
|
if (organizationList == null || organizationList.isEmpty()) {
|
||||||
return allLevelParentIds;
|
return allLevelParentIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 把所有的pids分割,并放入到set中
|
// 把所有的pids分割,并放入到set中
|
||||||
for (SysOrganization sysOrganization : organizationList) {
|
for (HrOrganization sysOrganization : organizationList) {
|
||||||
|
|
||||||
// 获取pids值
|
// 获取pids值
|
||||||
String pids = sysOrganization.getOrgPids();
|
String pids = sysOrganization.getOrgPids();
|
||||||
|
@ -276,34 +276,34 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/6 10:16
|
* @date 2020/11/6 10:16
|
||||||
*/
|
*/
|
||||||
private LambdaQueryWrapper<SysOrganization> createWrapper(SysOrganizationRequest sysOrganizationRequest) {
|
private LambdaQueryWrapper<HrOrganization> createWrapper(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (ObjectUtil.isNotNull(sysOrganizationRequest)) {
|
if (ObjectUtil.isNotNull(sysOrganizationRequest)) {
|
||||||
|
|
||||||
// 拼接机构名称查询条件
|
// 拼接机构名称查询条件
|
||||||
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgName())) {
|
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgName())) {
|
||||||
queryWrapper.like(SysOrganization::getOrgName, sysOrganizationRequest.getOrgName());
|
queryWrapper.like(HrOrganization::getOrgName, sysOrganizationRequest.getOrgName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼接机构id查询条件
|
// 拼接机构id查询条件
|
||||||
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgId())) {
|
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgId())) {
|
||||||
queryWrapper.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgId());
|
queryWrapper.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼接父机构id查询条件
|
// 拼接父机构id查询条件
|
||||||
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgParentId())) {
|
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgParentId())) {
|
||||||
queryWrapper
|
queryWrapper
|
||||||
.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgParentId())
|
.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgParentId())
|
||||||
.or()
|
.or()
|
||||||
.like(SysOrganization::getOrgPids, sysOrganizationRequest.getOrgParentId());
|
.like(HrOrganization::getOrgPids, sysOrganizationRequest.getOrgParentId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询未删除状态的
|
// 查询未删除状态的
|
||||||
queryWrapper.eq(SysOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
queryWrapper.eq(HrOrganization::getDelFlag, YesOrNotEnum.N.getCode());
|
||||||
|
|
||||||
// 根据排序升序排列,序号越小越在前
|
// 根据排序升序排列,序号越小越在前
|
||||||
queryWrapper.orderByAsc(SysOrganization::getOrgSort);
|
queryWrapper.orderByAsc(HrOrganization::getOrgSort);
|
||||||
|
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,8 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/04 11:05
|
* @date 2020/11/04 11:05
|
||||||
*/
|
*/
|
||||||
private SysOrganization querySysOrganization(SysOrganizationRequest sysOrganizationRequest) {
|
private HrOrganization querySysOrganization(SysOrganizationRequest sysOrganizationRequest) {
|
||||||
SysOrganization sysorganization = this.getById(sysOrganizationRequest.getOrgId());
|
HrOrganization sysorganization = this.getById(sysOrganizationRequest.getOrgId());
|
||||||
if (ObjectUtil.isEmpty(sysorganization)) {
|
if (ObjectUtil.isEmpty(sysorganization)) {
|
||||||
throw new SystemModularException(OrganizationExceptionEnum.CANT_FIND_ORG);
|
throw new SystemModularException(OrganizationExceptionEnum.CANT_FIND_ORG);
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/5 13:45
|
* @date 2020/11/5 13:45
|
||||||
*/
|
*/
|
||||||
private void fillParentIds(SysOrganization sysOrganization) {
|
private void fillParentIds(HrOrganization sysOrganization) {
|
||||||
|
|
||||||
// 如果是一级节点(一级节点的pid是0)
|
// 如果是一级节点(一级节点的pid是0)
|
||||||
if (sysOrganization.getOrgParentId().equals(SystemConstants.DEFAULT_PARENT_ID)) {
|
if (sysOrganization.getOrgParentId().equals(SystemConstants.DEFAULT_PARENT_ID)) {
|
||||||
|
@ -337,7 +337,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||||
sysOrganization.setOrgPids(SystemConstants.PID_LEFT_DIVIDE_SYMBOL + SystemConstants.DEFAULT_PARENT_ID + SystemConstants.PID_RIGHT_DIVIDE_SYMBOL + ",");
|
sysOrganization.setOrgPids(SystemConstants.PID_LEFT_DIVIDE_SYMBOL + SystemConstants.DEFAULT_PARENT_ID + SystemConstants.PID_RIGHT_DIVIDE_SYMBOL + ",");
|
||||||
} else {
|
} else {
|
||||||
// 获取父组织机构
|
// 获取父组织机构
|
||||||
SysOrganization parentSysOrganization = this.getById(sysOrganization.getOrgParentId());
|
HrOrganization parentSysOrganization = this.getById(sysOrganization.getOrgParentId());
|
||||||
|
|
||||||
// 设置本节点的父ids为 (上一个节点的pids + (上级节点的id) )
|
// 设置本节点的父ids为 (上一个节点的pids + (上级节点的id) )
|
||||||
sysOrganization.setOrgPids(
|
sysOrganization.setOrgPids(
|
||||||
|
|
|
@ -11,7 +11,7 @@ import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.UserOrgServiceApi;
|
import cn.stylefeng.roses.kernel.system.UserOrgServiceApi;
|
||||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||||
import cn.stylefeng.roses.kernel.system.exception.enums.PositionExceptionEnum;
|
import cn.stylefeng.roses.kernel.system.exception.enums.PositionExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrPosition;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.SysPositionMapper;
|
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.SysPositionMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.SysPositionService;
|
import cn.stylefeng.roses.kernel.system.modular.organization.service.SysPositionService;
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.organization.SysPositionRequest;
|
import cn.stylefeng.roses.kernel.system.pojo.organization.SysPositionRequest;
|
||||||
|
@ -33,14 +33,14 @@ import java.util.stream.Collectors;
|
||||||
* @date 2020/11/04 11:07
|
* @date 2020/11/04 11:07
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPosition> implements SysPositionService {
|
public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, HrPosition> implements SysPositionService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserOrgServiceApi userOrgServiceApi;
|
private UserOrgServiceApi userOrgServiceApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(SysPositionRequest sysPositionRequest) {
|
public void add(SysPositionRequest sysPositionRequest) {
|
||||||
SysPosition sysPosition = new SysPosition();
|
HrPosition sysPosition = new HrPosition();
|
||||||
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
|
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
|
||||||
|
|
||||||
// 设置状态为启用
|
// 设置状态为启用
|
||||||
|
@ -52,7 +52,7 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
@Override
|
@Override
|
||||||
public void edit(SysPositionRequest sysPositionRequest) {
|
public void edit(SysPositionRequest sysPositionRequest) {
|
||||||
|
|
||||||
SysPosition sysPosition = this.querySysPosition(sysPositionRequest);
|
HrPosition sysPosition = this.querySysPosition(sysPositionRequest);
|
||||||
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
|
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
|
||||||
|
|
||||||
// 不能修改状态,用修改状态接口修改状态
|
// 不能修改状态,用修改状态接口修改状态
|
||||||
|
@ -65,7 +65,7 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(SysPositionRequest sysPositionRequest) {
|
public void delete(SysPositionRequest sysPositionRequest) {
|
||||||
|
|
||||||
SysPosition sysPosition = this.querySysPosition(sysPositionRequest);
|
HrPosition sysPosition = this.querySysPosition(sysPositionRequest);
|
||||||
|
|
||||||
// 该职位下是否有员工
|
// 该职位下是否有员工
|
||||||
// 职位有绑定员工,不能删除
|
// 职位有绑定员工,不能删除
|
||||||
|
@ -82,29 +82,29 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStatus(SysPositionRequest sysPositionRequest) {
|
public void updateStatus(SysPositionRequest sysPositionRequest) {
|
||||||
LambdaUpdateWrapper<SysPosition> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<HrPosition> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(SysPosition::getPositionId, sysPositionRequest.getPositionId());
|
updateWrapper.eq(HrPosition::getPositionId, sysPositionRequest.getPositionId());
|
||||||
updateWrapper.set(SysPosition::getStatusFlag, sysPositionRequest.getStatusFlag());
|
updateWrapper.set(HrPosition::getStatusFlag, sysPositionRequest.getStatusFlag());
|
||||||
|
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysPosition detail(SysPositionRequest sysPositionRequest) {
|
public HrPosition detail(SysPositionRequest sysPositionRequest) {
|
||||||
return this.querySysPosition(sysPositionRequest);
|
return this.querySysPosition(sysPositionRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysPosition> page(SysPositionRequest sysPositionRequest) {
|
public PageResult<HrPosition> page(SysPositionRequest sysPositionRequest) {
|
||||||
LambdaQueryWrapper<SysPosition> wrapper = createWrapper(sysPositionRequest);
|
LambdaQueryWrapper<HrPosition> wrapper = createWrapper(sysPositionRequest);
|
||||||
|
|
||||||
Page<SysPosition> page = this.page(PageFactory.defaultPage(), wrapper);
|
Page<HrPosition> page = this.page(PageFactory.defaultPage(), wrapper);
|
||||||
return PageResultFactory.createPageResult(page);
|
return PageResultFactory.createPageResult(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysPosition> list(SysPositionRequest sysPositionRequest) {
|
public List<HrPosition> list(SysPositionRequest sysPositionRequest) {
|
||||||
LambdaQueryWrapper<SysPosition> wrapper = createWrapper(sysPositionRequest);
|
LambdaQueryWrapper<HrPosition> wrapper = createWrapper(sysPositionRequest);
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +112,15 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
public List<String> getPositionNamesByPositionIds(List<Long> positionIds) {
|
public List<String> getPositionNamesByPositionIds(List<Long> positionIds) {
|
||||||
|
|
||||||
// 拼接查询条件
|
// 拼接查询条件
|
||||||
LambdaQueryWrapper<SysPosition> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HrPosition> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in(SysPosition::getPositionId, positionIds);
|
queryWrapper.in(HrPosition::getPositionId, positionIds);
|
||||||
queryWrapper.select(SysPosition::getPositionName);
|
queryWrapper.select(HrPosition::getPositionName);
|
||||||
|
|
||||||
// 查询结果
|
// 查询结果
|
||||||
List<SysPosition> sysPositions = this.list(queryWrapper);
|
List<HrPosition> sysPositions = this.list(queryWrapper);
|
||||||
|
|
||||||
// 把name组装起来
|
// 把name组装起来
|
||||||
return sysPositions.stream().map(SysPosition::getPositionName).collect(Collectors.toList());
|
return sysPositions.stream().map(HrPosition::getPositionName).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,26 +129,26 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/6 18:35
|
* @date 2020/11/6 18:35
|
||||||
*/
|
*/
|
||||||
private LambdaQueryWrapper<SysPosition> createWrapper(SysPositionRequest sysPositionRequest) {
|
private LambdaQueryWrapper<HrPosition> createWrapper(SysPositionRequest sysPositionRequest) {
|
||||||
LambdaQueryWrapper<SysPosition> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HrPosition> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (ObjectUtil.isNotNull(sysPositionRequest)) {
|
if (ObjectUtil.isNotNull(sysPositionRequest)) {
|
||||||
|
|
||||||
// 拼接职位名称条件
|
// 拼接职位名称条件
|
||||||
if (ObjectUtil.isNotEmpty(sysPositionRequest.getPositionName())) {
|
if (ObjectUtil.isNotEmpty(sysPositionRequest.getPositionName())) {
|
||||||
queryWrapper.like(SysPosition::getPositionName, sysPositionRequest.getPositionName());
|
queryWrapper.like(HrPosition::getPositionName, sysPositionRequest.getPositionName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼接职位编码条件
|
// 拼接职位编码条件
|
||||||
if (ObjectUtil.isNotEmpty(sysPositionRequest.getPositionCode())) {
|
if (ObjectUtil.isNotEmpty(sysPositionRequest.getPositionCode())) {
|
||||||
queryWrapper.eq(SysPosition::getPositionCode, sysPositionRequest.getPositionCode());
|
queryWrapper.eq(HrPosition::getPositionCode, sysPositionRequest.getPositionCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询未删除状态的
|
// 查询未删除状态的
|
||||||
queryWrapper.eq(SysPosition::getDelFlag, YesOrNotEnum.N.getCode());
|
queryWrapper.eq(HrPosition::getDelFlag, YesOrNotEnum.N.getCode());
|
||||||
|
|
||||||
// 根据排序升序排列,序号越小越在前
|
// 根据排序升序排列,序号越小越在前
|
||||||
queryWrapper.orderByAsc(SysPosition::getPositionSort);
|
queryWrapper.orderByAsc(HrPosition::getPositionSort);
|
||||||
|
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/11/18 22:59
|
* @date 2020/11/18 22:59
|
||||||
*/
|
*/
|
||||||
private SysPosition querySysPosition(SysPositionRequest sysPositionRequest) {
|
private HrPosition querySysPosition(SysPositionRequest sysPositionRequest) {
|
||||||
SysPosition sysposition = this.getById(sysPositionRequest.getPositionId());
|
HrPosition sysposition = this.getById(sysPositionRequest.getPositionId());
|
||||||
if (ObjectUtil.isEmpty(sysposition)) {
|
if (ObjectUtil.isEmpty(sysposition)) {
|
||||||
String userTip = StrUtil.format(PositionExceptionEnum.CANT_FIND_POSITION.getUserTip(), sysposition.getPositionId());
|
String userTip = StrUtil.format(PositionExceptionEnum.CANT_FIND_POSITION.getUserTip(), sysposition.getPositionId());
|
||||||
throw new SystemModularException(PositionExceptionEnum.CANT_FIND_POSITION, userTip);
|
throw new SystemModularException(PositionExceptionEnum.CANT_FIND_POSITION, userTip);
|
||||||
|
|
Loading…
Reference in New Issue