using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenerateCode_GEBrilliantFactory { /// /// InsertSQL文件生成 /// public class InsertSQL_Generate : BaseGenerate { /// /// 生成InsertSQL /// /// /// /// /// public static string CreateInsertSQLText(string TableName, string Author, string ChinaComment, List columnNameList) { try { StringBuilder sbText = new StringBuilder(); sbText.Append(GetInsertSQLStr(TableName, Author,ChinaComment, columnNameList)); return sbText.ToString(); } catch (Exception) { throw; } } /// /// 生成InsertSQL /// /// /// /// /// private static string GetInsertSQLStr(string TableName, string Author, string ChinaComment, List columnNameList) { var str = TextHelper.ReadText(@"Templete\InitSQL模板.txt"); CommonReplace(ref str); str = str.Replace("$TableName$", TableName);//表名 str = str.Replace("$Author$", Author);//作者 str = str.Replace("$TableName$", TableName);//表名 str = str.Replace("$Author$", Author);//作者 str = str.Replace("$ChinaComment$", ChinaComment);//中文注释 str = str.Replace("$CurDate$", CommonHelper.GetCurDate());//当前时间 string str_insert_cols = StructStrHelper.GetColumnsStrNoIDForAdd(columnNameList, ""); str = str.Replace("$insert_cols$", str_insert_cols); str = str.Replace("$insert_cols_values$", StructStrHelper.GetColumnsStrNoIDForInsertSQL(columnNameList)); return str; } } }