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.EEmployeeMaster;
import com.zksy.info.service.EEmployeeMasterService;
import com.zksy.info.mapper.EEmployeeMasterMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_employee_master(员工合同管理表)】的数据库操作Service实现
* @createDate 2025-06-27 15:57:22
*/
@Service
public class EEmployeeMasterServiceImpl extends ServiceImpl<EEmployeeMasterMapper, EEmployeeMaster>
    implements EEmployeeMasterService{

    @Override
    public Page<EEmployeeMaster> findByPage(long pageNum, long pageSize, String contractStatus, String fullName, String contractNo) {
        Page<EEmployeeMaster> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<EEmployeeMaster> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(contractStatus != null ,EEmployeeMaster::getContractStatus,contractStatus);
        queryWrapper.like(fullName != null ,EEmployeeMaster::getFullName,fullName);
        queryWrapper.like(contractNo != null ,EEmployeeMaster::getContractNo,contractNo);
        queryWrapper.orderByDesc(EEmployeeMaster::getUpdateTime);
        Page<EEmployeeMaster> pageResult = this.page(page, queryWrapper);
        return pageResult;
    }

    @Override
    public List<EEmployeeMaster> getEEmployeeMasterList(String contractStatus, String fullName, String contractNo) {
        LambdaQueryWrapper<EEmployeeMaster> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(contractStatus != null ,EEmployeeMaster::getContractStatus,contractStatus);
        queryWrapper.like(fullName != null ,EEmployeeMaster::getFullName,fullName);
        queryWrapper.like(contractNo != null ,EEmployeeMaster::getContractNo,contractNo);
        queryWrapper.orderByDesc(EEmployeeMaster::getUpdateTime);
        List<EEmployeeMaster> list = this.list(queryWrapper);
        return list;
    }
}




