Commit a339a4e5 authored by 吴春's avatar 吴春

提交代码

parent 308279fa
......@@ -24,5 +24,10 @@ namespace Edu.Model.ViewModel.Duty
/// 班次
/// </summary>
public string ShiftsName { get; set; }
/// <summary>
/// 值班人员名称
/// </summary>
public string EmployeeName { get; set; }
}
}
......@@ -13,6 +13,10 @@ namespace Edu.Module.Duty
private readonly RB_Duty_FrequencyRepository dutyFrequencyRepository = new RB_Duty_FrequencyRepository();
private readonly RB_Duty_ItemRepository dutyItemRepository = new RB_Duty_ItemRepository();
/// <summary>
/// 账号管理处理类对象
/// </summary>
private readonly Repository.User.RB_AccountRepository accountRepository = new Repository.User.RB_AccountRepository();
#region 值班事项管理
/// <summary>
/// 获取值班事项设置列表
......@@ -96,11 +100,33 @@ namespace Edu.Module.Duty
if (list != null && list.Any())
{
string uids = string.Join(",", list.Select(x => x.EmployeeIds));
var userList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel { Group_Id = query.Group_Id, QIds = uids });
foreach (var item in list)
{
string userNames = "";
foreach (var itemUser in item.EmployeeIds.Split(","))
{
userNames += userList.Where(x => x.Id.ToString() == itemUser).FirstOrDefault()?.EmployeeName + "|";
}
item.EmployeeName = userNames.TrimEnd('|');
}
}
return list;
}
/// <summary>
/// 获取值班设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Config_ViewModel> GetDutyConfigList(RB_Duty_Config_ViewModel query)
{
return dutyConfigRepository.GetDutyConfigList(query);
}
/// <summary>
/// 删除值班设置
/// </summary>
......
......@@ -75,5 +75,44 @@ namespace Edu.Repository.Duty
}
return Get<RB_Duty_Config_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取值班设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Config_ViewModel> GetDutyConfigList(RB_Duty_Config_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_Duty_Config AS A WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Config_ViewModel.Group_Id), query.Group_Id);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Config_ViewModel.Id), query.Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Config_ViewModel.School_Id), query.School_Id);
}
if (query.Status >= 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Config_ViewModel.Status), (int)query.Status);
}
if (!string.IsNullOrWhiteSpace(query.MachineCode))
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Config_ViewModel.MachineCode), query.MachineCode);
}
}
return Get<RB_Duty_Config_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
......@@ -406,6 +406,12 @@ namespace Edu.WebApi.Controllers.Duty
{
return ApiResult.Failed("请输入值班机器码");
}
var oldList = dutyModule.GetDutyConfigList(new RB_Duty_Config_ViewModel { Group_Id = base.UserInfo.Group_Id, MachineCode = query.MachineCode });
if (oldList != null && oldList.Any(x => x.Id != query.Id))
{
return ApiResult.Failed("机器码已存在");
}
if (query.Id == 0)
{
query.CreateBy = base.UserInfo.Id;
......
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