package cn.iocoder.yudao.module.safe.dal.mysql.server;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.safe.dal.dataobject.server.SafeServerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.safe.controller.admin.server.vo.*;

import java.util.List;

/**
 * 安防后端设备 Mapper
 *
 * @author caoyang
 */
@Mapper
public interface SafeServerMapper extends BaseMapperX<SafeServerDO> {

    default PageResult<SafeServerDO> selectPage(AppSafeServerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SafeServerDO>()
                .likeIfPresent(SafeServerDO::getName, reqVO.getName())
                .eqIfPresent(SafeServerDO::getType, reqVO.getType())
                .eqIfPresent(SafeServerDO::getBrand, reqVO.getBrand())
                .eqIfPresent(SafeServerDO::getModel, reqVO.getModel())
                .eqIfPresent(SafeServerDO::getOrgId, reqVO.getOrgId())
                .likeIfPresent(SafeServerDO::getDes, reqVO.getDes())
                .orderByDesc(SafeServerDO::getId));
    }

    default List<SafeServerDO> selectByOrgId(Long orgId) {
        return selectList("org_id",orgId);
    }

}
