mirror of https://gitee.com/stylefeng/roses
【7.2.5】初始化组织机构审批人实体
parent
4ada674c1e
commit
0e373488ed
|
@ -0,0 +1,101 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.controller;
|
||||
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrgApprover;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.pojo.request.HrOrgApproverRequest;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrOrgApproverService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织机构审批人控制器
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@RestController
|
||||
@ApiResource(name = "组织机构审批人")
|
||||
public class HrOrgApproverController {
|
||||
|
||||
@Resource
|
||||
private HrOrgApproverService hrOrgApproverService;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@PostResource(name = "添加", path = "/hrOrgApprover/add")
|
||||
public ResponseData<HrOrgApprover> add(@RequestBody @Validated(HrOrgApproverRequest.add.class) HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
hrOrgApproverService.add(hrOrgApproverRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@PostResource(name = "删除", path = "/hrOrgApprover/delete")
|
||||
public ResponseData<?> delete(@RequestBody @Validated(HrOrgApproverRequest.delete.class) HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
hrOrgApproverService.del(hrOrgApproverRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@PostResource(name = "编辑", path = "/hrOrgApprover/edit")
|
||||
public ResponseData<?> edit(@RequestBody @Validated(HrOrgApproverRequest.edit.class) HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
hrOrgApproverService.edit(hrOrgApproverRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@GetResource(name = "查看详情", path = "/hrOrgApprover/detail")
|
||||
public ResponseData<HrOrgApprover> detail(@Validated(HrOrgApproverRequest.detail.class) HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
return new SuccessResponseData<>(hrOrgApproverService.detail(hrOrgApproverRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@GetResource(name = "获取列表", path = "/hrOrgApprover/list")
|
||||
public ResponseData<List<HrOrgApprover>> list(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
return new SuccessResponseData<>(hrOrgApproverService.findList(hrOrgApproverRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@GetResource(name = "分页查询", path = "/hrOrgApprover/page")
|
||||
public ResponseData<PageResult<HrOrgApprover>> page(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
return new SuccessResponseData<>(hrOrgApproverService.findPage(hrOrgApproverRequest));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.entity;
|
||||
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 组织机构审批人实例类
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@TableName("hr_org_approver")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class HrOrgApprover extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "org_approver_id", type = IdType.ASSIGN_ID)
|
||||
@ChineseDescription("主键id")
|
||||
private Long orgApproverId;
|
||||
|
||||
/**
|
||||
* 组织审批类型:1-负责人,2-部长,3-体系负责人,4-部门助理,5-资产助理(专员),6-考勤专员,7-HRBP,8-门禁员,9-办公账号员,10-转岗须知员
|
||||
*/
|
||||
@TableField("org_approver_type")
|
||||
@ChineseDescription("组织审批类型:1-负责人,2-部长,3-体系负责人,4-部门助理,5-资产助理(专员),6-考勤专员,7-HRBP,8-门禁员,9-办公账号员,10-转岗须知员")
|
||||
private Integer orgApproverType;
|
||||
|
||||
/**
|
||||
* 组织机构id
|
||||
*/
|
||||
@TableField("org_id")
|
||||
@ChineseDescription("组织机构id")
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
@ChineseDescription("用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.enums;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 组织机构审批人异常相关枚举
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@Getter
|
||||
public enum HrOrgApproverExceptionEnum implements AbstractExceptionEnum {
|
||||
|
||||
/**
|
||||
* 查询结果不存在
|
||||
*/
|
||||
HR_ORG_APPROVER_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
|
||||
|
||||
/**
|
||||
* 错误编码
|
||||
*/
|
||||
private final String errorCode;
|
||||
|
||||
/**
|
||||
* 提示用户信息
|
||||
*/
|
||||
private final String userTip;
|
||||
|
||||
HrOrgApproverExceptionEnum(String errorCode, String userTip) {
|
||||
this.errorCode = errorCode;
|
||||
this.userTip = userTip;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.mapper;
|
||||
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrgApprover;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 组织机构审批人 Mapper 接口
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
public interface HrOrgApproverMapper extends BaseMapper<HrOrgApprover> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.stylefeng.roses.kernel.system.modular.organization.mapper.HrOrgApproverMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,45 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.pojo.request;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 组织机构审批人封装类
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class HrOrgApproverRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = {edit.class, delete.class})
|
||||
@ChineseDescription("主键id")
|
||||
private Long orgApproverId;
|
||||
|
||||
/**
|
||||
* 组织审批类型:1-负责人,2-部长,3-体系负责人,4-部门助理,5-资产助理(专员),6-考勤专员,7-HRBP,8-门禁员,9-办公账号员,10-转岗须知员
|
||||
*/
|
||||
@ChineseDescription("组织审批类型:1-负责人,2-部长,3-体系负责人,4-部门助理,5-资产助理(专员),6-考勤专员,7-HRBP,8-门禁员,9-办公账号员,10-转岗须知员")
|
||||
private Integer orgApproverType;
|
||||
|
||||
/**
|
||||
* 组织机构id
|
||||
*/
|
||||
@ChineseDescription("组织机构id")
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ChineseDescription("用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
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.HrOrgApprover;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.pojo.request.HrOrgApproverRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织机构审批人 服务类
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
public interface HrOrgApproverService extends IService<HrOrgApprover> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
void add(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
void del(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
void edit(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
HrOrgApprover detail(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @return List<HrOrgApprover> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
List<HrOrgApprover> findList(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
* @param hrOrgApproverRequest 请求参数
|
||||
* @return PageResult<HrOrgApprover> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
PageResult<HrOrgApprover> findPage(HrOrgApproverRequest hrOrgApproverRequest);
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.organization.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrgApprover;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.enums.HrOrgApproverExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.mapper.HrOrgApproverMapper;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.pojo.request.HrOrgApproverRequest;
|
||||
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrOrgApproverService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织机构审批人业务实现层
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
@Service
|
||||
public class HrOrgApproverServiceImpl extends ServiceImpl<HrOrgApproverMapper, HrOrgApprover> implements HrOrgApproverService {
|
||||
|
||||
@Override
|
||||
public void add(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
HrOrgApprover hrOrgApprover = new HrOrgApprover();
|
||||
BeanUtil.copyProperties(hrOrgApproverRequest, hrOrgApprover);
|
||||
this.save(hrOrgApprover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
HrOrgApprover hrOrgApprover = this.queryHrOrgApprover(hrOrgApproverRequest);
|
||||
this.removeById(hrOrgApprover.getOrgApproverId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
HrOrgApprover hrOrgApprover = this.queryHrOrgApprover(hrOrgApproverRequest);
|
||||
BeanUtil.copyProperties(hrOrgApproverRequest, hrOrgApprover);
|
||||
this.updateById(hrOrgApprover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HrOrgApprover detail(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
return this.queryHrOrgApprover(hrOrgApproverRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HrOrgApprover> findPage(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
LambdaQueryWrapper<HrOrgApprover> wrapper = createWrapper(hrOrgApproverRequest);
|
||||
Page<HrOrgApprover> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
|
||||
return PageResultFactory.createPageResult(sysRolePage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HrOrgApprover> findList(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
LambdaQueryWrapper<HrOrgApprover> wrapper = this.createWrapper(hrOrgApproverRequest);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
private HrOrgApprover queryHrOrgApprover(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
HrOrgApprover hrOrgApprover = this.getById(hrOrgApproverRequest.getOrgApproverId());
|
||||
if (ObjectUtil.isEmpty(hrOrgApprover)) {
|
||||
throw new ServiceException(HrOrgApproverExceptionEnum.HR_ORG_APPROVER_NOT_EXISTED);
|
||||
}
|
||||
return hrOrgApprover;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建查询wrapper
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/09/13 23:15
|
||||
*/
|
||||
private LambdaQueryWrapper<HrOrgApprover> createWrapper(HrOrgApproverRequest hrOrgApproverRequest) {
|
||||
LambdaQueryWrapper<HrOrgApprover> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Long orgApproverId = hrOrgApproverRequest.getOrgApproverId();
|
||||
Integer orgApproverType = hrOrgApproverRequest.getOrgApproverType();
|
||||
Long orgId = hrOrgApproverRequest.getOrgId();
|
||||
Long userId = hrOrgApproverRequest.getUserId();
|
||||
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(orgApproverId), HrOrgApprover::getOrgApproverId, orgApproverId);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(orgApproverType), HrOrgApprover::getOrgApproverType, orgApproverType);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(orgId), HrOrgApprover::getOrgId, orgId);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(userId), HrOrgApprover::getUserId, userId);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue