package com.xdap.self_development.domain.view;

import com.definesys.mpaas.query.annotation.SQL;
import com.definesys.mpaas.query.annotation.SQLQuery;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@SQLQuery(value = {
        @SQL(view = "getAllParameters",
                sql = "SELECT DISTINCT mp.parameter_name as 'parameterName', mp.id as 'parameterId' FROM yfsjglpt_model_parameter mp INNER JOIN yfsjglpt_model_parameter_and_template mpat ON mp.id = mpat.parameter_id INNER JOIN yfsjglpt_model_template mt ON mpat.template_id = mt.id INNER JOIN ( SELECT template_name, MAX(version) AS max_version FROM yfsjglpt_model_template WHERE status = 'COMPLETE' GROUP BY template_name ) latest ON mt.template_name = latest.template_name AND mt.version = latest.max_version WHERE mt.status = 'COMPLETE' and mp.subsystem_name = #subsystem ORDER BY mp.parameter_name ")
})
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ParametersView {
    private String parameterId;
    private String parameterName;
    private String parameterType;

    private String subsystem;
    private String partsName;
}
