Commit 69afbe39 authored by 吴春's avatar 吴春

提交代码

parent cb4ca209
...@@ -28,15 +28,26 @@ namespace Edu.Module.User ...@@ -28,15 +28,26 @@ namespace Edu.Module.User
return accountRepository.GetAccountListRepository(query); return accountRepository.GetAccountListRepository(query);
} }
/// <summary> /// <summary>
/// 获取账号分页列表 /// 获取账号列表(批量修改密码专用)
/// </summary> /// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Account_ViewModel> GetAccountPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Account_ViewModel query) public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
return accountRepository.GetUpdateAccountListRepository(query);
}
/// <summary>
/// 获取账号分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetAccountPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Account_ViewModel query)
{ {
return accountRepository.GetAccountPageListRepository(pageIndex, pageSize, out rowsCount, query); return accountRepository.GetAccountPageListRepository(pageIndex, pageSize, out rowsCount, query);
} }
......
...@@ -118,6 +118,7 @@ namespace Edu.Module.User ...@@ -118,6 +118,7 @@ namespace Edu.Module.User
{ nameof(RB_Assist.Address),model.Address }, { nameof(RB_Assist.Address),model.Address },
{ nameof(RB_Assist.BirthDate),model.BirthDate }, { nameof(RB_Assist.BirthDate),model.BirthDate },
{ nameof(RB_Assist.LeaveStatus),model.LeaveStatus }, { nameof(RB_Assist.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Assist.LeaveTime),model.LeaveTime },
{ nameof(RB_Assist.Education),model.Education }, { nameof(RB_Assist.Education),model.Education },
}; };
string logContent = ""; string logContent = "";
...@@ -157,6 +158,14 @@ namespace Edu.Module.User ...@@ -157,6 +158,14 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
} }
if (model.LeaveStatus != oldModel.LeaveStatus)
{
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
}
if (model.LeaveTime != oldModel.LeaveTime)
{
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
}
if (model.Education != oldModel.Education) if (model.Education != oldModel.Education)
{ {
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName()); logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
...@@ -279,7 +279,7 @@ namespace Edu.Module.User ...@@ -279,7 +279,7 @@ namespace Edu.Module.User
School_Id = extModel.School_Id, School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy, UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime, UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id Dept_Id = extModel.Dept_Id
}); });
break; break;
......
...@@ -78,6 +78,7 @@ namespace Edu.Module.User ...@@ -78,6 +78,7 @@ namespace Edu.Module.User
{ nameof(RB_Manager_ViewModel.Address),model.Address }, { nameof(RB_Manager_ViewModel.Address),model.Address },
{ nameof(RB_Manager_ViewModel.BirthDate),model.BirthDate }, { nameof(RB_Manager_ViewModel.BirthDate),model.BirthDate },
{ nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus }, { nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Manager_ViewModel.LeaveTime),model.LeaveTime },
{ nameof(RB_Manager_ViewModel.Education),model.Education }, { nameof(RB_Manager_ViewModel.Education),model.Education },
}; };
string logContent = ""; string logContent = "";
...@@ -129,7 +130,14 @@ namespace Edu.Module.User ...@@ -129,7 +130,14 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
} }
if (model.LeaveStatus != oldModel.LeaveStatus)
{
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
}
if (model.LeaveTime != oldModel.LeaveTime)
{
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
}
if (model.Education != oldModel.Education) if (model.Education != oldModel.Education)
{ {
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName()); logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
...@@ -130,7 +130,7 @@ namespace Edu.Module.User ...@@ -130,7 +130,7 @@ namespace Edu.Module.User
fileds.Add(nameof(RB_Teacher_ViewModel.Address), model.Address); fileds.Add(nameof(RB_Teacher_ViewModel.Address), model.Address);
fileds.Add(nameof(RB_Teacher_ViewModel.BirthDate), model.BirthDate); fileds.Add(nameof(RB_Teacher_ViewModel.BirthDate), model.BirthDate);
fileds.Add(nameof(RB_Teacher_ViewModel.LeaveStatus), model.LeaveStatus); fileds.Add(nameof(RB_Teacher_ViewModel.LeaveStatus), model.LeaveStatus);
// fileds.Add(nameof(RB_Teacher_ViewModel.LeaveTime),model.LeaveTime); fileds.Add(nameof(RB_Teacher_ViewModel.LeaveTime), model.LeaveTime);
fileds.Add(nameof(RB_Teacher_ViewModel.Education), model.Education); fileds.Add(nameof(RB_Teacher_ViewModel.Education), model.Education);
} }
string logContent = ""; string logContent = "";
...@@ -142,7 +142,7 @@ namespace Edu.Module.User ...@@ -142,7 +142,7 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.TeacherTel, oldModel.TeacherTel); logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.TeacherTel, oldModel.TeacherTel);
} }
if (model.IDCard != oldModel.IDCard) if (model.IDCard != oldModel.IDCard)
{ {
logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard); logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard);
...@@ -163,7 +163,14 @@ namespace Edu.Module.User ...@@ -163,7 +163,14 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
} }
if (model.LeaveStatus != oldModel.LeaveStatus)
{
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
}
if (model.LeaveTime != oldModel.LeaveTime)
{
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
}
if (model.Education != oldModel.Education) if (model.Education != oldModel.Education)
{ {
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName()); logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
...@@ -36,7 +36,7 @@ WHERE 1=1 ...@@ -36,7 +36,7 @@ WHERE 1=1
} }
if (query.AccountType > 0) if (query.AccountType > 0)
{ {
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.AccountType),query.AccountType); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.AccountType), query.AccountType);
} }
if (query.School_Id > 0) if (query.School_Id > 0)
{ {
...@@ -51,7 +51,7 @@ WHERE 1=1 ...@@ -51,7 +51,7 @@ WHERE 1=1
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id);
} }
} }
return Get<RB_Account_ViewModel>(builder.ToString(),parameters).ToList(); return Get<RB_Account_ViewModel>(builder.ToString(), parameters).ToList();
} }
/// <summary> /// <summary>
...@@ -96,7 +96,7 @@ WHERE 1=1 ...@@ -96,7 +96,7 @@ WHERE 1=1
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id);
} }
} }
return GetPage<RB_Account_ViewModel>(pageIndex,pageSize,out rowsCount,builder.ToString(), parameters).ToList(); return GetPage<RB_Account_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
/// <summary> /// <summary>
...@@ -193,7 +193,7 @@ FROM ...@@ -193,7 +193,7 @@ FROM
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="parameters"></param> /// <param name="parameters"></param>
/// <returns></returns> /// <returns></returns>
public string GetEmployeeSqlReposiroty(Employee_ViewModel query,DynamicParameters parameters) public string GetEmployeeSqlReposiroty(Employee_ViewModel query, DynamicParameters parameters)
{ {
StringBuilder where = new StringBuilder(); StringBuilder where = new StringBuilder();
StringBuilder where2 = new StringBuilder(); StringBuilder where2 = new StringBuilder();
...@@ -284,7 +284,7 @@ FROM ...@@ -284,7 +284,7 @@ FROM
{ {
where.AppendFormat($@" AND STR_TO_DATE( CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= DATE_FORMAT('{query.EndBirthDate}' , '%Y-%m-%d') "); where.AppendFormat($@" AND STR_TO_DATE( CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= DATE_FORMAT('{query.EndBirthDate}' , '%Y-%m-%d') ");
} }
//if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate)) //if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate))
//{ //{
// //OR前面是不跨年,OR后面是跨年 // //OR前面是不跨年,OR后面是跨年
...@@ -341,7 +341,7 @@ WHERE 1=1 {4} ...@@ -341,7 +341,7 @@ WHERE 1=1 {4}
/// </summary> /// </summary>
/// <param name="EmpId"></param> /// <param name="EmpId"></param>
/// <returns></returns> /// <returns></returns>
public Employee_ViewModel GetEmployeeInfo(int EmpId) public Employee_ViewModel GetEmployeeInfo(int EmpId)
{ {
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
StringBuilder where = new StringBuilder(); StringBuilder where = new StringBuilder();
...@@ -373,5 +373,50 @@ FROM ...@@ -373,5 +373,50 @@ FROM
var model = Get<Employee_ViewModel>(builder.ToString(), parameters).FirstOrDefault(); var model = Get<Employee_ViewModel>(builder.ToString(), parameters).FirstOrDefault();
return model; return model;
} }
/// <summary>
/// 获取账号列表(批量修改密码专用)
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
StringBuilder builderWhere = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_account AS A
WHERE 1=1
");
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null && query.Any())
{
if (query.FirstOrDefault().Group_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Group_Id), query.FirstOrDefault().Group_Id);
}
foreach (var item in query)
{
if (item.AccountType > 0 && item.AccountId > 0)
{
if (!string.IsNullOrWhiteSpace(builderWhere.ToString()))
{
builderWhere.AppendFormat(" or ( a.{0}={1} and a.{2}={3} ) ", nameof(RB_Account_ViewModel.AccountType),(int) item.AccountType, nameof(RB_Account_ViewModel.AccountId), item.AccountId);
}
else {
builderWhere.AppendFormat(" ( a.{0}={1} and a.{2}={3} ) ", nameof(RB_Account_ViewModel.AccountType), (int)item.AccountType, nameof(RB_Account_ViewModel.AccountId), item.AccountId);
}
}
}
builder.AppendFormat(" and ( {0} ) ", builderWhere.ToString());
}
return Get<RB_Account_ViewModel>(builder.ToString(), parameters).ToList();
}
} }
} }
\ No newline at end of file
...@@ -774,7 +774,13 @@ namespace Edu.WebApi.Controllers.User ...@@ -774,7 +774,13 @@ namespace Edu.WebApi.Controllers.User
if (int.TryParse(RequestParm.Uid, out int uid)) if (int.TryParse(RequestParm.Uid, out int uid))
{ {
viewList.ForEach(x => x.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id); viewList.ForEach(x => x.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id);
result = accountModule.SetBatchResetPassword(viewList, newPwd); //判断账户信息是否存在,不存在就不去更新密码
var list = accountModule.GetUpdateAccountListRepository(viewList);
if (list != null && list.Any())
{
result = accountModule.SetBatchResetPassword(list, newPwd);
}
} }
else else
{ {
......
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