|
|
|
@ -1,11 +1,7 @@ |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Text; |
|
|
|
|
using EU.Core.UserManager; |
|
|
|
|
using EU.Core.Utilities; |
|
|
|
|
using Microsoft.AspNetCore.Mvc.Core; |
|
|
|
|
using SqlSugar; |
|
|
|
|
using Tiobon.Core.Common.UserManager; |
|
|
|
|
|
|
|
|
|
namespace EU.Core |
|
|
|
|
namespace Tiobon.Core.Common |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// Sql插入类 |
|
|
|
@ -15,12 +11,12 @@ namespace EU.Core |
|
|
|
|
#region 变量定义 |
|
|
|
|
private string sql; |
|
|
|
|
private string createProgram; |
|
|
|
|
private string rowId; |
|
|
|
|
private long rowId; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 如果使用线程,此处可以指定插入用户代码,否则CREATED_BY为空 |
|
|
|
|
/// </summary> |
|
|
|
|
public string CreatedBy { get; set; } |
|
|
|
|
public string RowId |
|
|
|
|
public long RowId |
|
|
|
|
{ |
|
|
|
|
get { return rowId; } |
|
|
|
|
set { rowId = value; } |
|
|
|
@ -81,11 +77,8 @@ namespace EU.Core |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Values |
|
|
|
|
public void Values(string fieldName, string value) |
|
|
|
|
public void Values(string fieldName, long value) |
|
|
|
|
{ |
|
|
|
|
if (string.IsNullOrEmpty(value)) return; |
|
|
|
|
value = value.Replace("'", "''"); |
|
|
|
|
value = value.Trim(); |
|
|
|
|
string s = "N'{0}'"; |
|
|
|
|
s = string.Format(s, value); |
|
|
|
|
|
|
|
|
@ -210,7 +203,7 @@ namespace EU.Core |
|
|
|
|
{ |
|
|
|
|
if (isInitRowId == true) |
|
|
|
|
{ |
|
|
|
|
rowId = StringHelper.Id; |
|
|
|
|
rowId = SnowFlakeSingle.Instance.NextId(); |
|
|
|
|
Values("ID", rowId); |
|
|
|
|
} |
|
|
|
|
if (isInitDefaultValue == true) |
|
|
|
@ -227,11 +220,11 @@ namespace EU.Core |
|
|
|
|
{ |
|
|
|
|
value = value.Trim(); |
|
|
|
|
} |
|
|
|
|
if (DBHelper.MySql) |
|
|
|
|
{ |
|
|
|
|
fieldName = fieldName.Replace("[", "`"); |
|
|
|
|
fieldName = fieldName.Replace("]", "`"); |
|
|
|
|
} |
|
|
|
|
//if (DBHelper.MySql) |
|
|
|
|
//{ |
|
|
|
|
// fieldName = fieldName.Replace("[", "`"); |
|
|
|
|
// fieldName = fieldName.Replace("]", "`"); |
|
|
|
|
//} |
|
|
|
|
sql = sql.Replace("{", "{{"); |
|
|
|
|
sql = sql.Replace("}", "}}"); |
|
|
|
|
int n = sql.IndexOf("() VALUES"); |
|
|
|
@ -269,20 +262,17 @@ namespace EU.Core |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
//create_by |
|
|
|
|
Guid? createBy = UserContext.Current.User_Id; |
|
|
|
|
if (createBy != Guid.Empty) |
|
|
|
|
var createBy = UserContext.Current.User_Id; |
|
|
|
|
Values("CreatedBy", createBy); |
|
|
|
|
|
|
|
|
|
//create_date |
|
|
|
|
DateTime createDate = DateTime.Now; |
|
|
|
|
Values("CreatedTime", createDate); |
|
|
|
|
Values("GroupId", UserContext.Current.GroupId); |
|
|
|
|
Values("CompanyId", UserContext.Current.CompanyId); |
|
|
|
|
|
|
|
|
|
//create_program |
|
|
|
|
//Values("CREATED_PROGRAM", createProgram); |
|
|
|
|
//tag |
|
|
|
|
Values("Tag", 1); |
|
|
|
|
//Values("Tag", 1); |
|
|
|
|
//active_flag |
|
|
|
|
//Values("DELETE_FLAG", "N"); |
|
|
|
|
} |
|
|
|
|