| | |
| | | if (!Directory.Exists(path)) Directory.CreateDirectory(path); |
| | | |
| | | string tabName = this.txtTabPrefix.Text.Trim() + name; |
| | | string shortName = GetEntityName(name, true); |
| | | string shortName = GetEntityName(name); |
| | | |
| | | string mapperNS = this.txtMapperNS.Text.Trim(); |
| | | string mapperName = shortName + "Mapper"; |
| | |
| | | |
| | | string tabName = this.txtTabPrefix.Text.Trim() + name; |
| | | //string shortName = NameConvert(name, true); |
| | | string shortName = GetEntityName(name, true); |
| | | string shortName = GetEntityName(name); |
| | | |
| | | string entityNS = this.txtEntityNS.Text.Trim(); |
| | | string entityName = shortName + "Entity"; |
| | |
| | | //if ("references" == colName) sb.Append(" @TableField(value = \"\\\"references\\\"\")").Append("\r\n"); |
| | | |
| | | SysDict dict = FindSysDict(dicts, ti.col); |
| | | if (null != dict && !string.IsNullOrEmpty(dict.alias)) |
| | | { |
| | | sb.Append(" @ApiModelProperty(value = \"" + dict.alias.Trim() + "\")\r\n"); |
| | | } |
| | | string alias = null == dict || string.IsNullOrEmpty(dict.alias) ? (string.IsNullOrEmpty(ti.bak) ? "" : ti.bak.Trim()) : dict.alias.Trim(); |
| | | sb.Append(" @ApiModelProperty(value = \"" + alias + "\")\r\n"); |
| | | |
| | | sb.Append(" private " + type + " " + colName + ";\r\n"); |
| | | } |
| | | |
| | |
| | | return tabs; |
| | | } |
| | | |
| | | private static string GetEntityName(string name, bool firstUpper) |
| | | private static string GetEntityName(string name) |
| | | { |
| | | return firstUpper ? ToUpperFirst(name.Replace("_", "")) : name.Replace("_", ""); |
| | | string[] strs = name.ToLower().Split(new char[] { '_' }); |
| | | for (int i = 0, c = strs.Length; i < c; i++) |
| | | { |
| | | strs[i] = ToUpperFirst(strs[i]); |
| | | } |
| | | |
| | | return string.Join("", strs); |
| | | } |
| | | |
| | | private static string NameConvert(string name, bool firstUpper) |
| | | { |
| | | string[] strs = name.Split(new char[] { '_' }); |
| | | |
| | | string[] strs = name.ToLower().Split(new char[] { '_' }); |
| | | for (int i = 0, c = strs.Length; i < c; i++) |
| | | { |
| | | if (0 == i && !firstUpper) |
| | | { |
| | | continue; |
| | | } |
| | | if (0 == i && !firstUpper) continue; |
| | | |
| | | strs[i] = char.IsDigit(strs[i][0]) ? "_" + strs[i] : ToUpperFirst(strs[i]); |
| | | strs[i] = ToUpperFirst(strs[i]); |
| | | } |
| | | |
| | | return string.Join("", strs); |