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.time.LocalDate; import java.util.List; /** * 员工社保公积金档案 Mapper * * @author 芋道源码 */ @Mapper public interface HrmEmployeeSocialSecurityMapper extends BaseMapperX { default HrmEmployeeSocialSecurityDO selectLatestByUserId(Long userId) { return selectOne(new LambdaQueryWrapperX() .eq(HrmEmployeeSocialSecurityDO::getUserId, userId) .eq(HrmEmployeeSocialSecurityDO::getStatus, 0) .orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate) .last("LIMIT 1")); } default List selectListByUserId(Long userId) { return selectList(new LambdaQueryWrapperX() .eq(HrmEmployeeSocialSecurityDO::getUserId, userId) .orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate)); } default PageResult selectPage(HrmEmployeeSocialSecurityPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(HrmEmployeeSocialSecurityDO::getUserId, reqVO.getUserId()) .eqIfPresent(HrmEmployeeSocialSecurityDO::getStatus, reqVO.getStatus()) .eqIfPresent(HrmEmployeeSocialSecurityDO::getEffectiveDate, reqVO.getEffectiveDate()) .orderByDesc(HrmEmployeeSocialSecurityDO::getId)); } }