package cn.iocoder.yudao.module.pms.dal.mysql.yanfan.thingsmodel;

import java.util.*;

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.pms.controller.admin.yanfan.thingsmodeltemplate.vo.IotYfThingsModelTemplatePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.thingsmodeltemplate.IotYfThingsModelTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * yf物模型模板 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotYfThingsModelTemplateMapper extends BaseMapperX<IotYfThingsModelTemplateDO> {

    default PageResult<IotYfThingsModelTemplateDO> selectPage(IotYfThingsModelTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotYfThingsModelTemplateDO>()
                .likeIfPresent(IotYfThingsModelTemplateDO::getTemplateName, reqVO.getTemplateName())
                .likeIfPresent(IotYfThingsModelTemplateDO::getTenantName, reqVO.getTenantName())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIdentifier, reqVO.getIdentifier())
                .eqIfPresent(IotYfThingsModelTemplateDO::getType, reqVO.getType())
                .eqIfPresent(IotYfThingsModelTemplateDO::getDatatype, reqVO.getDatatype())
                .eqIfPresent(IotYfThingsModelTemplateDO::getSpecs, reqVO.getSpecs())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsSys, reqVO.getIsSys())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsChart, reqVO.getIsChart())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsMonitor, reqVO.getIsMonitor())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsHistory, reqVO.getIsHistory())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsReadonly, reqVO.getIsReadonly())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsSharePerm, reqVO.getIsSharePerm())
                .eqIfPresent(IotYfThingsModelTemplateDO::getModelOrder, reqVO.getModelOrder())
                .eqIfPresent(IotYfThingsModelTemplateDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(IotYfThingsModelTemplateDO::getCreateBy, reqVO.getCreateBy())
                .betweenIfPresent(IotYfThingsModelTemplateDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotYfThingsModelTemplateDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(IotYfThingsModelTemplateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(IotYfThingsModelTemplateDO::getTempSlaveId, reqVO.getTempSlaveId())
                .eqIfPresent(IotYfThingsModelTemplateDO::getFormula, reqVO.getFormula())
                .eqIfPresent(IotYfThingsModelTemplateDO::getReverseFormula, reqVO.getReverseFormula())
                .eqIfPresent(IotYfThingsModelTemplateDO::getRegAddr, reqVO.getRegAddr())
                .eqIfPresent(IotYfThingsModelTemplateDO::getBitOption, reqVO.getBitOption())
                .eqIfPresent(IotYfThingsModelTemplateDO::getValueType, reqVO.getValueType())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsParams, reqVO.getIsParams())
                .eqIfPresent(IotYfThingsModelTemplateDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotYfThingsModelTemplateDO::getCode, reqVO.getCode())
                .eqIfPresent(IotYfThingsModelTemplateDO::getOldIdentifier, reqVO.getOldIdentifier())
                .eqIfPresent(IotYfThingsModelTemplateDO::getOldTempSlaveId, reqVO.getOldTempSlaveId())
                .eqIfPresent(IotYfThingsModelTemplateDO::getParseType, reqVO.getParseType())
                .orderByDesc(IotYfThingsModelTemplateDO::getTemplateId));
    }

    default List<IotYfThingsModelTemplateDO> selectList(IotYfThingsModelTemplatePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IotYfThingsModelTemplateDO>()
                .likeIfPresent(IotYfThingsModelTemplateDO::getTemplateName, reqVO.getTemplateName())
                .likeIfPresent(IotYfThingsModelTemplateDO::getTenantName, reqVO.getTenantName())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIdentifier, reqVO.getIdentifier())
                .eqIfPresent(IotYfThingsModelTemplateDO::getType, reqVO.getType())
                .eqIfPresent(IotYfThingsModelTemplateDO::getDatatype, reqVO.getDatatype())
                .eqIfPresent(IotYfThingsModelTemplateDO::getSpecs, reqVO.getSpecs())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsSys, reqVO.getIsSys())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsChart, reqVO.getIsChart())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsMonitor, reqVO.getIsMonitor())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsHistory, reqVO.getIsHistory())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsReadonly, reqVO.getIsReadonly())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsSharePerm, reqVO.getIsSharePerm())
                .eqIfPresent(IotYfThingsModelTemplateDO::getModelOrder, reqVO.getModelOrder())
                .eqIfPresent(IotYfThingsModelTemplateDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(IotYfThingsModelTemplateDO::getCreateBy, reqVO.getCreateBy())
                .betweenIfPresent(IotYfThingsModelTemplateDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotYfThingsModelTemplateDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(IotYfThingsModelTemplateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(IotYfThingsModelTemplateDO::getTempSlaveId, reqVO.getTempSlaveId())
                .eqIfPresent(IotYfThingsModelTemplateDO::getFormula, reqVO.getFormula())
                .eqIfPresent(IotYfThingsModelTemplateDO::getReverseFormula, reqVO.getReverseFormula())
                .eqIfPresent(IotYfThingsModelTemplateDO::getRegAddr, reqVO.getRegAddr())
                .eqIfPresent(IotYfThingsModelTemplateDO::getBitOption, reqVO.getBitOption())
                .eqIfPresent(IotYfThingsModelTemplateDO::getValueType, reqVO.getValueType())
                .eqIfPresent(IotYfThingsModelTemplateDO::getIsParams, reqVO.getIsParams())
                .eqIfPresent(IotYfThingsModelTemplateDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotYfThingsModelTemplateDO::getCode, reqVO.getCode())
                .eqIfPresent(IotYfThingsModelTemplateDO::getOldIdentifier, reqVO.getOldIdentifier())
                .eqIfPresent(IotYfThingsModelTemplateDO::getOldTempSlaveId, reqVO.getOldTempSlaveId())
                .eqIfPresent(IotYfThingsModelTemplateDO::getParseType, reqVO.getParseType())
                .orderByDesc(IotYfThingsModelTemplateDO::getTemplateId));
    }

    default List<IotYfThingsModelTemplateDO> selectListByIds(List<Long> ids) {
        return selectList(new LambdaQueryWrapperX<IotYfThingsModelTemplateDO>()
                .inIfPresent(IotYfThingsModelTemplateDO::getTemplateId, ids)
                .orderByDesc(IotYfThingsModelTemplateDO::getTemplateId));
    }

    List<IotYfThingsModelTemplateDO> selectAllByTemplateId(@Param("templateId") Long templateId, @Param("tempSlaveId") String tempSlaveId);
    List<IotYfThingsModelTemplateDO> selectThingsModelTemplateByTemplateIds(@Param("templateIds") Long[] templateIds, @Param("language") String language);
}
