feat(oa): 工资发放记录增加员工姓名字段并优化查询功能
- 在 GearSalaryRecordsVo 中添加 employeeName 字段,用于显示员工姓名 - 在 GearSalaryRecordsMapper 中新增 selectVoPagePlus 方法,用于分页查询 - 更新 GearSalaryRecordsMapper.xml,添加新的 SQL 查询语句 - 修改 GearSalaryRecordsServiceImpl 中的 queryPageList 方法,使用新的查询方法- 优化查询条件构建逻辑,使用表别名提高查询效率
This commit is contained in:
@@ -108,5 +108,9 @@ public class GearSalaryRecordsVo {
|
||||
@ExcelProperty(value = "发放状态")
|
||||
private String payStatus;
|
||||
|
||||
//联查昵称
|
||||
@ExcelProperty(value = "员工姓名")
|
||||
private String employeeName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.oa.domain.GearSalaryRecords;
|
||||
import com.gear.oa.domain.vo.GearSalaryRecordsVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 工资发放记录Mapper接口
|
||||
@@ -12,4 +15,5 @@ import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface GearSalaryRecordsMapper extends BaseMapperPlus<GearSalaryRecordsMapper, GearSalaryRecords, GearSalaryRecordsVo> {
|
||||
|
||||
Page<GearSalaryRecordsVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<GearSalaryRecords> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gear.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
@@ -44,11 +45,33 @@ public class GearSalaryRecordsServiceImpl implements IGearSalaryRecordsService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<GearSalaryRecordsVo> queryPageList(GearSalaryRecordsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<GearSalaryRecords> lqw = buildQueryWrapper(bo);
|
||||
Page<GearSalaryRecordsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
QueryWrapper<GearSalaryRecords> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<GearSalaryRecordsVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<GearSalaryRecords> buildQueryWrapperPlus(GearSalaryRecordsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<GearSalaryRecords> lqw = Wrappers.query();
|
||||
// 使用表别名 sr 来构建查询条件
|
||||
lqw.eq(bo.getEmployeeId() != null, "sr.employee_id", bo.getEmployeeId());
|
||||
lqw.eq(bo.getPayPeriod() != null, "sr.pay_period", bo.getPayPeriod());
|
||||
lqw.eq(bo.getBaseSalary() != null, "sr.base_salary", bo.getBaseSalary());
|
||||
lqw.eq(bo.getPerformanceBonus() != null, "sr.performance_bonus", bo.getPerformanceBonus());
|
||||
lqw.eq(bo.getOvertimePay() != null, "sr.overtime_pay", bo.getOvertimePay());
|
||||
lqw.eq(bo.getAllowance() != null, "sr.allowance", bo.getAllowance());
|
||||
lqw.eq(bo.getSocialSecurity() != null, "sr.social_security", bo.getSocialSecurity());
|
||||
lqw.eq(bo.getHousingFund() != null, "sr.housing_fund", bo.getHousingFund());
|
||||
lqw.eq(bo.getIncomeTax() != null, "sr.income_tax", bo.getIncomeTax());
|
||||
lqw.eq(bo.getGrossSalary() != null, "sr.gross_salary", bo.getGrossSalary());
|
||||
lqw.eq(bo.getNetSalary() != null, "sr.net_salary", bo.getNetSalary());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPayStatus()), "sr.pay_status", bo.getPayStatus());
|
||||
// 逻辑删除
|
||||
lqw.eq("sr.del_flag", "0");
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询工资发放记录列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user