static XElement GetSqlNode(SqlConfEntity conf) { var sqlNode = SqlCfgs[conf.area] .Descendants("sqlarea").Where(e => e.Attribute("name").Value == conf.area) .Descendants("sqlgroup").Where(e => e.Attribute("name").Value == conf.group) .Descendants("sql").Where(e => e.Attribute("name").Value == conf.name) .FirstOrDefault(); return(sqlNode); }
public static string GetTxtSql(SqlConfEntity conf) { if (!conf.Check()) { return(string.Empty); } var sqlNode = GetSqlNode(conf); if (sqlNode == null) { return(string.Empty); } return(sqlNode.Value.Replace("\r\n", " ").Replace("\n", " ").Replace("\t", " ").Trim()); }
public static PageQuerySqlEntity GetPageQuerySql(SqlConfEntity conf) { PageQuerySqlEntity entity = null; if (!conf.Check()) { return(entity); } var sqlNode = GetSqlNode(conf); if (sqlNode == null) { return(entity); } entity = new PageQuerySqlEntity { sp_name = sqlNode.Attribute("sp_name").Value, fields = sqlNode.Attribute("fields").Value, tables = sqlNode.Attribute("tables").Value, where = new StringBuilder(sqlNode.Attribute("where").Value), order = new StringBuilder(sqlNode.Attribute("order").Value), }; return(entity); }