package com.zt.plat.module.qms.resource.device.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceAffiliationRelativityDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceAffiliationRelativityPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 附属设备关系 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DeviceAffiliationRelativityMapper extends BaseMapperX<DeviceAffiliationRelativityDO> {

    default PageResult<DeviceAffiliationRelativityDO> selectPage(DeviceAffiliationRelativityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceAffiliationRelativityDO>()
                .eqIfPresent(DeviceAffiliationRelativityDO::getParentProductId, reqVO.getParentProductId())
                .eqIfPresent(DeviceAffiliationRelativityDO::getChildDeviceId, reqVO.getChildDeviceId())
                .eqIfPresent(DeviceAffiliationRelativityDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(DeviceAffiliationRelativityDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceAffiliationRelativityDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceAffiliationRelativityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceAffiliationRelativityDO::getId));
    }

}