package com.yunzhupaas.portal.model;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.MyBatisPrimaryBase;
import com.yunzhupaas.portal.constant.PortalConst;
import com.yunzhupaas.portal.entity.PortalDataEntity;
import lombok.Data;

/**
 * 类功能
 *
 * @author 云筑产品开发平台组
 * @version v3.4.8
 * @copyrignt 深圳市乐程软件有限公司
 * @date 2023-04-21
 */
@Data
public class PortalModPrimary extends MyBatisPrimaryBase<PortalDataEntity> {

    /**
     * 门户ID
     */
    private String portalId;

    /**
     * 类型（model：模型、custom：自定义）
     */
    private String type = PortalConst.MODEL;

    public PortalModPrimary(String portalId){
        this.portalId = portalId;
    }

    public QueryWrapper<PortalDataEntity> getQuery(){
        queryWrapper.lambda().eq(PortalDataEntity::getType, type);
        if(this.portalId != null) queryWrapper.lambda().eq(PortalDataEntity::getPortalId, portalId);
        return queryWrapper;
    }

}

