From bc1a9968aaf1f76e848ffca497ac20f50fdc5398 Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Wed, 20 Mar 2024 11:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 38 +++++++++++++++++++++- DigitalSchoolApi/Models/XCStudentEntity.cs | 24 ++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 70081a9..7512b3d 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1434,6 +1434,8 @@ namespace DigitalSchoolApi.Controllers List zyxx = conn_oracle.Query("select * from V_ZYXX").ToList(); //课程信息 List kcxx = conn_oracle.Query("select * from V_KCXX").ToList(); + //部门 + var depts = conn_oracle.Query("select * from V_DEPT").ToList(); //教师 List jsxx = conn_oracle.Query("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("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 teachinfo = conncores.Query("select * from empinfo").ToList(); int anumTeach = 0; diff --git a/DigitalSchoolApi/Models/XCStudentEntity.cs b/DigitalSchoolApi/Models/XCStudentEntity.cs index 5affff0..2cfc08f 100644 --- a/DigitalSchoolApi/Models/XCStudentEntity.cs +++ b/DigitalSchoolApi/Models/XCStudentEntity.cs @@ -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; } + } + } \ No newline at end of file