using Yw.DAL.PostgreSql;
|
|
namespace HStation.DAL.PostgreSql
|
{
|
/// <summary>
|
///
|
/// </summary>:
|
public partial class EmployeeMain : BaseDAL_Paras_Flags_TagName_Sorter<Entity.EmployeeMain>, IEmployeeMain
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return Organize.ConfigHelper.PostgreSqlConnectionConfig; }
|
}
|
|
//插入拓展
|
public long InsertEx(Entity.EmployeeMain employeeMain, Entity.UserLoginAccount userLogin, Entity.UserLoginMap loginmap)
|
{
|
if (employeeMain == null)
|
{
|
return default;
|
}
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
try
|
{
|
db.BeginTran();
|
employeeMain.AddTime = DateTime.Now.ToString();
|
var result = db.Insertable(employeeMain).ExecuteReturnSnowflakeId();
|
if (result < 0)
|
{
|
db.RollbackTran();
|
return default;
|
}
|
else
|
{
|
if (userLogin != null)
|
{
|
userLogin.CreateTime = DateTime.Now.ToString();
|
var logjinresult = db.Insertable(userLogin).ExecuteReturnSnowflakeId();
|
if (logjinresult < 0)
|
{
|
db.RollbackTran();
|
return default;
|
}
|
else
|
{
|
loginmap.LoginID = logjinresult;
|
loginmap.ObjectID = result;
|
loginmap.ObjectType = 0;
|
var mapresult = db.Insertable(loginmap).ExecuteReturnSnowflakeId();
|
if (mapresult < 0)
|
{
|
db.RollbackTran();
|
return default;
|
}
|
}
|
}
|
}
|
db.CommitTran();
|
return result;
|
}
|
catch (Exception ex)
|
{
|
db.RollbackTran();
|
throw;
|
}
|
}
|
}
|
}
|
}
|