Commit 11e6d98c authored by 黄奎's avatar 黄奎

页面修改

parent 07746cb1
......@@ -11,5 +11,20 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public class RB_StuWords_Prep_Extend: RB_StuWords_Prep
{
/// <summary>
/// 学习分钟数
/// </summary>
public string StartMinutes
{
get
{
string str = "";
if (this.StartTime != null && this.EndTime != null)
{
str = Common.ConvertHelper.CalcMinutes(Convert.ToDateTime(this.StartTime), Convert.ToDateTime(this.EndTime)).ToString();
}
return str;
}
}
}
}
......@@ -333,6 +333,17 @@ namespace Edu.Module.Exam
};
}
/// <summary>
/// 获取单词预习分页列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_StuWords_Prep_Extend> GetStuWordsPrepPageModule(int pageIndex, int pageSize, out long rowsCount, RB_StuWords_Prep_Extend query)
{
var list = stuWords_PrepRepository.GetStuWordsPrepPageRepository(pageIndex, pageSize, out rowsCount, query);
return list;
}
/// <summary>
/// 新增修改学员单词学习
/// </summary>
......@@ -346,6 +357,14 @@ namespace Edu.Module.Exam
CourseId = model.CourseId,
ChapterId = model.ChapterId
});
var oldModel = stuWords_PrepRepository.GetStuWordsPrepListRepository(new RB_StuWords_Prep_Extend()
{
Stu_Account_Id = model.Stu_Account_Id,
CourseId = model.CourseId,
ChapterId = model.ChapterId,
Group_Id = model.Group_Id
})?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -417,13 +436,21 @@ namespace Edu.Module.Exam
CourseId = model.CourseId,
ChapterId = model.ChapterId
});
var oldModel = stuWords_ReviewRepository.GetStuWordsReviewListRepository(new RB_StuWords_Review_Extend()
{
Stu_Account_Id = model.Stu_Account_Id,
CourseId = model.CourseId,
ChapterId = model.ChapterId,
Group_Id = model.Group_Id
})?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_StuWords_Review_Extend.ReviewNum),model.ReviewNum },
};
fileds.Add(nameof(RB_StuWords_Review_Extend.Score), GetScoreModule(model.ReviewNum, (wordsList?.Count ?? 0)));
if (model.ReviewNum == (wordsList?.Count ?? 0))
{
fileds.Add(nameof(RB_StuWords_Prep_Extend.EndTime), DateTime.Now);
......@@ -434,7 +461,6 @@ namespace Edu.Module.Exam
{
model.ReviewNum = 1;
model.TotalNum = wordsList?.Count() ?? 0;
model.Score = GetScoreModule(model.ReviewNum, model.TotalNum);
model.StartTime = DateTime.Now;
var newId = stuWords_ReviewRepository.Insert(model);
model.Id = newId;
......
using Edu.Model.Entity.Exam;
using Edu.Model.ViewModel.Exam;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Exam
......@@ -10,5 +12,67 @@ namespace Edu.Repository.Exam
/// </summary>
public class RB_StuWords_PrepRepository : BaseRepository<RB_StuWords_Prep>
{
/// <summary>
/// 获取单词预习列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_StuWords_Prep_Extend> GetStuWordsPrepListRepository(RB_StuWords_Prep_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_StuWords_Prep AS A WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.Group_Id), query.Group_Id);
}
if (query.CourseId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.CourseId), query.CourseId);
}
if (query.ChapterId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.ChapterId), query.ChapterId);
}
if (query.Stu_Account_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.Stu_Account_Id), query.Stu_Account_Id);
}
}
return Get<RB_StuWords_Prep_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 获取单词预习分页列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_StuWords_Prep_Extend> GetStuWordsPrepPageRepository(int pageIndex,int pageSize,out long rowsCount, RB_StuWords_Prep_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_StuWords_Prep AS A WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.Group_Id), query.Group_Id);
}
if (query.CourseId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.CourseId), query.CourseId);
}
if (query.ChapterId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.ChapterId), query.ChapterId);
}
if (query.Stu_Account_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Prep_Extend.Stu_Account_Id), query.Stu_Account_Id);
}
}
return GetPage<RB_StuWords_Prep_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
using Edu.Model.Entity.Exam;
using Edu.Model.ViewModel.Exam;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Exam
......@@ -10,6 +12,35 @@ namespace Edu.Repository.Exam
/// </summary>
public class RB_StuWords_ReviewRepository : BaseRepository<RB_StuWords_Review>
{
/// <summary>
/// 获取单词复习列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_StuWords_Review_Extend> GetStuWordsReviewListRepository(RB_StuWords_Review_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_StuWords_Prep AS A WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Review_Extend.Group_Id), query.Group_Id);
}
if (query.CourseId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Review_Extend.CourseId), query.CourseId);
}
if (query.ChapterId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Review_Extend.ChapterId), query.ChapterId);
}
if (query.Stu_Account_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_StuWords_Review_Extend.Stu_Account_Id), query.Stu_Account_Id);
}
}
return Get<RB_StuWords_Review_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -57,7 +57,7 @@ namespace Edu.WebApi.Controllers.Applet
model.Group_Id = base.AppletUserInfo.Group_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = courseExamModule.SetStuWordsPrepModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
return flag ? ApiResult.Success(data:model) : ApiResult.Failed();
}
/// <summary>
......
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