Commit 56f2abf2 authored by 刘斌's avatar 刘斌

feat: 增加人事管理-预览

parent 8bacb454
......@@ -7,7 +7,7 @@ import org.springframework.cache.annotation.EnableCaching;
@Slf4j
@EnableCaching
@SpringBootApplication(scanBasePackages = {"top.binfast.app", "com.example"})
@SpringBootApplication(scanBasePackages = {"top.binfast.daemon.codegen", "top.binfast.app", "com.example"})
public class Application {
public static void main(String[] args) {
......
package com.example.constant;
/**
* @author 刘斌
* @date 2025/10/29 10:24
*/
public interface HrConstant {
/**
* 员工性别
*/
String HR_USER_SEX = "hr_user_sex";
/**
* 员工年龄组
*/
String HR_AGE_GROUP = "hr_age_group";
/**
* 员工婚姻状况
*/
String HR_MARITAL_STATUS = "hr_marital_status"; // 设备类型
/**
* 员工政治面貌
*/
String HR_POLITICAL_STATUS = "hr_political_status"; // 授权类型
/**
* 员工工龄段
*/
String HR_YEARS_SERVICE_SEGMENT = "hr_years_service_segment";
/**
* 员工学历
*/
String HR_EDUCATION = "hr_education"; // 通知状态
/**
* 员工类型
*/
String HR_EMPLOYEE_TYPE = "hr_employee_type"; // 通知类型
/**
* 员工用工形式
*/
String HR_EMPLOYMENT_FORM = "hr_employment_form";
}
package com.example.controller;
import java.util.List;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.binfast.common.core.constant.BusinessType;
import top.binfast.common.core.validate.AddGroup;
import top.binfast.common.core.validate.EditGroup;
import top.binfast.common.core.util.ResponseUtils;
import top.binfast.common.excel.annotion.ExcelExport;
import top.binfast.common.log.annotation.PinSysLog;
import com.example.domain.params.EmployeeDeptListParam;
import com.example.domain.params.EmployeeDeptParam;
import com.example.domain.vo.EmployeeDeptVo;
import com.example.service.EmployeeDeptServ;
/**
* 员工部门
*
* @author LiuBin
* @date 2025-10-30
*/
@Validated
@RestController
@RequestMapping("/app/dept")
public class EmployeeDeptCtrl {
@Resource
private EmployeeDeptServ employeeDeptServ;
/**
* 查询员工部门列表
*/
@SaCheckPermission("app:dept:list")
@GetMapping("/page")
public PageResponse<EmployeeDeptVo> pageList(EmployeeDeptListParam param) {
return employeeDeptServ.queryPageList(param);
}
/**
* 导出员工部门列表
*/
@ExcelExport
@SaCheckPermission("app:dept:export")
@PinSysLog(value = "员工部门", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public List<EmployeeDeptVo> export(EmployeeDeptListParam param) {
return employeeDeptServ.queryList(param);
}
/**
* 获取员工部门详细信息
*
* @param id 主键
*/
@SaCheckPermission("app:dept:query")
@GetMapping("/{id}")
public SingleResponse<EmployeeDeptVo> getDetail(@PathVariable @Min(1)
Long id) {
return SingleResponse.of(employeeDeptServ.queryById(id));
}
/**
* 新增员工部门
*/
@SaCheckPermission("app:dept:add")
@PinSysLog(value = "员工部门", businessType = BusinessType.INSERT)
@PostMapping()
public Response add(@Validated(AddGroup.class) @RequestBody EmployeeDeptParam param) {
return ResponseUtils.ofResult(employeeDeptServ.insertByParam(param));
}
/**
* 修改员工部门
*/
@SaCheckPermission("app:dept:edit")
@PinSysLog(value = "员工部门", businessType = BusinessType.UPDATE)
@PutMapping()
public Response edit(@Validated(EditGroup.class) @RequestBody EmployeeDeptParam param) {
return ResponseUtils.ofResult(employeeDeptServ.updateByParam(param));
}
/**
* 删除员工部门
*
* @param ids 主键串
*/
@SaCheckPermission("app:dept:remove")
@PinSysLog(value = "员工部门", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Response remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return ResponseUtils.ofResult(employeeDeptServ.delByIds(List.of(ids)));
}
}
\ No newline at end of file
package com.example.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.example.domain.EmployeeInfo;
import com.example.domain.params.EmployeeInfoListParam;
import com.example.domain.params.EmployeeInfoParam;
import com.example.domain.vo.EmployeeInfoImportVo;
import com.example.domain.vo.EmployeeInfoVo;
import com.example.service.EmployeeInfoServ;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import org.dromara.core.trans.anno.TransMethodResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.binfast.app.biz.sysapi.bean.vo.sysUser.SysUserImportVo;
import top.binfast.common.core.constant.BusinessType;
import top.binfast.common.core.util.Json;
import top.binfast.common.core.util.MapstructUtils;
import top.binfast.common.core.util.ResponseUtils;
import top.binfast.common.core.validate.AddGroup;
import top.binfast.common.core.validate.EditGroup;
import top.binfast.common.excel.annotion.ExcelExport;
import top.binfast.common.excel.annotion.ExcelStream;
import top.binfast.common.excel.core.ExcelDownHandler;
import top.binfast.common.log.annotation.PinSysLog;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
/**
* 员工信息
*
* @author LiuBin
* @date 2025-10-28
*/
@Validated
@RestController
@RequestMapping("/employee/info")
public class EmployeeInfoCtrl {
@Resource
private EmployeeInfoServ employeeInfoServ;
/**
* 查询员工信息列表
*/
@TransMethodResult
@SaCheckPermission("employee:info:list")
@GetMapping("/page")
public PageResponse<EmployeeInfoVo> pageList(EmployeeInfoListParam param) {
return employeeInfoServ.queryPageList(param);
}
/**
* 导出员工信息列表
*/
@ExcelExport(template = "导出简历模板.xlsx", fill = true)
@SaCheckPermission("employee:info:export")
@PinSysLog(value = "员工信息", businessType = BusinessType.EXPORT)
@PostMapping("/export/{id}")
public List<EmployeeInfoVo> export(@PathVariable Long id) {
EmployeeInfoVo vo = employeeInfoServ.queryById(id);
vo.setOnDuty("1".equals(vo.getEmployeeType()) ? "在职" : "离职");
return List.of(vo);
}
/**
* 导入员工信息列表
*/
@PinSysLog(value = "系统用户", businessType = BusinessType.IMPORT)
@SaCheckPermission("employee:info:import")
@PostMapping(value = "/excel/import")
public Response importWithOptions(@ExcelStream(headRowNumber = 2) Stream<EmployeeInfoImportVo> stream) {
return employeeInfoServ.importEmployeeList(stream);
}
/**
* 获取导入模板
*/
@ExcelExport(template = "模板.xlsx", fill = true)
@PostMapping("/importTemplate")
public List<EmployeeInfoImportVo> importTemplate() {
return new ArrayList<>();
}
/**
* 获取员工信息详细信息
*
* @param id 主键
*/
@SaCheckPermission("employee:info:query")
@GetMapping("/{id}")
public SingleResponse<EmployeeInfoVo> getDetail(@PathVariable @Min(1)
Long id) {
return SingleResponse.of(employeeInfoServ.queryById(id));
}
/**
* 新增员工信息
*/
@SaCheckPermission("employee:info:add")
@PinSysLog(value = "员工信息", businessType = BusinessType.INSERT)
@PostMapping()
public Response add(@Validated(AddGroup.class) @RequestBody EmployeeInfoParam param) {
return ResponseUtils.ofResult(employeeInfoServ.insertByParam(param));
}
/**
* 修改员工信息
*/
@SaCheckPermission("employee:info:edit")
@PinSysLog(value = "员工信息", businessType = BusinessType.UPDATE)
@PutMapping()
public Response edit(@Validated(EditGroup.class) @RequestBody EmployeeInfoParam param) {
return ResponseUtils.ofResult(employeeInfoServ.updateByParam(param));
}
/**
* 删除员工信息
*
* @param ids 主键串
*/
@SaCheckPermission("employee:info:remove")
@PinSysLog(value = "员工信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Response remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return ResponseUtils.ofResult(employeeInfoServ.delByIds(List.of(ids)));
}
}
\ No newline at end of file
package com.example.domain;
import top.binfast.common.mybatis.bean.model.TenantModel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 员工部门对象 employee_dept
*
* @author LiuBin
* @date 2025-10-30
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@TableName("employee_dept")
public class EmployeeDept extends TenantModel {
@Serial
private static final long serialVersionUID = 1L;
/**
* 父级部门
*/
private Long parentId;
/**
* 部门名称
*/
private String name;
/**
* 祖级关系
*/
private String nodePath;
/**
* 显示顺序
*/
private Long orderNum;
/**
* 状态
*/
private Integer status;
}
package com.example.domain;
import top.binfast.common.mybatis.bean.model.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate;;
import java.io.Serial;
/**
* 员工信息对象 employee_info
*
* @author LiuBin
* @date 2025-10-28
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@TableName("employee_info")
public class EmployeeInfo extends BaseModel {
@Serial
private static final long serialVersionUID = 1L;
/**
* 板块
*/
private String plate;
/**
* 项目
*/
private String project;
/**
* 一级部门
*/
private String firstLevelDepartment;
/**
* 二级部门
*/
private String secondLevelDepartment;
/**
* 工号
*/
private String employeeId;
/**
* 职级
*/
private String jobLevel;
/**
* 岗位
*/
private String position;
/**
* 职务
*/
private String post;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private String gender;
/**
* 身份证号码
*/
private String idCardNumber;
/**
* 出生日期
*/
private LocalDate birthDate;
/**
* 年龄
*/
private Integer age;
/**
* 年龄段
*/
private String ageGroup;
/**
* 籍贯
*/
private String nativePlace;
/**
* 民族
*/
private String ethnicity;
/**
* 婚姻状况
*/
private String maritalStatus;
/**
* 政治面貌
*/
private String politicalStatus;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 紧急联系人
*/
private String emergencyContact;
/**
* 紧急联系人电话
*/
private String emergencyContactPhone;
/**
* 家庭地址
*/
private String homeAddress;
/**
* 户口所在地
*/
private String householdRegistrationAddress;
/**
* 参加工作时间
*/
private LocalDate workStartDate;
/**
* 入职时间
*/
private LocalDate entryDate;
/**
* 工龄
*/
private String yearsOfService;
/**
* 工龄段
*/
private String yearsOfServiceSegment;
/**
* 学历
*/
private String education;
/**
* 学位
*/
private String degree;
/**
* 毕业时间
*/
private LocalDate graduationDate;
/**
* 专业
*/
private String major;
/**
* 毕业院校
*/
private String graduateSchool;
/**
* 员工类型
*/
private String employeeType;
/**
* 职称情况
*/
private String professionalTitle;
/**
* 简历
*/
private String resume;
/**
* 用工形式
*/
private String employmentForm;
/**
* 劳动合同期限
*/
private String contractTerm;
/**
* 劳动合同开始时间
*/
private LocalDate contractStartDate;
/**
* 劳动合同截止时间
*/
private LocalDate contractEndDate;
/**
* 合同到期提醒
*/
private LocalDate contractExpirationReminder;
/**
* 劳动合同签订情况
*/
private String contractSigningStatus;
/**
* 合同主体
*/
private String contractEntity;
/**
* 转正时间
*/
private LocalDate regularizationDate;
/**
* 异动情况
*/
private String transferStatus;
/**
* 奖惩情况
*/
private String rewardPunishmentStatus;
/**
* 备注
*/
private String remarks;
/**
* 离职时间
*/
private LocalDate resignationDate;
/**
* 离职原因
*/
private String resignationReason;
}
package com.example.domain.params;
import lombok.Getter;
import lombok.Setter;
import top.binfast.common.core.bean.params.PageQueryParam;
import java.util.HashMap;
import java.util.Map;
/**
* 员工部门分页对象 employee_dept
*
* @author LiuBin
* @date 2025-10-30
*/
@Getter
@Setter
public class EmployeeDeptListParam extends PageQueryParam {
/**
* 父级部门
*/
private Long parentId;
/**
* 部门名称
*/
private String name;
/**
* 祖级关系
*/
private String nodePath;
/**
* 显示顺序
*/
private Long orderNum;
/**
* 状态
*/
private Integer status;
private Map<String, Object> params = new HashMap<>();
}
package com.example.domain.params;
import com.example.domain.EmployeeDept;
import top.binfast.common.core.validate.AddGroup;
import top.binfast.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import jakarta.validation.constraints.*;
/**
* 员工部门业务对象 employee_dept
*
* @author LiuBin
* @date 2025-10-30
*/
@Data
@AutoMapper(target = EmployeeDept.class, reverseConvertGenerate = false)
public class EmployeeDeptParam {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 父级部门
*/
@NotNull(message = "父级部门不能为空", groups = { AddGroup.class, EditGroup.class })
private Long parentId;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String name;
/**
* 祖级关系
*/
@NotBlank(message = "祖级关系不能为空", groups = { AddGroup.class, EditGroup.class })
private String nodePath;
/**
* 显示顺序
*/
@NotNull(message = "显示顺序不能为空", groups = { AddGroup.class, EditGroup.class })
private Long orderNum;
/**
* 状态
*/
@NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer status;
}
package com.example.domain.params;
import lombok.Getter;
import lombok.Setter;
import top.binfast.common.core.bean.params.PageQueryParam;
import java.util.HashMap;
import java.util.Map;
import java.math.BigDecimal;
import java.time.LocalDate;;
/**
* 员工信息分页对象 employee_info
*
* @author LiuBin
* @date 2025-10-28
*/
@Getter
@Setter
public class EmployeeInfoListParam extends PageQueryParam {
/**
* 板块
*/
private String plate;
/**
* 项目
*/
private String project;
/**
* 一级部门
*/
private String firstLevelDepartment;
/**
* 二级部门
*/
private String secondLevelDepartment;
/**
* 工号
*/
private String employeeId;
/**
* 职级
*/
private String jobLevel;
/**
* 岗位
*/
private String position;
/**
* 职务
*/
private String post;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private String gender;
/**
* 身份证号码
*/
private String idCardNumber;
/**
* 出生日期
*/
private LocalDate birthDate;
/**
* 年龄
*/
private Integer age;
/**
* 年龄段
*/
private String ageGroup;
/**
* 籍贯
*/
private String nativePlace;
/**
* 民族
*/
private String ethnicity;
/**
* 婚姻状况
*/
private String maritalStatus;
/**
* 政治面貌
*/
private String politicalStatus;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 紧急联系人
*/
private String emergencyContact;
/**
* 紧急联系人电话
*/
private String emergencyContactPhone;
/**
* 家庭地址
*/
private String homeAddress;
/**
* 户口所在地
*/
private String householdRegistrationAddress;
/**
* 参加工作时间
*/
private LocalDate workStartDate;
/**
* 入职时间
*/
private LocalDate entryDate;
/**
* 工龄
*/
private String yearsOfService;
/**
* 工龄段
*/
private String yearsOfServiceSegment;
/**
* 学历
*/
private String education;
/**
* 学位
*/
private String degree;
/**
* 毕业时间
*/
private LocalDate graduationDate;
/**
* 专业
*/
private String major;
/**
* 毕业院校
*/
private String graduateSchool;
/**
* 员工类型
*/
private String employeeType;
/**
* 职称情况
*/
private String professionalTitle;
/**
* 简历
*/
private String resume;
/**
* 用工形式
*/
private String employmentForm;
/**
* 劳动合同期限
*/
private String contractTerm;
/**
* 劳动合同开始时间
*/
private LocalDate contractStartDate;
/**
* 劳动合同截止时间
*/
private LocalDate contractEndDate;
/**
* 合同到期提醒
*/
private LocalDate contractExpirationReminder;
/**
* 劳动合同签订情况
*/
private String contractSigningStatus;
/**
* 合同主体
*/
private String contractEntity;
/**
* 转正时间
*/
private LocalDate regularizationDate;
/**
* 异动情况
*/
private String transferStatus;
/**
* 奖惩情况
*/
private String rewardPunishmentStatus;
/**
* 备注
*/
private String remarks;
/**
* 离职时间
*/
private LocalDate resignationDate;
/**
* 离职原因
*/
private String resignationReason;
private Map<String, Object> params = new HashMap<>();
}
package com.example.domain.params;
import com.example.domain.EmployeeInfo;
import top.binfast.common.core.validate.AddGroup;
import top.binfast.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDate;;
/**
* 员工信息业务对象 employee_info
*
* @author LiuBin
* @date 2025-10-28
*/
@Data
@AutoMapper(target = EmployeeInfo.class, reverseConvertGenerate = false)
public class EmployeeInfoParam {
/**
* 序号
*/
@NotNull(message = "序号不能为空", groups = { EditGroup.class })
private Long id;
/**
* 板块
*/
@NotBlank(message = "板块不能为空", groups = { AddGroup.class, EditGroup.class })
private String plate;
/**
* 项目
*/
@NotBlank(message = "项目不能为空", groups = { AddGroup.class, EditGroup.class })
private String project;
/**
* 一级部门
*/
@NotBlank(message = "一级部门不能为空", groups = { AddGroup.class, EditGroup.class })
private String firstLevelDepartment;
/**
* 二级部门
*/
@NotBlank(message = "二级部门不能为空", groups = { AddGroup.class, EditGroup.class })
private String secondLevelDepartment;
/**
* 工号
*/
@NotBlank(message = "工号不能为空", groups = { AddGroup.class, EditGroup.class })
private String employeeId;
/**
* 职级
*/
@NotBlank(message = "职级不能为空", groups = { AddGroup.class, EditGroup.class })
private String jobLevel;
/**
* 岗位
*/
@NotBlank(message = "岗位不能为空", groups = { AddGroup.class, EditGroup.class })
private String position;
/**
* 职务
*/
@NotBlank(message = "职务不能为空", groups = { AddGroup.class, EditGroup.class })
private String post;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class })
private String name;
/**
* 性别
*/
@NotBlank(message = "性别不能为空", groups = { AddGroup.class, EditGroup.class })
private String gender;
/**
* 身份证号码
*/
@NotBlank(message = "身份证号码不能为空", groups = { AddGroup.class, EditGroup.class })
private String idCardNumber;
/**
* 出生日期
*/
@NotNull(message = "出生日期不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate birthDate;
/**
* 年龄
*/
@NotNull(message = "年龄不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer age;
/**
* 年龄段
*/
@NotBlank(message = "年龄段不能为空", groups = { AddGroup.class, EditGroup.class })
private String ageGroup;
/**
* 籍贯
*/
@NotBlank(message = "籍贯不能为空", groups = { AddGroup.class, EditGroup.class })
private String nativePlace;
/**
* 民族
*/
@NotBlank(message = "民族不能为空", groups = { AddGroup.class, EditGroup.class })
private String ethnicity;
/**
* 婚姻状况
*/
@NotBlank(message = "婚姻状况不能为空", groups = { AddGroup.class, EditGroup.class })
private String maritalStatus;
/**
* 政治面貌
*/
@NotBlank(message = "政治面貌不能为空", groups = { AddGroup.class, EditGroup.class })
private String politicalStatus;
/**
* 手机号码
*/
@NotBlank(message = "手机号码不能为空", groups = { AddGroup.class, EditGroup.class })
private String phoneNumber;
/**
* 紧急联系人
*/
@NotBlank(message = "紧急联系人不能为空", groups = { AddGroup.class, EditGroup.class })
private String emergencyContact;
/**
* 紧急联系人电话
*/
@NotBlank(message = "紧急联系人电话不能为空", groups = { AddGroup.class, EditGroup.class })
private String emergencyContactPhone;
/**
* 家庭地址
*/
@NotBlank(message = "家庭地址不能为空", groups = { AddGroup.class, EditGroup.class })
private String homeAddress;
/**
* 户口所在地
*/
@NotBlank(message = "户口所在地不能为空", groups = { AddGroup.class, EditGroup.class })
private String householdRegistrationAddress;
/**
* 参加工作时间
*/
@NotNull(message = "参加工作时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate workStartDate;
/**
* 入职时间
*/
@NotNull(message = "入职时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate entryDate;
/**
* 工龄
*/
@NotNull(message = "工龄不能为空", groups = { AddGroup.class, EditGroup.class })
private String yearsOfService;
/**
* 工龄段
*/
@NotBlank(message = "工龄段不能为空", groups = { AddGroup.class, EditGroup.class })
private String yearsOfServiceSegment;
/**
* 学历
*/
@NotBlank(message = "学历不能为空", groups = { AddGroup.class, EditGroup.class })
private String education;
/**
* 学位
*/
@NotBlank(message = "学位不能为空", groups = { AddGroup.class, EditGroup.class })
private String degree;
/**
* 毕业时间
*/
@NotNull(message = "毕业时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate graduationDate;
/**
* 专业
*/
@NotBlank(message = "专业不能为空", groups = { AddGroup.class, EditGroup.class })
private String major;
/**
* 毕业院校
*/
@NotBlank(message = "毕业院校不能为空", groups = { AddGroup.class, EditGroup.class })
private String graduateSchool;
/**
* 员工类型
*/
@NotBlank(message = "员工类型不能为空", groups = { AddGroup.class, EditGroup.class })
private String employeeType;
/**
* 职称情况
*/
@NotBlank(message = "职称情况不能为空", groups = { AddGroup.class, EditGroup.class })
private String professionalTitle;
/**
* 简历
*/
@NotBlank(message = "简历不能为空", groups = { AddGroup.class, EditGroup.class })
private String resume;
/**
* 用工形式
*/
@NotBlank(message = "用工形式不能为空", groups = { AddGroup.class, EditGroup.class })
private String employmentForm;
/**
* 劳动合同期限
*/
@NotBlank(message = "劳动合同期限不能为空", groups = { AddGroup.class, EditGroup.class })
private String contractTerm;
/**
* 劳动合同开始时间
*/
@NotNull(message = "劳动合同开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate contractStartDate;
/**
* 劳动合同截止时间
*/
@NotNull(message = "劳动合同截止时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate contractEndDate;
/**
* 合同到期提醒
*/
@NotNull(message = "合同到期提醒不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate contractExpirationReminder;
/**
* 劳动合同签订情况
*/
@NotBlank(message = "劳动合同签订情况不能为空", groups = { AddGroup.class, EditGroup.class })
private String contractSigningStatus;
/**
* 合同主体
*/
@NotBlank(message = "合同主体不能为空", groups = { AddGroup.class, EditGroup.class })
private String contractEntity;
/**
* 转正时间
*/
@NotNull(message = "转正时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate regularizationDate;
/**
* 异动情况
*/
// @NotBlank(message = "异动情况不能为空", groups = { AddGroup.class, EditGroup.class })
private String transferStatus;
/**
* 奖惩情况
*/
// @NotBlank(message = "奖惩情况不能为空", groups = { AddGroup.class, EditGroup.class })
private String rewardPunishmentStatus;
/**
* 备注
*/
// @NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
private String remarks;
/**
* 离职时间
*/
// @NotNull(message = "离职时间不能为空", groups = { AddGroup.class, EditGroup.class })
private LocalDate resignationDate;
/**
* 离职原因
*/
// @NotBlank(message = "离职原因不能为空", groups = { AddGroup.class, EditGroup.class })
private String resignationReason;
}
package com.example.domain.vo;
import com.example.domain.EmployeeDept;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelIgnore;
import top.binfast.common.excel.annotion.ExcelDictFormat;
import top.binfast.common.excel.converters.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 员工部门视图对象 employee_dept
*
* @author LiuBin
* @date 2025-10-30
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = EmployeeDept.class)
public class EmployeeDeptVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 父级部门
*/
@ExcelProperty(value = "父级部门")
private Long parentId;
/**
* 部门名称
*/
@ExcelProperty(value = "部门名称")
private String name;
/**
* 祖级关系
*/
@ExcelProperty(value = "祖级关系")
private String nodePath;
/**
* 显示顺序
*/
@ExcelProperty(value = "显示顺序")
private Long orderNum;
/**
* 状态
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "SYS_COMMON_STATUS")
private Integer status;
}
package com.example.domain.vo;
import cn.idev.excel.annotation.ExcelProperty;
import com.example.constant.HrConstant;
import com.example.domain.EmployeeInfo;
import com.example.domain.params.EmployeeInfoParam;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import top.binfast.common.excel.annotion.ExcelDictFormat;
import top.binfast.common.excel.bean.ExcelBaseEntity;
import top.binfast.common.excel.converters.ExcelDictConvert;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author 刘斌
* @date 2025/10/29 09:42
*/
@Getter
@Setter
@AutoMappers({
@AutoMapper(target = EmployeeInfo.class, reverseConvertGenerate = false),
@AutoMapper(target = EmployeeInfoParam.class, reverseConvertGenerate = false)
})
public class EmployeeInfoImportVo extends ExcelBaseEntity implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 板块
*/
@NotBlank(message = "板块不能为空")
@ExcelProperty(value = "板块")
private String plate;
/**
* 项目
*/
@NotBlank(message = "项目不能为空")
@ExcelProperty(value = "项目")
private String project;
/**
* 一级部门
*/
@NotBlank(message = "一级部门不能为空")
@ExcelProperty(value = "一级部门")
private String firstLevelDepartment;
/**
* 二级部门
*/
@ExcelProperty(value = "二级部门")
private String secondLevelDepartment;
/**
* 工号
*/
@NotBlank(message = "工号不能为空")
@ExcelProperty(value = "工号")
private String employeeId;
/**
* 职级
*/
@ExcelProperty(value = "职级")
private String jobLevel;
/**
* 岗位
*/
@NotBlank(message = "岗位不能为空")
@ExcelProperty(value = "岗位")
private String position;
/**
* 职务
*/
@ExcelProperty(value = "职务")
private String post;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
@ExcelProperty(value = "姓名")
private String name;
/**
* 性别
*/
@NotBlank(message = "性别不能为空")
@ExcelProperty(value = "性别", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_USER_SEX)
private String gender;
// /**
// * 性别
// */
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_USER_SEX,refs = {"genderName"})
// private String gender;
/**
* 身份证号码
*/
@NotBlank(message = "身份证号码不能为空")
@ExcelProperty(value = "身份证号码")
private String idCardNumber;
/**
* 出生日期
*/
@ExcelProperty(value = "出生日期")
private LocalDate birthDate;
/**
* 年龄
*/
@NotNull(message = "年龄不能为空")
@ExcelProperty(value = "年龄")
private Integer age;
/**
* 年龄段
*/
@ExcelProperty(value = "年龄段", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_AGE_GROUP)
private String ageGroup;
// /**
// * 年龄段
// */
//// @ExcelProperty(value = "年龄段")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_AGE_GROUP,refs = {"ageGroupName"})
// private String ageGroup;
/**
* 籍贯
*/
@ExcelProperty(value = "籍贯")
private String nativePlace;
/**
* 民族
*/
@ExcelProperty(value = "民族")
private String ethnicity;
/**
* 婚姻状况
*/
@ExcelProperty(value = "婚姻状况", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_MARITAL_STATUS)
private String maritalStatus;
// /**
// * 婚姻状况
// */
//// @ExcelProperty(value = "婚姻状况")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_MARITAL_STATUS,refs = {"maritalStatusName"})
// private String maritalStatus;
/**
* 政治面貌
*/
@ExcelProperty(value = "政治面貌", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_POLITICAL_STATUS)
private String politicalStatus;
//
// /**
// * 政治面貌
// */
// @ExcelProperty(value = "政治面貌")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_POLITICAL_STATUS,refs = {"politicalStatusName"})
// private String politicalStatus;
/**
* 手机号码
*/
@NotBlank(message = "手机号码不能为空")
@ExcelProperty(value = "手机号码")
private String phoneNumber;
/**
* 紧急联系人
*/
@ExcelProperty(value = "紧急联系人")
private String emergencyContact;
/**
* 紧急联系人电话
*/
@ExcelProperty(value = "紧急联系人电话")
private String emergencyContactPhone;
/**
* 家庭地址
*/
@ExcelProperty(value = "家庭地址")
private String homeAddress;
/**
* 户口所在地
*/
@ExcelProperty(value = "户口所在地")
private String householdRegistrationAddress;
/**
* 参加工作时间
*/
@ExcelProperty(value = "参加工作时间")
private LocalDate workStartDate;
/**
* 入职时间
*/
@ExcelProperty(value = "入职时间")
private LocalDate entryDate;
/**
* 工龄
*/
@ExcelProperty(value = "工龄")
private String yearsOfService;
/**
* 工龄段
*/
@ExcelProperty(value = "工龄段", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_YEARS_SERVICE_SEGMENT)
private String yearsOfServiceSegment;
// /**
// * 工龄段
// */
// @ExcelProperty(value = "工龄段")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_YEARS_SERVICE_SEGMENT,refs = {"yearsOfServiceSegmentName"})
// private String yearsOfServiceSegment;
/**
* 学历
*/
@ExcelProperty(value = "学历")
private String education;
/**
* 学位
*/
@ExcelProperty(value = "学位")
private String degree;
/**
* 毕业时间
*/
@ExcelProperty(value = "毕业时间")
private LocalDate graduationDate;
/**
* 专业
*/
@ExcelProperty(value = "专业")
private String major;
/**
* 毕业院校
*/
@ExcelProperty(value = "毕业院校")
private String graduateSchool;
/**
* 员工类型
*/
@ExcelProperty(value = "员工类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_EMPLOYEE_TYPE)
private String employeeType;
// /**
// * 员工类型
// */
//// @ExcelProperty(value = "员工类型")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_EMPLOYEE_TYPE,refs = {"employeeTypeName"})
// private String employeeType;
/**
* 职称情况
*/
@ExcelProperty(value = "职称情况")
private String professionalTitle;
/**
* 简历
*/
@ExcelProperty(value = "简历")
private String resume;
/**
* 用工形式
*/
// @ExcelProperty(value = "用工形式")
@ExcelProperty(value = "用工形式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_EMPLOYMENT_FORM)
private String employmentForm;
// /**
// * 用工形式
// */
//// @ExcelProperty(value = "用工形式")
// @UnTrans(type= UnTransType.DICTIONARY, dict= HrConstant.HR_EMPLOYMENT_FORM,refs = {"employmentFormName"})
// private String employmentForm;
/**
* 劳动合同期限
*/
@ExcelProperty(value = "劳动合同期限")
private String contractTerm;
/**
* 劳动合同开始时间
*/
@ExcelProperty(value = "劳动合同开始时间")
private LocalDate contractStartDate;
/**
* 劳动合同截止时间
*/
@ExcelProperty(value = "劳动合同截止时间")
private LocalDate contractEndDate;
/**
* 合同到期提醒
*/
@ExcelProperty(value = "合同到期提醒")
private LocalDate contractExpirationReminder;
/**
* 劳动合同签订情况
*/
@ExcelProperty(value = "劳动合同签订情况")
private String contractSigningStatus;
/**
* 合同主体
*/
@ExcelProperty(value = "合同主体")
private String contractEntity;
/**
* 转正时间
*/
@ExcelProperty(value = "转正时间")
private LocalDate regularizationDate;
/**
* 异动情况
*/
@ExcelProperty(value = "异动情况")
private String transferStatus;
/**
* 奖惩情况
*/
@ExcelProperty(value = "奖惩情况")
private String rewardPunishmentStatus;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remarks;
/**
* 离职时间
*/
@ExcelProperty(value = "离职时间")
private LocalDate resignationDate;
/**
* 离职原因
*/
@ExcelProperty(value = "离职原因")
private String resignationReason;
}
package com.example.domain.vo;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDate;
import com.example.constant.HrConstant;
import com.example.domain.EmployeeInfo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelIgnore;
import org.dromara.core.trans.anno.Trans;
import org.dromara.core.trans.constant.TransType;
import org.dromara.core.trans.vo.TransPojo;
import top.binfast.common.excel.annotion.ExcelDictFormat;
import top.binfast.common.excel.converters.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 员工信息视图对象 employee_info
*
* @author LiuBin
* @date 2025-10-28
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = EmployeeInfo.class)
public class EmployeeInfoVo implements TransPojo, Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 序号
*/
private Long id;
/**
* 板块
*/
@ExcelProperty(value = "板块")
private String plate;
/**
* 项目
*/
@ExcelProperty(value = "项目")
private String project;
/**
* 一级部门
*/
@ExcelProperty(value = "一级部门")
private String firstLevelDepartment;
/**
* 二级部门
*/
@ExcelProperty(value = "二级部门")
private String secondLevelDepartment;
/**
* 工号
*/
@ExcelProperty(value = "工号")
private String employeeId;
/**
* 职级
*/
@ExcelProperty(value = "职级")
private String jobLevel;
/**
* 岗位
*/
@ExcelProperty(value = "岗位")
private String position;
/**
* 职务
*/
@ExcelProperty(value = "职务")
private String post;
/**
* 姓名
*/
@ExcelProperty(value = "姓名")
private String name;
/**
* 性别
*/
@ExcelProperty(value = "性别", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_USER_SEX)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_USER_SEX)
private String gender;
/**
* 身份证号码
*/
@ExcelProperty(value = "身份证号码")
private String idCardNumber;
/**
* 出生日期
*/
@ExcelProperty(value = "出生日期")
private LocalDate birthDate;
/**
* 年龄
*/
@ExcelProperty(value = "年龄")
private Integer age;
/**
* 年龄段
*/
@ExcelProperty(value = "年龄段", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_AGE_GROUP)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_AGE_GROUP)
private String ageGroup;
/**
* 籍贯
*/
@ExcelProperty(value = "籍贯")
private String nativePlace;
/**
* 民族
*/
@ExcelProperty(value = "民族")
private String ethnicity;
/**
* 婚姻状况
*/
@ExcelProperty(value = "婚姻状况", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_MARITAL_STATUS)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_MARITAL_STATUS)
private String maritalStatus;
/**
* 政治面貌
*/
@ExcelProperty(value = "政治面貌", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_POLITICAL_STATUS)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_POLITICAL_STATUS)
private String politicalStatus;
/**
* 手机号码
*/
@ExcelProperty(value = "手机号码")
private String phoneNumber;
/**
* 紧急联系人
*/
@ExcelProperty(value = "紧急联系人")
private String emergencyContact;
/**
* 紧急联系人电话
*/
@ExcelProperty(value = "紧急联系人电话")
private String emergencyContactPhone;
/**
* 家庭地址
*/
@ExcelProperty(value = "家庭地址")
private String homeAddress;
/**
* 户口所在地
*/
@ExcelProperty(value = "户口所在地")
private String householdRegistrationAddress;
/**
* 参加工作时间
*/
@ExcelProperty(value = "参加工作时间")
private LocalDate workStartDate;
/**
* 入职时间
*/
@ExcelProperty(value = "入职时间")
private LocalDate entryDate;
/**
* 工龄
*/
@ExcelProperty(value = "工龄")
private String yearsOfService;
/**
* 工龄段
*/
@ExcelProperty(value = "工龄段", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_YEARS_SERVICE_SEGMENT)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_YEARS_SERVICE_SEGMENT)
private String yearsOfServiceSegment;
/**
* 学历
*/
@ExcelProperty(value = "学历")
private String education;
/**
* 学位
*/
@ExcelProperty(value = "学位")
private String degree;
/**
* 毕业时间
*/
@ExcelProperty(value = "毕业时间")
private LocalDate graduationDate;
/**
* 专业
*/
@ExcelProperty(value = "专业")
private String major;
/**
* 毕业院校
*/
@ExcelProperty(value = "毕业院校")
private String graduateSchool;
/**
* 员工类型
*/
@ExcelProperty(value = "员工类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_EMPLOYEE_TYPE)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_EMPLOYEE_TYPE)
private String employeeType;
/**
* 职称情况
*/
@ExcelProperty(value = "职称情况")
private String professionalTitle;
/**
* 简历
*/
@ExcelProperty(value = "简历")
private String resume;
/**
* 用工形式
*/
@ExcelProperty(value = "用工形式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = HrConstant.HR_EMPLOYMENT_FORM)
@Trans(type = TransType.DICTIONARY, key = HrConstant.HR_EMPLOYMENT_FORM)
private String employmentForm;
/**
* 劳动合同期限
*/
@ExcelProperty(value = "劳动合同期限")
private String contractTerm;
/**
* 劳动合同开始时间
*/
@ExcelProperty(value = "劳动合同开始时间")
private LocalDate contractStartDate;
/**
* 劳动合同截止时间
*/
@ExcelProperty(value = "劳动合同截止时间")
private LocalDate contractEndDate;
/**
* 合同到期提醒
*/
@ExcelProperty(value = "合同到期提醒")
private LocalDate contractExpirationReminder;
/**
* 劳动合同签订情况
*/
@ExcelProperty(value = "劳动合同签订情况")
private String contractSigningStatus;
/**
* 合同主体
*/
@ExcelProperty(value = "合同主体")
private String contractEntity;
/**
* 转正时间
*/
@ExcelProperty(value = "转正时间")
private LocalDate regularizationDate;
/**
* 异动情况
*/
@ExcelProperty(value = "异动情况")
private String transferStatus;
/**
* 奖惩情况
*/
@ExcelProperty(value = "奖惩情况")
private String rewardPunishmentStatus;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remarks;
/**
* 离职时间
*/
@ExcelProperty(value = "离职时间")
private LocalDate resignationDate;
/**
* 离职原因
*/
@ExcelProperty(value = "离职原因")
private String resignationReason;
/**
* 是否转正
*/
@ExcelProperty(value = "是否转正")
private String onDuty;
}
package com.example.mapper;
import com.example.domain.EmployeeDept;
import top.binfast.common.mybatis.mapper.BinBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 员工部门Mapper接口
*
* @author LiuBin
* @date 2025-10-30
*/
@Mapper
public interface EmployeeDeptMapper extends BinBaseMapper<EmployeeDept> {
}
package com.example.mapper;
import com.example.domain.EmployeeInfo;
import top.binfast.common.mybatis.mapper.BinBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 员工信息Mapper接口
*
* @author LiuBin
* @date 2025-10-28
*/
@Mapper
public interface EmployeeInfoMapper extends BinBaseMapper<EmployeeInfo> {
}
package com.example.service;
import com.example.domain.EmployeeDept;
import com.example.domain.vo.EmployeeDeptVo;
import com.example.domain.params.EmployeeDeptListParam;
import com.example.domain.params.EmployeeDeptParam;
import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 员工部门Service接口
*
* @author LiuBin
* @date 2025-10-30
*/
public interface EmployeeDeptServ extends IService<EmployeeDept> {
/**
* 分页查询员工部门列表
*
* @param param 查询条件
* @return 员工部门分页列表
*/
PageResponse<EmployeeDeptVo> queryPageList(EmployeeDeptListParam param);
/**
* 查询符合条件的员工部门列表
*
* @param param 查询条件
* @return 员工部门列表
*/
List<EmployeeDeptVo> queryList(EmployeeDeptListParam param);
/**
* 查询员工部门
*
* @param id 主键
* @return 员工部门
*/
EmployeeDeptVo queryById(Long id);
/**
* 新增员工部门
*
* @param param 员工部门
* @return 是否新增成功
*/
Boolean insertByParam(EmployeeDeptParam param);
/**
* 修改员工部门
*
* @param param 员工部门
* @return 是否修改成功
*/
Boolean updateByParam(EmployeeDeptParam param);
/**
* 校验并批量删除员工部门信息
*
* @param ids 待删除的主键集合
* @return 是否删除成功
*/
Boolean delByIds(List<Long> ids);
}
package com.example.service;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.domain.EmployeeInfo;
import com.example.domain.params.EmployeeInfoListParam;
import com.example.domain.params.EmployeeInfoParam;
import com.example.domain.vo.EmployeeInfoImportVo;
import com.example.domain.vo.EmployeeInfoVo;
import java.util.List;
import java.util.stream.Stream;
/**
* 员工信息Service接口
*
* @author LiuBin
* @date 2025-10-28
*/
public interface EmployeeInfoServ extends IService<EmployeeInfo> {
/**
* 分页查询员工信息列表
*
* @param param 查询条件
* @return 员工信息分页列表
*/
PageResponse<EmployeeInfoVo> queryPageList(EmployeeInfoListParam param);
/**
* 查询符合条件的员工信息列表
*
* @param param 查询条件
* @return 员工信息列表
*/
List<EmployeeInfoVo> queryList(EmployeeInfoListParam param);
/**
* 导入员工信息列表
*
* @param stream 员工信息列表
* @return 是否导入成功
*/
Response importEmployeeList(Stream<EmployeeInfoImportVo> stream);
/**
* 校验员工名称是否唯一
*
* @param param 员工信息
* @return 是否唯一
*/
Boolean checkEmployeeNameUnique(EmployeeInfoParam param);
/**
* 查询员工信息
*
* @param id 主键
* @return 员工信息
*/
EmployeeInfoVo queryById(Long id);
/**
* 新增员工信息
*
* @param param 员工信息
* @return 是否新增成功
*/
Boolean insertByParam(EmployeeInfoParam param);
/**
* 修改员工信息
*
* @param param 员工信息
* @return 是否修改成功
*/
Boolean updateByParam(EmployeeInfoParam param);
/**
* 校验并批量删除员工信息信息
*
* @param ids 待删除的主键集合
* @return 是否删除成功
*/
Boolean delByIds(List<Long> ids);
}
package com.example.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.binfast.common.core.util.MapstructUtils;
import top.binfast.common.mybatis.util.QueryUtil;
import com.example.domain.EmployeeDept;
import com.example.domain.vo.EmployeeDeptVo;
import com.example.domain.params.EmployeeDeptListParam;
import com.example.domain.params.EmployeeDeptParam;
import com.example.mapper.EmployeeDeptMapper;
import com.example.service.EmployeeDeptServ;
import java.util.List;
/**
* 员工部门Service业务层处理
*
* @author LiuBin
* @date 2025-10-30
*/
@RequiredArgsConstructor
@Service
public class EmployeeDeptServImpl extends ServiceImpl<EmployeeDeptMapper, EmployeeDept> implements EmployeeDeptServ {
private final EmployeeDeptMapper employeeDeptMapper;
/**
* 分页查询员工部门列表
*
* @param param 查询条件
* @return 员工部门分页列表
*/
@Override
public PageResponse<EmployeeDeptVo> queryPageList(EmployeeDeptListParam param) {
Page<EmployeeDept> page = QueryUtil.getPage(param);
LambdaQueryWrapper<EmployeeDept> lambdaQuery = this.buildQueryWrapper(param);
employeeDeptMapper.selectPage(page, lambdaQuery);
return QueryUtil.getPageResponse(page, MapstructUtils.convert(page.getRecords(), EmployeeDeptVo.class));
}
/**
* 查询符合条件的员工部门列表
*
* @param param 查询条件
* @return 员工部门列表
*/
@Override
public List<EmployeeDeptVo> queryList(EmployeeDeptListParam param) {
LambdaQueryWrapper<EmployeeDept> lambdaQuery = this.buildQueryWrapper(param);
return MapstructUtils.convert(employeeDeptMapper.selectList(lambdaQuery), EmployeeDeptVo.class);
}
private LambdaQueryWrapper<EmployeeDept> buildQueryWrapper(EmployeeDeptListParam param) {
LambdaQueryWrapper<EmployeeDept> lambdaQuery = Wrappers.<EmployeeDept>lambdaQuery();
lambdaQuery.orderByDesc(EmployeeDept::getId);
lambdaQuery.eq(param.getParentId() != null, EmployeeDept::getParentId, param.getParentId());
lambdaQuery.like(StrUtil.isNotBlank(param.getName()), EmployeeDept::getName, param.getName());
lambdaQuery.eq(StrUtil.isNotBlank(param.getNodePath()), EmployeeDept::getNodePath, param.getNodePath());
lambdaQuery.eq(param.getOrderNum() != null, EmployeeDept::getOrderNum, param.getOrderNum());
lambdaQuery.eq(param.getStatus() != null, EmployeeDept::getStatus, param.getStatus());
return lambdaQuery;
}
/**
* 查询员工部门
*
* @param id 主键
* @return 员工部门
*/
@Override
public EmployeeDeptVo queryById(Long id){
EmployeeDept employeeDept = employeeDeptMapper.selectById(id);
return MapstructUtils.convert(employeeDept, EmployeeDeptVo.class);
}
/**
* 新增员工部门
*
* @param param 员工部门
* @return 是否新增成功
*/
@Override
public Boolean insertByParam(EmployeeDeptParam param) {
EmployeeDept employeeDept = MapstructUtils.convert(param, EmployeeDept.class);
return this.save(employeeDept);
}
/**
* 修改员工部门
*
* @param param 员工部门
* @return 是否修改成功
*/
@Override
public Boolean updateByParam(EmployeeDeptParam param) {
EmployeeDept employeeDept = MapstructUtils.convert(param, EmployeeDept.class);
return this.updateById(employeeDept);
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(EmployeeDept entity){
// 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除员工部门信息
*
* @param ids 待删除的主键集合
* @return 是否删除成功
*/
@Override
// @Transactional(rollbackFor = {Exception.class})
public Boolean delByIds(List<Long> ids) {
//做一些业务上的校验,判断是否需要校验
return this.removeByIds(ids);
}
}
......@@ -69,6 +69,8 @@ management:
# mybaits-plus配置
mybatis-plus:
# 多包名使用 例如
mapper-package: top.binfast.**.dao,top.binfast.**.mapper,com.example.**.mapper
# MyBatis Mapper所对应的XML文件位置
mapper-locations: classpath*:/mapper/**/*Mapper.xml
global-config:
......
<?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="com.example.mapper.EmployeeDeptMapper">
</mapper>
<?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="com.example.mapper.EmployeeInfoMapper">
</mapper>
......@@ -15,7 +15,11 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
<binfast.version>1.2.0</binfast.version>
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
<binfast.version>1.2.2</binfast.version>
<lombok.version>1.18.38</lombok.version>
</properties>
<modules>
......@@ -53,6 +57,22 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!-- 关闭过滤 -->
<filtering>false</filtering>
<!-- <excludes>-->
<!-- <exclude>**/*.xlsx</exclude>-->
<!-- <exclude>**/*.xls</exclude>-->
<!-- </excludes>-->
</resource>
<resource>
<directory>src/main/resources</directory>
<!-- 引入所有 匹配文件进行过滤 -->
<includes>
<include>application*</include>
<include>bootstrap*</include>
<include>banner*</include>
</includes>
<!-- 启用过滤 即该资源中的变量将会被过滤器中的值替换 -->
<filtering>true</filtering>
</resource>
</resources>
......@@ -70,6 +90,47 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
<annotationProcessorPaths>
<!-- <path>-->
<!-- <groupId>org.mapstruct</groupId>-->
<!-- <artifactId>mapstruct-processor</artifactId>-->
<!-- <version>${org.mapstruct.version}</version>-->
<!-- </path>-->
<path>
<groupId>io.github.linpeilie</groupId>
<artifactId>mapstruct-plus-processor</artifactId>
<version>${mapstruct-plus.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>${lombok-mapstruct-binding.version}</version>
</path>
<path>
<groupId>com.github.therapi</groupId>
<artifactId>therapi-runtime-javadoc-scribe</artifactId>
<version>${therapi-javadoc.version}</version>
</path>
</annotationProcessorPaths>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment