Commit 445c41de authored by 黄奎's avatar 黄奎

页面修改

parent 4c353274
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Duty
......
......@@ -28,5 +28,10 @@ namespace Edu.Model.ViewModel.Duty
return str;
}
}
/// <summary>
/// 关键字查询
/// </summary>
public string KeyWords { get; set; }
}
}
......@@ -43,6 +43,19 @@ namespace Edu.Module.Duty
return dutyItemRepository.GetDutyItemListExtRepository(query);
}
/// <summary>
/// 获取值班事项设置分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Item_ViewModel> GetDutyItemPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Duty_Item_ViewModel query)
{
return dutyItemRepository.GetDutyItemPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 删除值班事项
/// </summary>
......
......@@ -43,6 +43,41 @@ WHERE 1=1 ");
return Get<RB_Duty_Item_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取值班事项设置分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Duty_Item_ViewModel> GetDutyItemPageRepository(int pageIndex,int pageSize,out long rowsCount, 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 GetPage<RB_Duty_Item_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取班次工作清单
/// </summary>
......
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Duty
{
......@@ -22,6 +23,7 @@ namespace Edu.Repository.Duty
/// <returns></returns>
public List<RB_Visitor_ViewModel> GetVisitorPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Visitor_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
......@@ -43,8 +45,13 @@ WHERE 1=1
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Visitor_ViewModel.PlanId), query.PlanId);
}
if (!string.IsNullOrEmpty(query.KeyWords))
{
builder.AppendFormat(" AND (A.{0} LIKE @KeyWord OR A.{1} LIKE @KeyWord OR A.{2} LIKE @KeyWord)", nameof(RB_Visitor_ViewModel.Name), nameof(RB_Visitor_ViewModel.Tel), nameof(RB_Visitor_ViewModel.WeChatNum));
parameters.Add("KeyWord", "%" + query.KeyWords.Trim() + "%");
}
}
return GetPage<RB_Visitor_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
return GetPage<RB_Visitor_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
......
......@@ -145,13 +145,14 @@ namespace Edu.WebApi.Controllers.Duty
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDutyItemList()
public ApiResult GetDutyItemPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Duty_Item_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
};
var list = dutyModule.GetDutyItemListExtModule(query);
var list = dutyModule.GetDutyItemPageModule(pageModel.PageIndex,pageModel.PageSize,out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
......@@ -160,7 +161,9 @@ namespace Edu.WebApi.Controllers.Duty
}
item.SchoolName = item.SchoolName.Replace(',', '|');
}
return ApiResult.Success(data: list);
pageModel.PageData = list;
pageModel.Count = rowsCount;
return ApiResult.Success(data: pageModel);
}
......
......@@ -278,8 +278,8 @@ namespace Edu.WebApi.Controllers.Duty
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Visitor_ViewModel()
{
WeChatNum=base.ParmJObj.GetStringValue("WeChatNum"),
PlanId=base.ParmJObj.GetInt("PlanId"),
PlanId = base.ParmJObj.GetInt("PlanId"),
KeyWords = base.ParmJObj.GetStringValue("KeyWords")
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>();
......
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