package cn.iocoder.yudao.module.hrm.dal.mysql.salary;
|
|
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.HrmEmployeeSocialSecurityPageReqVO;
|
import cn.iocoder.yudao.module.hrm.dal.dataobject.salary.HrmEmployeeSocialSecurityDO;
|
import org.apache.ibatis.annotations.Mapper;
|
|
import java.util.Collection;
|
import java.util.List;
|
|
/**
|
* 部门社保公积金档案 Mapper
|
*
|
* @author 超级管理员
|
*/
|
@Mapper
|
public interface HrmEmployeeSocialSecurityMapper extends BaseMapperX<HrmEmployeeSocialSecurityDO> {
|
|
default HrmEmployeeSocialSecurityDO selectLatestByDeptId(Long deptId) {
|
return selectOne(new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
|
.eq(HrmEmployeeSocialSecurityDO::getDeptId, deptId)
|
.eq(HrmEmployeeSocialSecurityDO::getStatus, 0)
|
.orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate)
|
.last("LIMIT 1"));
|
}
|
|
/**
|
* 批量查询多个部门各自最新生效的档案,用于薪酬核算时避免逐员工查询
|
*/
|
default List<HrmEmployeeSocialSecurityDO> selectListByDeptIds(Collection<Long> deptIds) {
|
return selectList(new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
|
.inIfPresent(HrmEmployeeSocialSecurityDO::getDeptId, deptIds)
|
.eq(HrmEmployeeSocialSecurityDO::getStatus, 0)
|
.orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate));
|
}
|
|
default List<HrmEmployeeSocialSecurityDO> selectListByDeptId(Long deptId) {
|
return selectList(new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
|
.eq(HrmEmployeeSocialSecurityDO::getDeptId, deptId)
|
.orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate));
|
}
|
|
default PageResult<HrmEmployeeSocialSecurityDO> selectPage(HrmEmployeeSocialSecurityPageReqVO reqVO) {
|
return selectPage(reqVO, new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
|
.eqIfPresent(HrmEmployeeSocialSecurityDO::getDeptId, reqVO.getDeptId())
|
.eqIfPresent(HrmEmployeeSocialSecurityDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(HrmEmployeeSocialSecurityDO::getEffectiveDate, reqVO.getEffectiveDate())
|
.orderByDesc(HrmEmployeeSocialSecurityDO::getId));
|
}
|
|
}
|