package com.tzy.common.config;

import org.teasoft.bee.osql.exception.SqlNullException;
import org.teasoft.honey.osql.util.PropertiesReader;

public class QuerySql {
    private static PropertiesReader querySqlSqlProp = new PropertiesReader("config/sql.properties");

    public QuerySql() {
    }

    public static String getQuerySql(String sqlId) {
        String sql = querySqlSqlProp.getValue(sqlId);
        if (sql == null) {
            throw new SqlNullException("The sql statement string get by sqlId:" + sqlId + ", is Null !");
        } else if ("".equals(sql.trim())) {
            throw new SqlNullException("The sql statement string get by sqlId:" + sqlId + ", is empty !");
        } else {
            return sql;
        }
    }
}