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

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.deviceinfo.vo.DeviceInfoPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.deviceInfo.DeviceInfoDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备信息关联门店 Mapper
 *
 * @author 开发账号
 */
@Mapper
public interface DeviceInfoMapper extends BaseMapperX<DeviceInfoDO> {

    default PageResult<DeviceInfoDO> selectPage(DeviceInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceInfoDO>()
                .eqIfPresent(DeviceInfoDO::getDeviceSn, reqVO.getDeviceSn())
                .eqIfPresent(DeviceInfoDO::getCarteenId, reqVO.getCarteenId())
                .eqIfPresent(DeviceInfoDO::getDeviceIp, reqVO.getDeviceIp())
                .likeIfPresent(DeviceInfoDO::getDeviceName, reqVO.getDeviceName())
                .likeIfPresent(DeviceInfoDO::getCarteenName, reqVO.getCarteenName())
                .betweenIfPresent(DeviceInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceInfoDO::getId));
    }

}