$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库专业数据','获取oracle专业数据共{zyxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库课程数据','获取oracle课程数据共{kcxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库部门数据','获取oracle部门数据共{depts.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库教师数据','获取oracle教师数据共{jsxx.Count()}条',getdate())");
using (var db=new SqlConnection(_coresqlConnection))
{
#region 部门
var departments = db.Query<DepartmentEntity>("select * from LR_Base_Department").ToList();
var anumDept = 0;
var unumDept = 0;
foreach (var item in depts)
{
try
{
if(departments.Any(x=>x.F_DepartmentId==item.ID))
{
var sql = $"update LR_Base_Department set F_FullName='{item.NAME_}',F_ParentId='{item.PID}',F_EnCode='{item.ID}',F_ShortName='{item.NAME_SHORT}',F_CreateDate='{DateTime.Now}' where F_DepartmentId='{item.ID}'";
anumDept += db.Execute(sql);
}
else
{
var sql = $"insert into LR_Base_Department (F_DepartmentId,F_CompanyId,F_ParentId,F_EnCode,F_FullName,F_ShortName,F_SortCode,F_DeleteMark,F_EnabledMark,F_CreateDate,F_Order) values ('{item.ID}','207fa1a9-160c-4943-a89b-8fa4db0547ce','{item.PID}','{item.ID}','{item.NAME_}','{item.NAME_SHORT}',0,0,1,'{DateTime.Now}',0)";
anumDept += db.Execute(sql);
}
}
catch (Exception ex)
{
db.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新部门数据','编号({item.ID}),姓名({item.NAME_})更新时出现异常:{ex.Message}',getdate())");
}
}
#endregion
}
using (IDbConnection conncores = new SqlConnection(_sqlConnection))