Quellcode durchsuchen

同步部门

master
北京泉江 vor 8 Monaten
Ursprung
Commit
bc1a9968aa
2 geänderte Dateien mit 61 neuen und 1 gelöschten Zeilen
  1. +37
    -1
      DigitalSchoolApi/Controllers/YKTTrabs.cs
  2. +24
    -0
      DigitalSchoolApi/Models/XCStudentEntity.cs

+ 37
- 1
DigitalSchoolApi/Controllers/YKTTrabs.cs Datei anzeigen

@@ -1434,6 +1434,8 @@ namespace DigitalSchoolApi.Controllers
List<V_ZYXX> zyxx = conn_oracle.Query<V_ZYXX>("select * from V_ZYXX").ToList();
//课程信息
List<V_KCXX> kcxx = conn_oracle.Query<V_KCXX>("select * from V_KCXX").ToList();
//部门
var depts = conn_oracle.Query<V_Dept>("select * from V_DEPT").ToList();
//教师
List<V_JSXX> jsxx = conn_oracle.Query<V_JSXX>("select * from V_JSXX").ToList();
//行政班级表
@@ -1449,6 +1451,8 @@ namespace DigitalSchoolApi.Controllers
$"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())");
conncore.Execute(
@@ -1461,6 +1465,38 @@ namespace DigitalSchoolApi.Controllers

#endregion

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))
{
#region 专业
@@ -1583,7 +1619,7 @@ namespace DigitalSchoolApi.Controllers
}

#endregion
#region 教师信息
List<TeachModel> teachinfo = conncores.Query<TeachModel>("select * from empinfo").ToList();
int anumTeach = 0;


+ 24
- 0
DigitalSchoolApi/Models/XCStudentEntity.cs Datei anzeigen

@@ -933,4 +933,28 @@ namespace DigitalSchoolApi.Models
public string STU_ROLL_CODE { get; set; }
public string IS_NORMAL { get; set; }
}

public class V_Dept
{
public string ID { get; set; }

public string CODE_ { get; set; }

public string NAME_ { get; set; }

public string PID { get; set; }

public string PATH_ { get; set; }

public string LEVEL_ { get; set; }

public string LEVEL_TYPE { get; set; }

public int ISTRUE { get; set; }

public string NAME_SHORT { get; set; }

public string ADMIN_MANAGE_TEA_NO { get; set; }
}
}

Laden…
Abbrechen
Speichern