public void GenCodeInterface(TableInfo tableInfo) { string tableName = tableInfo.TableName; // string className = "I" + CodeGenHelper.GetClassName(tableName, cmc.CodeRule) + CodeGenRuleHelper.BLLService; ; string path = string.Format(@"{0}", "ibll.cs.vm"); var dic = GetNVelocityVars(); dic.Add("tableInfo", tableInfo); dic.Add("modelNameSpace", cmc.ModelNameSpace); dic.Add("idalNameSpace", cmc.IDALNameSpace); dic.Add("dalNameSpace", cmc.DALNameSpace); dic.Add("bllNameSpace", cmc.BLLNameSpace); dic.Add("guiPluginName", cmc.PluginName); dic.Add("codeRule", cmc.CodeRule); string str = nVelocityHelper.GenByTemplate(path, dic); string className = "I" + cmc.PluginName + CodeGenRuleHelper.BLLService;; string title = className + ".cs"; if (cmc.IsShowGenCode) { CodeShow(title, str); } else { FileHelper.Write(cmc.OutPut + title, new[] { str }); } }
public void GenCodeInterface(TableInfo tableInfo) { string tableName = tableInfo.TableName; string className = "I" + CodeGenHelper.GetClassName(tableName, cmc.CodeRule) + CodeGenRuleHelper.IBSServer; string path = string.Format(@"{0}", "ibs.java.vm"); var dic = GetNVelocityVars(); dic.Add("tableInfo", tableInfo); dic.Add("bsPackage", cmc.BSPackage); dic.Add("wsPackage", cmc.WSPackage); dic.Add("codeRule", cmc.CodeRule); string str = nVelocityHelper.GenByTemplate(path, dic); string title = className + ".java"; if (cmc.IsShowGenCode) { CodeShow(title, str); } else { FileHelper.Write(cmc.OutPut + title, new[] { str }, SaveFileEncoding); } }
private string GenTriger(TableInfo tableInfo) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("tableInfo", tableInfo); dic.Add("tgGenHelper", new TgGenHelper()); bool isExistAuditAction = false; foreach (ColumnInfo c in tableInfo.Columns) { if ("AUDIT_ACTION".Equals(c.Name.ToUpper())) { isExistAuditAction = true; break; } } string temp = ""; if (isExistAuditAction) { temp = nVelocityHelper.GenByTemplate("tg.bbox.aq.withaudit.sql.vm", dic); } else { temp = nVelocityHelper.GenByTemplate("tg.bbox.aq.withoutaudit.sql.vm", dic); } return(temp); }
private string GenPo(TableInfo table) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("table", table); dic.Add("package", ConstHelper.PoPackage); dic.Add("GenHelper", genHelper); return(nVelocityHelper.GenByTemplate("mdt.po.java.vm", dic)); }
public string GenSqlMapConfig(TableInfo tableInfo) { string path = string.Format(@"{0}", "sqlmapconfig.xml.vm"); var dic = GetNVelocityVars(); dic.Add("tableInfo", tableInfo); dic.Add("bsPackage", cmc.BSPackage); dic.Add("wsPackage", cmc.WSPackage); dic.Add("codeRule", cmc.CodeRule); string str = nVelocityHelper.GenByTemplate(path, dic); return(str); }
public void GenCode(TableInfo tableInfo) { NVelocityHelper nVelocityHelper = new NVelocityHelper(FilePathHelper.TemplatesPath); string tableName = tableInfo.TableName; string path = string.Format(@"{0}", TemplateParas.TemplateName); var dic = GetNVelocityVars(); dic.Add("tableInfo", tableInfo); string str = nVelocityHelper.GenByTemplate(path, dic); string title = tableName + "." + (TemplateParas.CodeLanguage + "").ToLower(); if (!string.IsNullOrEmpty(TemplateParas.SaveFileName)) { title = TemplateParas.SaveFileName; title = nVelocityHelper.GenByStr(title, dic); } if (TemplateParas.IsShowGenCode) { CodeShow(title, str); } else { FileHelper.Write(TemplateParas.SaveFilePath + title, new[] { str }, SaveFileEncoding); } }
private string createCommentSql() { NVelocityHelper nVelocityHelper = new NVelocityHelper(FilePathHelper.TemplatesPath); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("tableInfo", tableInfo); dic.Add("codeGenHelper", new CodeGenHelper()); return(nVelocityHelper.GenByTemplate("comment.sql.vm", dic)); }
public void GenCode() { NVelocityHelper nVelocityHelper = new NVelocityHelper(FilePathHelper.TemplatesPath); string path = string.Format(@"{0}", TemplateParas.TemplateName); var dic = GetNVelocityVars(); string str = nVelocityHelper.GenByTemplate(path, dic); string title = ""; if (!string.IsNullOrEmpty(TemplateParas.SaveFileName)) { title = TemplateParas.SaveFileName; title = nVelocityHelper.GenByStr(title, dic); } if (TemplateParas.IsShowGenCode) { CodeShow(title, str); } else { FileHelper.Write(TemplateParas.SaveFilePath + title, new[] { str }, SaveFileEncoding); } }
public string GetSpringConfig(TableInfo tableInfo) { string tableName = tableInfo.TableName; string className = CodeGenHelper.GetClassName(tableName, cmc.CodeRule); string path = string.Format(@"{0}", "object.xml.vm"); var dic = GetNVelocityVars(); dic.Add("tableInfo", tableInfo); dic.Add("modelNameSpace", cmc.ModelNameSpace); dic.Add("idalNameSpace", cmc.IDALNameSpace); dic.Add("dalNameSpace", cmc.DALNameSpace); dic.Add("bllNameSpace", cmc.BLLNameSpace); dic.Add("guiPluginName", cmc.PluginName); dic.Add("codeRule", cmc.CodeRule); dic.Add("dalDllName", cmc.DALDllName); dic.Add("bllDllName", cmc.BLLDllName); string str = nVelocityHelper.GenByTemplate(path, dic); return(str); }
/// <summary> /// 生成指定单一文件 /// </summary> /// <param name="o"></param> public void GenCode(object[] o, string language) { NVelocityHelper nVelocityHelper = new NVelocityHelper(FilePathHelper.TemplatesPath); Header header = o[0] as Header; Trailer trailer = o[0] as Trailer; Message message = o[0] as Message; Component component = o[0] as Component; FieldDic field = o[0] as FieldDic; string tableName = ""; string path = string.Format(@"{0}", TemplateParas.TemplateName); //var dic = new Dictionary<string, object>(); var dic = GetNVelocityVars(); if (header != null) { tableName = "header"; dic.Add("header", o[0]); } if (trailer != null) { tableName = "trailer"; dic.Add("trailer", o[0]); } if (message != null) { tableName = message.Name; dic.Add("messages", o); } if (component != null) { tableName = component.Name; dic.Add("components", o); } if (field != null) { tableName = field.Name; dic.Add("fields", o); } FixHelper.FieldDics = FieldDics; dic.Add("FixHelper", new FixHelper()); //dic.Add("codeGenHelper", new CodeGenHelper()); string str = nVelocityHelper.GenByTemplate(path, dic); string title = tableName + "." + (TemplateParas.CodeLanguage + "").ToLower(); if (!string.IsNullOrEmpty(TemplateParas.SaveFileName)) { title = TemplateParas.SaveFileName; title = nVelocityHelper.GenByStr(title, dic); } if (TemplateParas.IsShowGenCode) { CodeShow(title, str); } else { FileHelper.Write(TemplateParas.SaveFilePath + title, new[] { str }, SaveFileEncoding); } }