package cn.iocoder.yudao.module.hrm.dal.mysql.salary; import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmSalaryPaymentDetailPageReqVO; import cn.iocoder.yudao.module.hrm.dal.dataobject.salary.HrmSalaryPaymentDetailDO; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.Collections; import java.util.List; /** * 薪资发放明细 Mapper * * @author 超级管理员 */ @Mapper public interface HrmSalaryPaymentDetailMapper extends BaseMapperX { default PageResult selectPage(HrmSalaryPaymentDetailPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(HrmSalaryPaymentDetailDO::getPaymentId, reqVO.getPaymentId()) .eqIfPresent(HrmSalaryPaymentDetailDO::getUserId, reqVO.getUserId()) .eqIfPresent(HrmSalaryPaymentDetailDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(HrmSalaryPaymentDetailDO::getStatus, reqVO.getStatus()) .orderByAsc(HrmSalaryPaymentDetailDO::getUserId)); } default List selectListByPaymentId(Long paymentId) { return selectList(HrmSalaryPaymentDetailDO::getPaymentId, paymentId); } default List selectListByPaymentIdAndStatus(Long paymentId, Integer status) { return selectList(new LambdaQueryWrapperX() .eq(HrmSalaryPaymentDetailDO::getPaymentId, paymentId) .eq(HrmSalaryPaymentDetailDO::getStatus, status)); } default HrmSalaryPaymentDetailDO selectByCalculationId(Long calculationId) { return selectOne(HrmSalaryPaymentDetailDO::getCalculationId, calculationId); } /** * 批量查询:哪些核算单已被工资发放明细引用 * * 用于删除核算单前做引用保护,避免发放明细变成孤儿数据。 */ default List selectListByCalculationIds(Collection calculationIds) { if (CollUtil.isEmpty(calculationIds)) { return Collections.emptyList(); } return selectList(new LambdaQueryWrapperX() .in(HrmSalaryPaymentDetailDO::getCalculationId, calculationIds)); } }