Commit 53f73e78 authored by 吴春's avatar 吴春

提交代码

parent 2f08c431
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Plugin;
namespace Edu.Common.Enum.Duty
{
/// <summary>
/// 事项类型(1-选择,2-手动填写)
/// </summary>
public enum ItemTypeEnum
{
/// <summary>
/// 选择
/// </summary>
[EnumField("选择")]
Choice = 1,
/// <summary>
/// 手动填写
/// </summary>
[EnumField("手动填写")]
FillIn = 2
}
}
......@@ -53,7 +53,7 @@ namespace Edu.Model.Entity.Duty
/// <summary>
/// 修改时间
/// </summary>
public int UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
/// <summary>
/// 集团编号
......
......@@ -53,7 +53,7 @@ namespace Edu.Model.Entity.Duty
/// <summary>
/// 修改时间
/// </summary>
public int UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
/// <summary>
/// 集团编号
......
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.Duty;
using VT.FW.DB;
namespace Edu.Model.Entity.Duty
{
/// <summary>
/// 值班事项实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Duty_Item
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 事项名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 事项类型(1-选择,2-手动填写)
/// </summary>
public ItemTypeEnum? ItemType { get; set; }
/// <summary>
/// 班次
/// </summary>
public string Shifts { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 事项所属校区
/// </summary>
public string ItemSchools { get; set; }
public int Status { get; set; }
}
}
......@@ -14,5 +14,15 @@ namespace Edu.Model.ViewModel.Duty
/// 学校名称
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 班次
/// </summary>
public string ShiftsName { get; set; }
}
}
......@@ -11,5 +11,10 @@ namespace Edu.Model.ViewModel.Duty
/// 学校
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Duty;
namespace Edu.Model.ViewModel.Duty
{
public class RB_Duty_Item_ViewModel : RB_Duty_Item
{
/// <summary>
/// 学校
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 班次
/// </summary>
public string ShiftsName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using Edu.Model.ViewModel.Duty;
using Edu.Repository.Duty;
using VT.FW.DB;
......@@ -10,6 +11,63 @@ namespace Edu.Module.Duty
{
private readonly RB_Duty_ConfigRepository dutyConfigRepository = new RB_Duty_ConfigRepository();
private readonly RB_Duty_FrequencyRepository dutyFrequencyRepository = new RB_Duty_FrequencyRepository();
private readonly RB_Duty_ItemRepository dutyItemRepository = new RB_Duty_ItemRepository();
#region 值班事项管理
/// <summary>
/// 获取值班事项设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Item_ViewModel> GetDutyItemRepository(RB_Duty_Item_ViewModel query)
{
return dutyItemRepository.GetDutyItemRepository(query);
}
/// <summary>
/// 删除值班事项
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public bool RemoveItemModule(object Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Item_ViewModel.Status),1},
};
return dutyItemRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Item_ViewModel.Id), Id));
}
/// <summary>
/// 新增/修改值班事项信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetDutyItemModel(RB_Duty_Item_ViewModel model)
{
if (model.Id == 0)
{
return dutyItemRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Item_ViewModel.ItemName),model.ItemName},
{ nameof(RB_Duty_Item_ViewModel.ItemType),model.ItemType},
{ nameof(RB_Duty_Item_ViewModel.Shifts),model.Shifts},
{ nameof(RB_Duty_Item_ViewModel.ItemSchools),model.ItemSchools},
{ nameof(RB_Duty_Item_ViewModel.UpdateBy),model.UpdateBy},
{ nameof(RB_Duty_Item_ViewModel.UpdateTime),model.UpdateTime},
};
return dutyItemRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Item_ViewModel.Id), model.Id));
}
}
#endregion
#region 值班设置
......@@ -34,7 +92,55 @@ namespace Edu.Module.Duty
/// <returns></returns>
public List<RB_Duty_Config_ViewModel> GetDutyConfigRepository(RB_Duty_Config_ViewModel query)
{
return dutyConfigRepository.GetDutyConfigRepository(query);
var list = dutyConfigRepository.GetDutyConfigRepository(query);
if (list != null && list.Any())
{
string uids = string.Join(",", list.Select(x => x.EmployeeIds));
}
return list;
}
/// <summary>
/// 删除值班设置
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public bool RemoveConfigModule(object Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Config_ViewModel.Status),1},
};
return dutyConfigRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Config_ViewModel.Id), Id));
}
/// <summary>
/// 新增/修改班次信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetDutyConfigModel(RB_Duty_Config_ViewModel model)
{
if (model.Id == 0)
{
return dutyConfigRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Config_ViewModel.Shifts),model.Shifts},
{ nameof(RB_Duty_Config_ViewModel.EmployeeIds),model.EmployeeIds},
{ nameof(RB_Duty_Config_ViewModel.MachineCode),model.MachineCode},
{ nameof(RB_Duty_Config_ViewModel.School_Id),model.School_Id},
{ nameof(RB_Duty_Config_ViewModel.UpdateBy),model.UpdateBy},
{ nameof(RB_Duty_Config_ViewModel.UpdateTime),model.UpdateTime},
};
return dutyConfigRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Config_ViewModel.Id), model.Id));
}
}
#endregion
......@@ -56,6 +162,31 @@ namespace Edu.Module.Duty
/// <summary>
/// 获取班次设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Frequency_ViewModel> GetDutyFrequencyBySchoolIds(int Group_Id, string SchoolIds)
{
return dutyFrequencyRepository.GetDutyFrequencyBySchoolIds(Group_Id, SchoolIds);
}
/// <summary>
/// 删除班次
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public bool RemoveFrequencyModule(object Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Frequency_ViewModel.Status),1},
};
return dutyFrequencyRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Frequency_ViewModel.Id), Id));
}
/// <summary>
......
......@@ -47,7 +47,7 @@ namespace Edu.Module.User
/// <returns></returns>
public List<RB_School_ViewModel> GetSchoolPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_School_ViewModel query)
{
var list= schoolRepository.GetSchoolPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list = schoolRepository.GetSchoolPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>();
......@@ -63,7 +63,7 @@ namespace Edu.Module.User
}
if (!string.IsNullOrEmpty(empIds))
{
empList= accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = empIds });
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = empIds });
}
foreach (var item in list)
{
......@@ -154,5 +154,17 @@ namespace Edu.Module.User
flag = schoolRepository.Update(fileds, new WhereHelper(nameof(RB_School_ViewModel.SId), SId));
return flag;
}
/// <summary>
/// 根据班次获取学校
/// </summary>
/// <param name="Group_Id">集团</param>
/// <param name="FrequencyIds">班次</param>
/// <returns></returns>
public List<RB_School_ViewModel> GetSchoolListByFrequencyIds(int Group_Id, string FrequencyIds)
{
return schoolRepository.GetSchoolListByFrequencyIds(Group_Id, FrequencyIds);
}
}
}
\ No newline at end of file
......@@ -53,13 +53,17 @@ namespace Edu.Repository.Duty
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_Duty_Config AS A WHERE 1=1 ");
builder.AppendFormat(@" SELECT A.*,(SELECT GROUP_CONCAT(`Name`) from rb_duty_frequency where `Status`=0 and FIND_IN_SET(Id,a.Shifts) GROUP BY `Status`=0) as ShiftsName,B.SName AS SchoolName FROM RB_Duty_Config AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId 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);
......
......@@ -8,7 +8,7 @@ using VT.FW.DB.Dapper;
namespace Edu.Repository.Duty
{
public class RB_Duty_FrequencyRepository: BaseRepository<RB_Duty_Frequency>
public class RB_Duty_FrequencyRepository : BaseRepository<RB_Duty_Frequency>
{
/// <summary>
/// 获取班次设置列表
......@@ -17,7 +17,7 @@ namespace Edu.Repository.Duty
/// <returns></returns>
public List<RB_Duty_Frequency_ViewModel> GetDutyFrequencyRepository(RB_Duty_Frequency_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.*,(SELECT GROUP_CONCAT(SName) from rb_school where `Status`=0 and FIND_IN_SET(SId,a.School_Ids) GROUP BY `Status`=0) as SchoolName FROM RB_Duty_Frequency AS A WHERE 1=1 ");
if (query != null)
......@@ -36,7 +36,34 @@ namespace Edu.Repository.Duty
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Frequency_ViewModel.Status), (int)query.Status);
}
}
return Get<RB_Duty_Frequency_ViewModel>(builder.ToString(), parameters).ToList();
return Get<RB_Duty_Frequency_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取班次设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Frequency_ViewModel> GetDutyFrequencyBySchoolIds(int Group_Id, string SchoolIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * from rb_duty_frequency where `Status`=0");
if (Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Duty_Frequency_ViewModel.Group_Id), Group_Id);
}
if (!string.IsNullOrWhiteSpace(SchoolIds))
{
foreach (var item in SchoolIds.Split(","))
{
builder.AppendFormat($" and FIND_IN_SET({item},School_Ids) ");
}
}
return Get<RB_Duty_Frequency_ViewModel>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Duty;
using Edu.Model.ViewModel.Duty;
namespace Edu.Repository.Duty
{
public class RB_Duty_ItemRepository : BaseRepository<RB_Duty_Item>
{
/// <summary>
/// 获取值班事项设置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Item_ViewModel> GetDutyItemRepository(RB_Duty_Item_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.*,(SELECT GROUP_CONCAT(SName) from rb_school where `Status`=0 and FIND_IN_SET(SId,a.ItemSchools) GROUP BY `Status`=0) as SchoolName,
(SELECT GROUP_CONCAT(`Name`) from rb_duty_frequency where `Status`=0 and FIND_IN_SET(Id,a.Shifts) GROUP BY `Status`=0) as ShiftsName
FROM RB_Duty_Item AS A WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Item_ViewModel.Group_Id), query.Group_Id);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Item_ViewModel.Id), query.Id);
}
if (query.Status >= 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Item_ViewModel.Status), (int)query.Status);
}
}
return Get<RB_Duty_Item_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -130,5 +130,25 @@ WHERE 1=1
builder.AppendFormat(" ORDER BY s.{0} ASC ", nameof(RB_School_ViewModel.SId));
return GetPage<RB_School_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 根据班次获取学校
/// </summary>
/// <param name="Group_Id">集团</param>
/// <param name="FrequencyIds">班次</param>
/// <returns></returns>
public List<RB_School_ViewModel> GetSchoolListByFrequencyIds(int Group_Id, string FrequencyIds)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT * from rb_school as a where a.`Status`=0 and a.Group_Id={Group_Id}");
if (!string.IsNullOrWhiteSpace(FrequencyIds))
{
builder.AppendFormat($" and FIND_IN_SET(a.SId,(SELECT GROUP_CONCAT(School_Ids) from rb_duty_frequency where `Status`=0 and id in({FrequencyIds}) GROUP BY `Status`)) ");
}
return Get<RB_School_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
\ No newline at end of file
......@@ -32,6 +32,7 @@
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Module.Course\Edu.Module.Course.csproj" />
<ProjectReference Include="..\Edu.Module.Duty\Edu.Module.Duty.csproj" />
<ProjectReference Include="..\Edu.Module.Finance\Edu.Module.Finance.csproj" />
<ProjectReference Include="..\Edu.Module.OKR\Edu.Module.OKR.csproj" />
<ProjectReference Include="..\Edu.Module.Public\Edu.Module.Public.csproj" />
......
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