feat(perf): 添加绩效系统部门管理功能
- 创建 PerfDept 实体类定义部门基本信息字段 - 实现 IPerfDeptService 接口提供部门增删改查方法 - 开发 PerfDeptController 控制器支持 RESTful API 操作 - 集成 MyBatis Plus 完成数据库映射与分页查询 - 添加部门信息的导入导出 Excel 功能 - 实现部门状态校验与批量删除验证逻辑 - 配置部门 VO 视图对象支持 Excel 数据转换
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.klp.perf.service;
|
||||
|
||||
import com.klp.perf.domain.PerfDept;
|
||||
import com.klp.perf.domain.vo.PerfDeptVo;
|
||||
import com.klp.perf.domain.bo.PerfDeptBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 绩效系统部门Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-07
|
||||
*/
|
||||
public interface IPerfDeptService {
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门
|
||||
*/
|
||||
PerfDeptVo queryById(String id);
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门列表
|
||||
*/
|
||||
TableDataInfo<PerfDeptVo> queryPageList(PerfDeptBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门列表
|
||||
*/
|
||||
List<PerfDeptVo> queryList(PerfDeptBo bo);
|
||||
|
||||
/**
|
||||
* 新增绩效系统部门
|
||||
*/
|
||||
Boolean insertByBo(PerfDeptBo bo);
|
||||
|
||||
/**
|
||||
* 修改绩效系统部门
|
||||
*/
|
||||
Boolean updateByBo(PerfDeptBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除绩效系统部门信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.klp.perf.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.perf.domain.bo.PerfDeptBo;
|
||||
import com.klp.perf.domain.vo.PerfDeptVo;
|
||||
import com.klp.perf.domain.PerfDept;
|
||||
import com.klp.perf.mapper.PerfDeptMapper;
|
||||
import com.klp.perf.service.IPerfDeptService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 绩效系统部门Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-07
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class PerfDeptServiceImpl implements IPerfDeptService {
|
||||
|
||||
private final PerfDeptMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门
|
||||
*/
|
||||
@Override
|
||||
public PerfDeptVo queryById(String id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PerfDeptVo> queryPageList(PerfDeptBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<PerfDept> lqw = buildQueryWrapper(bo);
|
||||
Page<PerfDeptVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绩效系统部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<PerfDeptVo> queryList(PerfDeptBo bo) {
|
||||
LambdaQueryWrapper<PerfDept> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<PerfDept> buildQueryWrapper(PerfDeptBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<PerfDept> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), PerfDept::getDeptName, bo.getDeptName());
|
||||
lqw.eq(bo.getOrderNum() != null, PerfDept::getOrderNum, bo.getOrderNum());
|
||||
lqw.eq(bo.getHasBaoSalary() != null, PerfDept::getHasBaoSalary, bo.getHasBaoSalary());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), PerfDept::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绩效系统部门
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(PerfDeptBo bo) {
|
||||
PerfDept add = BeanUtil.toBean(bo, PerfDept.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绩效系统部门
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(PerfDeptBo bo) {
|
||||
PerfDept update = BeanUtil.toBean(bo, PerfDept.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(PerfDept entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除绩效系统部门
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user