package cn.iocoder.yudao.module.smartfactory.dal.mysql.factory;

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.smartfactory.controller.admin.factory.vo.SfFactoryInfoPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factory.SfFactoryInfoDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工厂信息 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface SfFactoryInfoMapper extends BaseMapperX<SfFactoryInfoDO> {

    default PageResult<SfFactoryInfoDO> selectPage(SfFactoryInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SfFactoryInfoDO>()
                .likeIfPresent(SfFactoryInfoDO::getFullName, reqVO.getFullName())
                .likeIfPresent(SfFactoryInfoDO::getShortName, reqVO.getShortName())
                .eqIfPresent(SfFactoryInfoDO::getType, reqVO.getType())
                .eqIfPresent(SfFactoryInfoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(SfFactoryInfoDO::getProvinceId, reqVO.getProvinceId())
                .likeIfPresent(SfFactoryInfoDO::getProvinceName, reqVO.getProvinceName())
                .eqIfPresent(SfFactoryInfoDO::getCityId, reqVO.getCityId())
                .likeIfPresent(SfFactoryInfoDO::getCityName, reqVO.getCityName())
                .eqIfPresent(SfFactoryInfoDO::getDistrictId, reqVO.getDistrictId())
                .likeIfPresent(SfFactoryInfoDO::getDistrictName, reqVO.getDistrictName())
                .eqIfPresent(SfFactoryInfoDO::getLng, reqVO.getLng())
                .eqIfPresent(SfFactoryInfoDO::getLat, reqVO.getLat())
                .eqIfPresent(SfFactoryInfoDO::getAddress, reqVO.getAddress())
                .eqIfPresent(SfFactoryInfoDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SfFactoryInfoDO::getVehicleNum, reqVO.getVehicleNum())
                .eqIfPresent(SfFactoryInfoDO::getVehicleCo2, reqVO.getVehicleCo2())
                .eqIfPresent(SfFactoryInfoDO::getSort, reqVO.getSort())
                .eqIfPresent(SfFactoryInfoDO::getHikServerHost, reqVO.getHikServerHost())
                .eqIfPresent(SfFactoryInfoDO::getHikAppKey, reqVO.getHikAppKey())
                .eqIfPresent(SfFactoryInfoDO::getHikAppSecret, reqVO.getHikAppSecret())
                .betweenIfPresent(SfFactoryInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SfFactoryInfoDO::getId));
    }

}