package cn.iocoder.yudao.module.asset.dal.mysql.parking;

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.asset.controller.admin.parking.vo.ParkingPageReqVO;
import cn.iocoder.yudao.module.asset.dal.dataobject.parking.ParkingDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 停车场 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ParkingMapper extends BaseMapperX<ParkingDO> {

    default PageResult<ParkingDO> selectPage(ParkingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ParkingDO>()
                .likeIfPresent(ParkingDO::getName, reqVO.getName())
                .likeIfPresent(ParkingDO::getAddress, reqVO.getAddress())
                .likeIfPresent(ParkingDO::getProvince, reqVO.getProvince())
                .likeIfPresent(ParkingDO::getCity, reqVO.getCity())
                .likeIfPresent(ParkingDO::getManagerName, reqVO.getManagerName())
                .betweenIfPresent(ParkingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ParkingDO::getId));
    }

    default List<ParkingDO> selectSimpleList() {
        return selectList();
    }

}
