package cn.iocoder.yudao.module.basic.dal.mysql.workersinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.basic.dal.dataobject.workersinfo.WorkersInfoDO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.basic.controller.admin.workersinfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 员工 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WorkersInfoMapper extends BaseMapperX<WorkersInfoDO> {

    default PageResult<WorkersInfoDO> selectPage(WorkersInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkersInfoDO>()
                .likeIfPresent(WorkersInfoDO::getWorkersName, reqVO.getWorkersName())
                .eqIfPresent(WorkersInfoDO::getWorkersCode, reqVO.getWorkersCode())
                .eqIfPresent(WorkersInfoDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(WorkersInfoDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .eqIfPresent(WorkersInfoDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(WorkersInfoDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(WorkersInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkersInfoDO::getId));
    }

    IPage<WorkersInfoDO> selectPageByInfo(IPage<WorkersInfoDO> page, @Param(Constants.WRAPPER) Wrapper<WorkersInfoDO> queryWrapper);

}
