package cn.iocoder.yudao.module.pms.dal.mysql.depttype;

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.pms.controller.admin.depttype.vo.IotDeptTypePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.depttype.IotDeptTypeDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 部门类型 Mapper
 *
 * @author rq
 */
@Mapper
public interface IotDeptTypeMapper extends BaseMapperX<IotDeptTypeDO> {

    default PageResult<IotDeptTypeDO> selectPage(IotDeptTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeptTypeDO>()
                .eqIfPresent(IotDeptTypeDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(IotDeptTypeDO::getName, reqVO.getName())
                .eqIfPresent(IotDeptTypeDO::getType, reqVO.getType())
                .betweenIfPresent(IotDeptTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDeptTypeDO::getId));
    }

    default List<IotDeptTypeDO> selectList(IotDeptTypePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IotDeptTypeDO>()
                .eqIfPresent(IotDeptTypeDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(IotDeptTypeDO::getName, reqVO.getName())
                .eqIfPresent(IotDeptTypeDO::getType, reqVO.getType())
                .betweenIfPresent(IotDeptTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDeptTypeDO::getId));
    }

}