package com.zksy.info.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zksy.info.domain.EEmployeeBenefit;
import com.zksy.info.service.EEmployeeBenefitService;
import com.zksy.info.mapper.EEmployeeBenefitMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_employee_benefit(员工福利管理表)】的数据库操作Service实现
* @createDate 2025-06-30 10:07:40
*/
@Service
public class EEmployeeBenefitServiceImpl extends ServiceImpl<EEmployeeBenefitMapper, EEmployeeBenefit>
    implements EEmployeeBenefitService{

    @Override
    public Page<EEmployeeBenefit> findByPage(long pageNum, long pageSize, String employeeNo, String fullName, String benefitStatus) {
        Page<EEmployeeBenefit> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<EEmployeeBenefit> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(employeeNo != null,EEmployeeBenefit::getEmployeeNo,employeeNo);
        queryWrapper.like(fullName != null,EEmployeeBenefit::getFullName,fullName);
        queryWrapper.like(benefitStatus != null,EEmployeeBenefit::getBenefitStatus,benefitStatus);
        queryWrapper.orderByDesc(EEmployeeBenefit::getUpdateTime);
        Page<EEmployeeBenefit> pageResult = this.page(page, queryWrapper);
        return pageResult;
    }

    @Override
    public List<EEmployeeBenefit> getEEmployeeBenefitList(String employeeNo, String fullName, String benefitStatus) {
        LambdaQueryWrapper<EEmployeeBenefit> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(employeeNo != null,EEmployeeBenefit::getEmployeeNo,employeeNo);
        queryWrapper.like(fullName != null,EEmployeeBenefit::getFullName,fullName);
        queryWrapper.like(benefitStatus != null,EEmployeeBenefit::getBenefitStatus,benefitStatus);
        queryWrapper.orderByDesc(EEmployeeBenefit::getUpdateTime);
        List<EEmployeeBenefit> list = this.list(queryWrapper);
        return list;
    }
}




