Commit 2846f5d4 authored by 黄奎's avatar 黄奎

页面修改

parent 9e9b119f
......@@ -55,5 +55,10 @@ namespace Edu.Model.ViewModel.User
/// 管理者姓名
/// </summary>
public string ManagerName { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public string QSIds { get; set; }
}
}
......@@ -44,6 +44,16 @@ namespace Edu.Module.User
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 校区管理仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取助教列表
/// </summary>
......@@ -242,8 +252,14 @@ namespace Edu.Module.User
{nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime },
{nameof(RB_Assist.Dept_Id),model.Dept_Id },
{nameof(RB_Assist.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -254,8 +270,22 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.AId, AccountTypeEnum.Assist);
}
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.AId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Assist),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
}
}
else
{
var newId = assistRepository.Insert(model);
......
......@@ -286,7 +286,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
......@@ -299,7 +298,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Assist:
......@@ -312,7 +310,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
}
......
......@@ -43,6 +43,16 @@ namespace Edu.Module.User
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 校区管理
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取管理者列表
/// </summary>
......@@ -198,14 +208,17 @@ namespace Edu.Module.User
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id },
{ nameof(RB_Manager_ViewModel.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -217,8 +230,23 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.MId, AccountTypeEnum.Admin);
}
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.MId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Admin),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
}
return flag;
}
......
......@@ -51,6 +51,16 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_ClassRepository classRepository = new RB_ClassRepository();
/// <summary>
/// 校区管理
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取讲师列表
/// </summary>
......@@ -269,9 +279,14 @@ namespace Edu.Module.User
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id },
{nameof(RB_Teacher_ViewModel.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -282,8 +297,23 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.TId, AccountTypeEnum.Teacher);
}
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.TId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Teacher),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
}
}
else
{
var newId = teacherRepository.Insert(model);
......
......@@ -58,6 +58,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND s.{0}={1} ", nameof(RB_School_ViewModel.SId), query.SId);
}
if (!string.IsNullOrEmpty(query.QSIds))
{
builder.AppendFormat(" AND s.{0} IN({1}) ", nameof(RB_School_ViewModel.SId), query.QSIds);
}
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND s.{0}={1} ", nameof(RB_School_ViewModel.Group_Id), query.Group_Id);
......
......@@ -782,7 +782,6 @@ namespace Edu.WebApi.Controllers.User
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.School_Id = base.UserInfo.School_Id;
bool flag = employeeModule.SetEmployeeDeptModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment