package cn.iocoder.yudao.module.system.dal.mysql.position;

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.system.controller.admin.position.vo.PositionPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 岗位信息 Mapper
 *
 * @author 符溶馨
 */
@Mapper
public interface PositionMapper extends BaseMapperX<PositionDO> {

    default PageResult<PositionDO> selectPage(PositionPageReqVO reqVO, List<Long> deptIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PositionDO>()
                .inIfPresent(PositionDO::getDeptId, deptIds)
                .likeIfPresent(PositionDO::getName, reqVO.getName())
                .eqIfPresent(PositionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PositionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PositionDO::getId));
    }

}