10 天以前 8c14b50773a1e582b652c03f5a63bb2233d069b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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<HrmEmployeeSocialSecurityDO> {
 
    default HrmEmployeeSocialSecurityDO selectLatestByUserId(Long userId) {
        return selectOne(new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
                .eq(HrmEmployeeSocialSecurityDO::getUserId, userId)
                .eq(HrmEmployeeSocialSecurityDO::getStatus, 0)
                .orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate)
                .last("LIMIT 1"));
    }
 
    default List<HrmEmployeeSocialSecurityDO> selectListByUserId(Long userId) {
        return selectList(new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
                .eq(HrmEmployeeSocialSecurityDO::getUserId, userId)
                .orderByDesc(HrmEmployeeSocialSecurityDO::getEffectiveDate));
    }
 
    default PageResult<HrmEmployeeSocialSecurityDO> selectPage(HrmEmployeeSocialSecurityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HrmEmployeeSocialSecurityDO>()
                .eqIfPresent(HrmEmployeeSocialSecurityDO::getUserId, reqVO.getUserId())
                .eqIfPresent(HrmEmployeeSocialSecurityDO::getStatus, reqVO.getStatus())
                .eqIfPresent(HrmEmployeeSocialSecurityDO::getEffectiveDate, reqVO.getEffectiveDate())
                .orderByDesc(HrmEmployeeSocialSecurityDO::getId));
    }
 
}