【org】【position】更新模块实体和数据库对应

pull/3/head
fengshuonan 2020-12-20 16:37:48 +08:00
parent adb9b4096b
commit ffd0f854e9
8 changed files with 88 additions and 88 deletions

View File

@ -17,8 +17,8 @@ import java.math.BigDecimal;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_organization")
public class SysOrganization extends BaseEntity {
@TableName("hr_organization")
public class HrOrganization extends BaseEntity {
/**
*

View File

@ -17,8 +17,8 @@ import java.math.BigDecimal;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_position")
public class SysPosition extends BaseEntity {
@TableName("hr_position")
public class HrPosition extends BaseEntity {
/**
*

View File

@ -1,7 +1,7 @@
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 cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganization;
/**
* Mapper
@ -9,6 +9,6 @@ import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysOrganizat
* @author fengshuonan
* @date 2020/11/04 11:05
*/
public interface SysOrganizationMapper extends BaseMapper<SysOrganization> {
public interface SysOrganizationMapper extends BaseMapper<HrOrganization> {
}

View File

@ -1,7 +1,7 @@
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 cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
/**
* Mapper
@ -9,6 +9,6 @@ import cn.stylefeng.roses.kernel.system.modular.organization.entity.SysPosition;
* @author fengshuonan
* @date 2020/11/04 11:07
*/
public interface SysPositionMapper extends BaseMapper<SysPosition> {
public interface SysPositionMapper extends BaseMapper<HrPosition> {
}

View File

@ -1,10 +1,10 @@
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.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.Set;
@ -15,7 +15,7 @@ import java.util.Set;
* @author fengshuonan
* @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
* @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
* @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
* @date 2020/11/04 11:05
*/
List<SysOrganization> list(SysOrganizationRequest sysOrganizationRequest);
List<HrOrganization> list(SysOrganizationRequest sysOrganizationRequest);
/**
*

View File

@ -1,9 +1,9 @@
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 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;
@ -13,7 +13,7 @@ import java.util.List;
* @author fengshuonan
* @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
* @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
* @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
* @date 2020/11/04 11:07
*/
List<SysPosition> list(SysPositionRequest sysPositionRequest);
List<HrPosition> list(SysPositionRequest sysPositionRequest);
/**
* id

View File

@ -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.enums.DataScopeExceptionEnum;
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.service.SysOrganizationService;
import cn.stylefeng.roses.kernel.system.pojo.organization.SysOrganizationRequest;
@ -46,7 +46,7 @@ import java.util.Set;
* @date 2020/11/04 11:05
*/
@Service
public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMapper, SysOrganization> implements SysOrganizationService {
public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMapper, HrOrganization> implements SysOrganizationService {
@Resource
private UserOrgServiceApi userOrgServiceApi;
@ -69,7 +69,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
throw new SystemModularException(DataScopeExceptionEnum.DATA_SCOPE_ERROR, userTip);
}
SysOrganization sysOrganization = new SysOrganization();
HrOrganization sysOrganization = new HrOrganization();
BeanUtil.copyProperties(sysOrganizationRequest, sysOrganization);
// 填充parentIds
@ -84,7 +84,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
@Override
public void edit(SysOrganizationRequest sysOrganizationRequest) {
SysOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
HrOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
Long id = sysOrganization.getOrgId();
// 校验数据范围
@ -109,7 +109,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
@Transactional(rollbackFor = Exception.class)
public void delete(SysOrganizationRequest sysOrganizationRequest) {
SysOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
HrOrganization sysOrganization = this.querySysOrganization(sysOrganizationRequest);
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);
childIdList.add(organizationId);
LambdaUpdateWrapper<SysOrganization> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(SysOrganization::getOrgId, childIdList)
.set(SysOrganization::getDelFlag, YesOrNotEnum.Y.getCode());
LambdaUpdateWrapper<HrOrganization> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(HrOrganization::getOrgId, childIdList)
.set(HrOrganization::getDelFlag, YesOrNotEnum.Y.getCode());
this.update(updateWrapper);
// 删除角色对应的组织架构数据范围
@ -142,36 +142,36 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
@Override
public void updateStatus(SysOrganizationRequest sysOrganizationRequest) {
LambdaUpdateWrapper<SysOrganization> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgId());
updateWrapper.set(SysOrganization::getStatusFlag, sysOrganizationRequest.getStatusFlag());
LambdaUpdateWrapper<HrOrganization> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgId());
updateWrapper.set(HrOrganization::getStatusFlag, sysOrganizationRequest.getStatusFlag());
this.update(updateWrapper);
}
@Override
public SysOrganization detail(SysOrganizationRequest sysOrganizationRequest) {
public HrOrganization detail(SysOrganizationRequest sysOrganizationRequest) {
return this.querySysOrganization(sysOrganizationRequest);
}
@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));
}
@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);
}
@ -182,7 +182,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
// 定义返回结果
List<DefaultTreeNode> treeNodeList = CollectionUtil.newArrayList();
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
// 如果是超级管理员 或 数据范围是所有,则不过滤数据范围
boolean needToDataScope = true;
@ -206,18 +206,18 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
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);
for (SysOrganization sysOrganization : list) {
List<HrOrganization> list = this.list(queryWrapper);
for (HrOrganization sysOrganization : list) {
DefaultTreeNode orgTreeNode = new DefaultTreeNode();
orgTreeNode.setId(String.valueOf(sysOrganization.getOrgId()));
orgTreeNode.setPId(String.valueOf(sysOrganization.getOrgParentId()));
@ -237,17 +237,17 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
Set<Long> allLevelParentIds = new HashSet<>(organizationIds);
// 查询出这些节点的pids字段
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SysOrganization::getOrgId, organizationIds);
queryWrapper.select(SysOrganization::getOrgPids);
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(HrOrganization::getOrgId, organizationIds);
queryWrapper.select(HrOrganization::getOrgPids);
List<SysOrganization> organizationList = this.list(queryWrapper);
List<HrOrganization> organizationList = this.list(queryWrapper);
if (organizationList == null || organizationList.isEmpty()) {
return allLevelParentIds;
}
// 把所有的pids分割并放入到set中
for (SysOrganization sysOrganization : organizationList) {
for (HrOrganization sysOrganization : organizationList) {
// 获取pids值
String pids = sysOrganization.getOrgPids();
@ -276,34 +276,34 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
* @author fengshuonan
* @date 2020/11/6 10:16
*/
private LambdaQueryWrapper<SysOrganization> createWrapper(SysOrganizationRequest sysOrganizationRequest) {
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
private LambdaQueryWrapper<HrOrganization> createWrapper(SysOrganizationRequest sysOrganizationRequest) {
LambdaQueryWrapper<HrOrganization> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotNull(sysOrganizationRequest)) {
// 拼接机构名称查询条件
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgName())) {
queryWrapper.like(SysOrganization::getOrgName, sysOrganizationRequest.getOrgName());
queryWrapper.like(HrOrganization::getOrgName, sysOrganizationRequest.getOrgName());
}
// 拼接机构id查询条件
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgId())) {
queryWrapper.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgId());
queryWrapper.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgId());
}
// 拼接父机构id查询条件
if (ObjectUtil.isNotEmpty(sysOrganizationRequest.getOrgParentId())) {
queryWrapper
.eq(SysOrganization::getOrgId, sysOrganizationRequest.getOrgParentId())
.eq(HrOrganization::getOrgId, sysOrganizationRequest.getOrgParentId())
.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;
}
@ -315,8 +315,8 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
* @author fengshuonan
* @date 2020/11/04 11:05
*/
private SysOrganization querySysOrganization(SysOrganizationRequest sysOrganizationRequest) {
SysOrganization sysorganization = this.getById(sysOrganizationRequest.getOrgId());
private HrOrganization querySysOrganization(SysOrganizationRequest sysOrganizationRequest) {
HrOrganization sysorganization = this.getById(sysOrganizationRequest.getOrgId());
if (ObjectUtil.isEmpty(sysorganization)) {
throw new SystemModularException(OrganizationExceptionEnum.CANT_FIND_ORG);
}
@ -329,7 +329,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
* @author fengshuonan
* @date 2020/11/5 13:45
*/
private void fillParentIds(SysOrganization sysOrganization) {
private void fillParentIds(HrOrganization sysOrganization) {
// 如果是一级节点一级节点的pid是0
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 + ",");
} else {
// 获取父组织机构
SysOrganization parentSysOrganization = this.getById(sysOrganization.getOrgParentId());
HrOrganization parentSysOrganization = this.getById(sysOrganization.getOrgParentId());
// 设置本节点的父ids为 (上一个节点的pids + (上级节点的id) )
sysOrganization.setOrgPids(

View File

@ -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.exception.SystemModularException;
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.service.SysPositionService;
import cn.stylefeng.roses.kernel.system.pojo.organization.SysPositionRequest;
@ -33,14 +33,14 @@ import java.util.stream.Collectors;
* @date 2020/11/04 11:07
*/
@Service
public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPosition> implements SysPositionService {
public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, HrPosition> implements SysPositionService {
@Resource
private UserOrgServiceApi userOrgServiceApi;
@Override
public void add(SysPositionRequest sysPositionRequest) {
SysPosition sysPosition = new SysPosition();
HrPosition sysPosition = new HrPosition();
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
// 设置状态为启用
@ -52,7 +52,7 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
@Override
public void edit(SysPositionRequest sysPositionRequest) {
SysPosition sysPosition = this.querySysPosition(sysPositionRequest);
HrPosition sysPosition = this.querySysPosition(sysPositionRequest);
BeanUtil.copyProperties(sysPositionRequest, sysPosition);
// 不能修改状态,用修改状态接口修改状态
@ -65,7 +65,7 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
@Transactional(rollbackFor = Exception.class)
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
public void updateStatus(SysPositionRequest sysPositionRequest) {
LambdaUpdateWrapper<SysPosition> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(SysPosition::getPositionId, sysPositionRequest.getPositionId());
updateWrapper.set(SysPosition::getStatusFlag, sysPositionRequest.getStatusFlag());
LambdaUpdateWrapper<HrPosition> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(HrPosition::getPositionId, sysPositionRequest.getPositionId());
updateWrapper.set(HrPosition::getStatusFlag, sysPositionRequest.getStatusFlag());
this.update(updateWrapper);
}
@Override
public SysPosition detail(SysPositionRequest sysPositionRequest) {
public HrPosition detail(SysPositionRequest sysPositionRequest) {
return this.querySysPosition(sysPositionRequest);
}
@Override
public PageResult<SysPosition> page(SysPositionRequest sysPositionRequest) {
LambdaQueryWrapper<SysPosition> wrapper = createWrapper(sysPositionRequest);
public PageResult<HrPosition> page(SysPositionRequest 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);
}
@Override
public List<SysPosition> list(SysPositionRequest sysPositionRequest) {
LambdaQueryWrapper<SysPosition> wrapper = createWrapper(sysPositionRequest);
public List<HrPosition> list(SysPositionRequest sysPositionRequest) {
LambdaQueryWrapper<HrPosition> wrapper = createWrapper(sysPositionRequest);
return this.list(wrapper);
}
@ -112,15 +112,15 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
public List<String> getPositionNamesByPositionIds(List<Long> positionIds) {
// 拼接查询条件
LambdaQueryWrapper<SysPosition> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SysPosition::getPositionId, positionIds);
queryWrapper.select(SysPosition::getPositionName);
LambdaQueryWrapper<HrPosition> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(HrPosition::getPositionId, positionIds);
queryWrapper.select(HrPosition::getPositionName);
// 查询结果
List<SysPosition> sysPositions = this.list(queryWrapper);
List<HrPosition> sysPositions = this.list(queryWrapper);
// 把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
* @date 2020/11/6 18:35
*/
private LambdaQueryWrapper<SysPosition> createWrapper(SysPositionRequest sysPositionRequest) {
LambdaQueryWrapper<SysPosition> queryWrapper = new LambdaQueryWrapper<>();
private LambdaQueryWrapper<HrPosition> createWrapper(SysPositionRequest sysPositionRequest) {
LambdaQueryWrapper<HrPosition> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotNull(sysPositionRequest)) {
// 拼接职位名称条件
if (ObjectUtil.isNotEmpty(sysPositionRequest.getPositionName())) {
queryWrapper.like(SysPosition::getPositionName, sysPositionRequest.getPositionName());
queryWrapper.like(HrPosition::getPositionName, sysPositionRequest.getPositionName());
}
// 拼接职位编码条件
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;
}
@ -159,8 +159,8 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
* @author fengshuonan
* @date 2020/11/18 22:59
*/
private SysPosition querySysPosition(SysPositionRequest sysPositionRequest) {
SysPosition sysposition = this.getById(sysPositionRequest.getPositionId());
private HrPosition querySysPosition(SysPositionRequest sysPositionRequest) {
HrPosition sysposition = this.getById(sysPositionRequest.getPositionId());
if (ObjectUtil.isEmpty(sysposition)) {
String userTip = StrUtil.format(PositionExceptionEnum.CANT_FIND_POSITION.getUserTip(), sysposition.getPositionId());
throw new SystemModularException(PositionExceptionEnum.CANT_FIND_POSITION, userTip);