using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.ViewModel.App;
using Edu.Repository.App;
using VT.FW.DB;
namespace Edu.Module.System
{
public class AppSystemMsgModule
{
///
/// app学生系统消息仓储层对象
///
private readonly RB_Student_SystemMsgRepository studentSystemMsgRepository = new RB_Student_SystemMsgRepository();
#region 学生app系统消息
///
/// 获取学生app系统消息
///
///
///
public List GetStudentSystemMsgList(RB_Student_SystemMsg_ViewModel query)
{
return studentSystemMsgRepository.GetStudentSystemMsgList(query);
}
///
/// 新增系统消息
///
///
///
//[TransactionCallHandler]
public bool SetStudentSystemMsg(RB_Student_SystemMsg_ViewModel model)
{
bool flag = false;
if (model.MsgId == 0)
{
return studentSystemMsgRepository.Insert(model) > 0;
}
return flag;
}
///
/// 批量新增系统消息
///
///
///
//[TransactionCallHandler]
public bool BatchSetStudentSystemMsg(List list)
{
return studentSystemMsgRepository.InsertBatch(list);
}
///
/// 批量删除消息
///
///
///
///
///
public bool DelStudentMsgById(string MsgIds, int Group_Id)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Student_SystemMsg_ViewModel.Status),1 }
};
List wheres = new List() {
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.MsgId),
FiledValue=MsgIds,
OperatorEnum=OperatorEnum.IN
},
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.Group_Id),
FiledValue=Group_Id,
OperatorEnum=OperatorEnum.Equal
}
};
return studentSystemMsgRepository.Update(fileds, wheres);
}
///
/// 批量更新未读消息
///
///
///
///
///
public bool UpdateStudentMsgById(int MsgId, int Group_Id, int AccountId)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Student_SystemMsg_ViewModel.IsRead),1 },
{nameof(RB_Student_SystemMsg_ViewModel.ReadTime),DateTime.Now}
};
List wheres = new List() {
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.MsgId),
FiledValue=MsgId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.Group_Id),
FiledValue=Group_Id,
OperatorEnum=OperatorEnum.Equal
}
, new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.Student_Id),
FiledValue=AccountId,
OperatorEnum=OperatorEnum.Equal
}
};
return studentSystemMsgRepository.Update(fileds, wheres);
}
///
/// 批量更新未读消息
///
///
///
///
///
public bool UpdateStudentMsg(int MsgType, int Group_Id, int AccountId)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Student_SystemMsg_ViewModel.IsRead),1 },
{nameof(RB_Student_SystemMsg_ViewModel.ReadTime),DateTime.Now}
};
List wheres = new List() {
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.MsgType),
FiledValue=MsgType,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.Group_Id),
FiledValue=Group_Id,
OperatorEnum=OperatorEnum.Equal
}
, new WhereHelper(){
FiledName=nameof(RB_Student_SystemMsg_ViewModel.Student_Id),
FiledValue=AccountId,
OperatorEnum=OperatorEnum.Equal
}
};
return studentSystemMsgRepository.Update(fileds, wheres);
}
///
/// 获取学生app系统分页列表
///
/// 当前页
/// 每页显示条数
/// 总条数
/// 查询条件
///
public List GetStudentSystemMsgPageList(int pageIndex, int pageSize, out long rowsCount, RB_Student_SystemMsg_ViewModel query)
{
return studentSystemMsgRepository.GetStudentSystemMsgPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
#endregion
}
}