package com.xdap.self_development.domain.pojo;

import com.definesys.mpaas.query.annotation.*;
import com.definesys.mpaas.query.model.MpaasBasePojo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@SQLQuery(value = {
        @SQL(view = "getCommonAndGlobalParameters",
                sql = "SELECT ymcp.*, ymgp.parameter_name as 'parameterName', ymgp.parameter_type as 'parameterType', ymgp.subsystem_name as 'subsystemName', ymgp.parts_name as 'partsName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_global_parameter ymgp ON ymcp.parameter_id = ymgp.id WHERE ymcp.common_id IN (#ids) AND ymcp.is_global = 1"),
        @SQL(view = "getCommonAndParameters",
                sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName', ymp.parts_name as 'partsName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.common_id IN (#ids) AND ymcp.is_global = 0"),
        @SQL(view = "getCommonById",
                sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.user_id = #userId")
})
@EqualsAndHashCode(callSuper = true)
@Data
@Table("yfsjglpt_model_common_parameters")
public class ModelCommonParametersPojo extends MpaasBasePojo {
    @RowID(sequence = "model_common_parameters_s", type = RowIDType.UUID)
    private String id;
    private String parameterId;
    private String commonId;
    private Integer isGlobal;

    @Column(type = ColumnType.CALCULATE)
    private String parameterName;
    @Column(type = ColumnType.CALCULATE)
    private String parameterType;
    @Column(type = ColumnType.CALCULATE)
    private String subsystemName;
    @Column(type = ColumnType.CALCULATE)
    private String partsName;
}
