id设为string

This commit is contained in:
2023-05-17 14:27:32 +08:00
parent 7f345b6d2b
commit 524acb7704
12 changed files with 18 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ using System.Linq;
using System.Text; using System.Text;
using JNPF.Common.Security; using JNPF.Common.Security;
using SqlSugar; using SqlSugar;
using Yitter.IdGenerator;
namespace Tnb.BasicData.Entities namespace Tnb.BasicData.Entities
{ {
@@ -22,7 +23,7 @@ namespace Tnb.BasicData.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public long id {get;set;} = YitIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public char id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public char id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.EquipMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public long id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -22,7 +22,7 @@ namespace Tnb.ProductionMgr.Entities
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey=true)] [SugarColumn(IsPrimaryKey=true)]
public char id {get;set;} = SnowflakeIdHelper.NextId(); public string id {get;set;} = SnowflakeIdHelper.NextId();
/// <summary> /// <summary>
/// Desc:TODO /// Desc:TODO

View File

@@ -601,6 +601,7 @@ public class DataBaseService : IDynamicApiController, ITransient
List<string> dirs = new List<string>(); List<string> dirs = new List<string>();
foreach (string key in nsMapper.Keys) foreach (string key in nsMapper.Keys)
{ {
if (key != "eqp_") continue;
var nsName = nsMapper[key]; var nsName = nsMapper[key];
var dir = Path.Combine(FileVariable.GenerateCodePath, nsName); var dir = Path.Combine(FileVariable.GenerateCodePath, nsName);
dirs.Add(dir); dirs.Add(dir);
@@ -661,7 +662,11 @@ public class DataBaseService : IDynamicApiController, ITransient
if (sugarAttrs.Count > 0) if (sugarAttrs.Count > 0)
sugarColumnStr = $"\r\n [SugarColumn({string.Join(", ", sugarAttrs)})]"; sugarColumnStr = $"\r\n [SugarColumn({string.Join(", ", sugarAttrs)})]";
var txt = tpl.Replace("{PropertyType}", type).Replace("{PropertyName}", col.DbColumnName).Replace("{SugarColumn}", sugarColumnStr); var txt = tpl.Replace("{PropertyType}", type).Replace("{PropertyName}", col.DbColumnName).Replace("{SugarColumn}", sugarColumnStr);
if (col.DbColumnName == "id") txt = txt.TrimEnd('\n', '\r') + " = SnowflakeIdHelper.NextId();\r\n"; if (col.DbColumnName == "id")
{
if(type == "string") txt = txt.TrimEnd('\n', '\r') + " = SnowflakeIdHelper.NextId();\r\n";
else if(type == "long") txt = txt.TrimEnd('\n', '\r') + " = YitIdHelper.NextId();\r\n";
}
else if (type == "string") txt = txt.TrimEnd('\n', '\r') + " = string.Empty;\r\n"; else if (type == "string") txt = txt.TrimEnd('\n', '\r') + " = string.Empty;\r\n";
return txt; return txt;
}) })