Commit 7970a83d authored by 黄奎's avatar 黄奎

页面修改

parent 8452fa7e
using Edu.Model.Entity.Course; using Edu.Common.Plugin;
using Edu.Model.Entity.Course;
namespace Edu.Model.ViewModel.Course namespace Edu.Model.ViewModel.Course
{ {
...@@ -21,5 +22,20 @@ namespace Edu.Model.ViewModel.Course ...@@ -21,5 +22,20 @@ namespace Edu.Model.ViewModel.Course
/// 校区名称 /// 校区名称
/// </summary> /// </summary>
public string SchoolName { get; set; } public string SchoolName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
/// <summary>
/// 更新时间
/// </summary>
public string UpdateTimeStr { get { return Common.ConvertHelper.FormatTime(this.UpdateTime); } }
/// <summary>
/// 状态字符串
/// </summary>
public string StatusStr { get { return this.Status.ToName(); } }
} }
} }
...@@ -54,8 +54,9 @@ namespace Edu.Module.Course ...@@ -54,8 +54,9 @@ namespace Edu.Module.Course
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Class_Room_ViewModel.RoomName),extModel.RoomName }, {nameof(RB_Class_Room_ViewModel.RoomName),extModel.RoomName },
{nameof(RB_Class_Room_ViewModel.UpdateBy),extModel.UpdateBy }, {nameof(RB_Class_Room_ViewModel.UpdateBy),extModel.UpdateBy },
{nameof(RB_Class_Room_ViewModel.UpdateTime),extModel.UpdateTime }, {nameof(RB_Class_Room_ViewModel.UpdateTime),extModel.UpdateTime },
{nameof(RB_Class_Room_ViewModel.School_Id),extModel.School_Id },
}; };
flag = class_RoomRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Room_ViewModel.RoomId), extModel.RoomId)); flag = class_RoomRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Room_ViewModel.RoomId), extModel.RoomId));
} }
...@@ -83,12 +84,13 @@ namespace Edu.Module.Course ...@@ -83,12 +84,13 @@ namespace Edu.Module.Course
/// 删除教室 /// 删除教室
/// </summary> /// </summary>
/// <param name="RoomId"></param> /// <param name="RoomId"></param>
/// <param name="Status">状态</param>
/// <returns></returns> /// <returns></returns>
public bool RemoveClassRoomModule(object RoomId) public bool RemoveClassRoomModule(object RoomId,int Status)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{ nameof(RB_Class_Room_ViewModel.Status),(int)DateStateEnum.Delete}, { nameof(RB_Class_Room_ViewModel.Status),Status},
}; };
return class_RoomRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Room_ViewModel.RoomId), RoomId)); return class_RoomRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Room_ViewModel.RoomId), RoomId));
} }
......
...@@ -40,6 +40,10 @@ WHERE 1=1 ...@@ -40,6 +40,10 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.School_Id), query.School_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.School_Id), query.School_Id);
} }
if (query.Status >=0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.Status), (int)query.Status);
}
if (!string.IsNullOrEmpty(query.RoomName)) if (!string.IsNullOrEmpty(query.RoomName))
{ {
builder.AppendFormat(" AND A.{0} LIKE @RoomName ", nameof(RB_Class_Room_ViewModel.RoomName)); builder.AppendFormat(" AND A.{0} LIKE @RoomName ", nameof(RB_Class_Room_ViewModel.RoomName));
......
...@@ -201,11 +201,11 @@ FROM ...@@ -201,11 +201,11 @@ FROM
{ {
if (query.Group_Id > 0) if (query.Group_Id > 0)
{ {
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.Group_Id), query.Group_Id); where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.Group_Id), query.Group_Id);
} }
if (query.School_Id > 0) if (query.School_Id > 0)
{ {
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.School_Id), query.School_Id); where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.School_Id), query.School_Id);
} }
if (!string.IsNullOrWhiteSpace(query.Account)) if (!string.IsNullOrWhiteSpace(query.Account))
{ {
...@@ -231,6 +231,10 @@ FROM ...@@ -231,6 +231,10 @@ FROM
{ {
where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.Post_Id), query.Post_Id); where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.Post_Id), query.Post_Id);
} }
if (query.LeaveStatus > 0)
{
where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.LeaveStatus), (int)query.LeaveStatus);
}
if (!string.IsNullOrEmpty(query.QPostIds)) if (!string.IsNullOrEmpty(query.QPostIds))
{ {
where.AppendFormat(" AND B.{0} IN({1}) ", nameof(Employee_ViewModel.Post_Id), query.QPostIds); where.AppendFormat(" AND B.{0} IN({1}) ", nameof(Employee_ViewModel.Post_Id), query.QPostIds);
...@@ -270,21 +274,22 @@ FROM ...@@ -270,21 +274,22 @@ FROM
{ {
where.AppendFormat(" AND b.{0}<='{1} 23:59:59' ", nameof(Employee_ViewModel.LeaveTime), query.EndLeaveTime); where.AppendFormat(" AND b.{0}<='{1} 23:59:59' ", nameof(Employee_ViewModel.LeaveTime), query.EndLeaveTime);
} }
if (!string.IsNullOrEmpty(query.StartBirthDate)) //if (!string.IsNullOrEmpty(query.StartBirthDate))
{
where.AppendFormat($@"AND STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') >= STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-','{query.StartBirthDate}') , '%Y-%m-%d') ");
}
if (!string.IsNullOrEmpty(query.EndBirthDate))
{
where.AppendFormat($@" AND (CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-','{query.EndBirthDate}') , '%Y-%m-%d') ");
}
//if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate))
//{ //{
// where.AppendFormat(@"AND ( // where.AppendFormat($@"AND STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') >= STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-','{query.StartBirthDate}') , '%Y-%m-%d') ");
// CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')) >= '{0}'
// AND CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')) <= '{1}'
// )", query.StartBirthDate, query.EndBirthDate);
//} //}
//if (!string.IsNullOrEmpty(query.EndBirthDate))
//{
// where.AppendFormat($@" AND (CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y'),'-','{query.EndBirthDate}') , '%Y-%m-%d') ");
//}
if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate))
{
//OR前面是不跨年,OR后面是跨年
where.AppendFormat(@"AND (
(CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')) BETWEEN '{0}' AND '{1}')
OR (CONCAT(YEAR(NOW())+1, '-',DATE_FORMAT(b.BirthDate,'%m-%d')) BETWEEN '{0}' AND '{1}')
)", query.StartBirthDate, query.EndBirthDate);
}
} }
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
...@@ -301,17 +306,17 @@ FROM ...@@ -301,17 +306,17 @@ FROM
( (
SELECT A.*,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate SELECT A.*,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.MTel AS EmployeeTel ,B.LeaveStatus,B.LeaveTime,B.MTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_manager AS B ON A.AccountId=B.MId AND A.AccountType=1 FROM rb_manager AS B LEFT JOIN rb_account AS A ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0} WHERE 1=1 {0}
UNION ALL UNION ALL
SELECT A.*,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate SELECT A.*,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.TeacherTel AS EmployeeTel ,B.LeaveStatus,B.LeaveTime,B.TeacherTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_teacher AS B ON A.AccountId=B.TId AND A.AccountType=2 FROM rb_teacher AS B LEFT JOIN rb_account AS A ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0} WHERE 1=1 {0}
UNION ALL UNION ALL
SELECT A.*,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate SELECT A.*,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.AssistTel AS EmployeeTel ,B.LeaveStatus,B.LeaveTime,B.AssistTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_assist AS B ON A.AccountId=B.AId AND A.AccountType=3 FROM rb_assist AS B LEFT JOIN rb_account AS A ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0} WHERE 1=1 {0}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId ) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
LEFT JOIN rb_school AS s ON A.School_Id=s.SId LEFT JOIN rb_school AS s ON A.School_Id=s.SId
......
...@@ -4,6 +4,7 @@ using System.Linq; ...@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Edu.Cache.User; using Edu.Cache.User;
using Edu.Common.API; using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Module.Course; using Edu.Module.Course;
...@@ -33,9 +34,13 @@ namespace Edu.WebApi.Controllers.Course ...@@ -33,9 +34,13 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetClassRoomPageList() public ApiResult GetClassRoomPageList()
{ {
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString()); var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_Room_ViewModel>(RequestParm.Msg.ToString()); var query = new RB_Class_Room_ViewModel()
query.Group_Id = base.UserInfo.Group_Id; {
query.School_Id = base.UserInfo.School_Id; Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id"),
RoomName = base.ParmJObj.GetStringValue("RoomName"),
Status = (DateStateEnum)base.ParmJObj.GetInt("Status"),
};
var list = classRoomModule.GetClassRoomPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query); var list = classRoomModule.GetClassRoomPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list) foreach (var item in list)
{ {
...@@ -60,9 +65,12 @@ namespace Edu.WebApi.Controllers.Course ...@@ -60,9 +65,12 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost] [HttpPost]
public ApiResult GetClassRoomList() public ApiResult GetClassRoomList()
{ {
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_Room_ViewModel>(RequestParm.Msg.ToString()); var query = new RB_Class_Room_ViewModel()
query.Group_Id = base.UserInfo.Group_Id; {
query.School_Id = base.UserInfo.School_Id; Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id"),
RoomName = base.ParmJObj.GetStringValue("RoomName")
};
var list = classRoomModule.GetClassRoomListRepository(query); var list = classRoomModule.GetClassRoomListRepository(query);
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
...@@ -80,7 +88,6 @@ namespace Edu.WebApi.Controllers.Course ...@@ -80,7 +88,6 @@ namespace Edu.WebApi.Controllers.Course
extModel.UpdateBy = UserInfo.Id; extModel.UpdateBy = UserInfo.Id;
extModel.UpdateTime = DateTime.Now; extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = this.UserInfo.Group_Id; extModel.Group_Id = this.UserInfo.Group_Id;
extModel.School_Id = this.UserInfo.School_Id;
bool flag = classRoomModule.SetClassRoomModule(extModel); bool flag = classRoomModule.SetClassRoomModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
...@@ -92,8 +99,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -92,8 +99,8 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost] [HttpPost]
public ApiResult GetClassRoom() public ApiResult GetClassRoom()
{ {
var ClassId = base.ParmJObj.GetInt("RoomId", 0); var RoomId = base.ParmJObj.GetInt("RoomId", 0);
var extModel = classRoomModule.GetClassRoomModule(ClassId); var extModel = classRoomModule.GetClassRoomModule(RoomId);
return ApiResult.Success(data: extModel); return ApiResult.Success(data: extModel);
} }
...@@ -104,8 +111,9 @@ namespace Edu.WebApi.Controllers.Course ...@@ -104,8 +111,9 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost] [HttpPost]
public ApiResult RemoveClassRoom() public ApiResult RemoveClassRoom()
{ {
var ClassId = base.ParmJObj.GetInt("RoomId", 0); var RoomId = base.ParmJObj.GetInt("RoomId", 0);
var flag = classRoomModule.RemoveClassRoomModule(ClassId); var Status = base.ParmJObj.GetInt("Status");
var flag = classRoomModule.RemoveClassRoomModule(RoomId, Status);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
#endregion #endregion
......
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