package com.dayou.service.impl;

import com.dayou.entity.UserArchive;
import com.dayou.mapper.UserArchiveMapper;
import com.dayou.service.IUserArchiveService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dayou.utils.ExcelUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import com.dayou.enums.BatchTaskTypeEnum;

/**
 * <p>
 * 员工档案 服务实现类
 * </p>
 *
 * @author wucl
 * @since 2024-09-02
 */
@Service
public class UserArchiveServiceImpl extends ServiceImpl<UserArchiveMapper, UserArchive> implements IUserArchiveService {

    @Autowired
    private UserArchiveMapper userArchiveMapper;

    @Override
    @SuppressWarnings("unchecked")
    public Page<UserArchive> selectPage(Page page,UserArchive userArchive){
        return this.page(page, new QueryWrapper<UserArchive>(userArchive));
    }


    @Override
    public UserArchive detail(Long id){
        return this.getById(id);
    }

    @Override
    public Boolean add(UserArchive userArchive){
        return  this.save(userArchive);
    }

    @Override
    public Boolean update(UserArchive userArchive){
        return  this.updateById(userArchive);
    }

    @Override
    public Boolean delete(Long id){
        //逻辑删除
        return this.removeById(id);
    }

    @Override
    public UserArchive getRegistrationNoByUserId(Long userId) {
        return  userArchiveMapper.getRegistrationNoByUserId(userId);
    }
}
