using Edu.Common.Enum.Log; using Edu.Model.Entity.Customer; using Edu.Model.ViewModel.Customer; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Edu.Repository.Customer { /// /// 学员日志仓储层 /// public class RB_Student_LogRepository : BaseRepository { /// /// 获取学员日志分页列表 /// /// /// /// /// /// public List GetStudentLogPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Student_Log_Extend query) { StringBuilder builder = new StringBuilder(); builder.AppendFormat(@" SELECT A.* FROM RB_Student_Log AS A WHERE 1=1 "); if (query != null) { if (query.StuId > 0) { builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Log_Extend.StuId), query.StuId); } } builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Student_Log_Extend.LogId)); return GetPage(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList(); } /// /// 新增学员日志 /// /// 学员编号 /// 日志类型 /// 日志标题 /// 日志内容 /// 创建人 /// 创建人类型(1-系统用户,2-同行用户) /// 集团编号 /// public bool AddStuLogRepository(int StuId, StudentLogTypeEnum LogType,string LogTitle, string LogContent, int CreateBy, int CreateType = 1, int Group_Id = 100000) { var newModel = new RB_Student_Log_Extend() { LogId = 0, StuId = StuId, LogType = LogType, LogTitle= LogTitle, LogContent = LogContent, CreateTime = DateTime.Now, CreateType = CreateType, CreateBy = CreateBy, Group_Id = Group_Id }; var newId = base.Insert(newModel); newModel.LogId = newId; return newId > 0; } } }