Commit 0e32762c authored by 黄奎's avatar 黄奎

页面修改

parent cde9b8a0
...@@ -213,9 +213,11 @@ namespace Edu.Module.Question ...@@ -213,9 +213,11 @@ namespace Edu.Module.Question
[TransactionCallHandler] [TransactionCallHandler]
public virtual bool UpdateQuestionSortModule(int curQId, int targetQId) public virtual bool UpdateQuestionSortModule(int curQId, int targetQId)
{ {
var currentModel = GetQuestionModule(curQId);
var targetModel = GetQuestionModule(targetQId);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Question_ViewModel.SortNum),targetQId}, {nameof(RB_Question_ViewModel.SortNum),targetModel.SortNum},
}; };
bool flag = questionRepository.Update(fileds, new WhereHelper(nameof(RB_Question_ViewModel.QuestionId), curQId)); bool flag = questionRepository.Update(fileds, new WhereHelper(nameof(RB_Question_ViewModel.QuestionId), curQId));
if (flag) if (flag)
...@@ -223,7 +225,7 @@ namespace Edu.Module.Question ...@@ -223,7 +225,7 @@ namespace Edu.Module.Question
//排序修改 //排序修改
Dictionary<string, object> fileds2 = new Dictionary<string, object>() Dictionary<string, object> fileds2 = new Dictionary<string, object>()
{ {
{nameof(RB_Question_ViewModel.SortNum),curQId}, {nameof(RB_Question_ViewModel.SortNum),currentModel.SortNum},
}; };
flag = questionRepository.Update(fileds2, new WhereHelper(nameof(RB_Question_ViewModel.QuestionId), targetQId)); flag = questionRepository.Update(fileds2, new WhereHelper(nameof(RB_Question_ViewModel.QuestionId), targetQId));
} }
......
...@@ -93,7 +93,7 @@ WHERE 1=1 "); ...@@ -93,7 +93,7 @@ WHERE 1=1 ");
{ {
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.Category), query.QCategoryId); builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.Category), query.QCategoryId);
} }
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Question_ViewModel.QuestionId)); builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_ViewModel.SortNum));
return GetPage<RB_Question_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList(); return GetPage<RB_Question_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
} }
......
...@@ -172,6 +172,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -172,6 +172,7 @@ namespace Edu.WebApi.Controllers.Course
} }
var list = questionModule.GetQuestionPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query); var list = questionModule.GetQuestionPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<object> resultList = new List<object>(); List<object> resultList = new List<object>();
int index = 1;
foreach (var item in list) foreach (var item in list)
{ {
if (item.CreateBy > 0) if (item.CreateBy > 0)
...@@ -195,6 +196,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -195,6 +196,7 @@ namespace Edu.WebApi.Controllers.Course
} }
resultList.Add(new resultList.Add(new
{ {
Number=(pageModel.PageIndex-1)*pageModel.PageSize+index,
item.QuestionId, item.QuestionId,
item.CourseId, item.CourseId,
Title= newTitle, Title= newTitle,
...@@ -207,6 +209,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -207,6 +209,7 @@ namespace Edu.WebApi.Controllers.Course
item.CategoryName, item.CategoryName,
DifficultyTypeName = item.DifficultyType.ToName(), DifficultyTypeName = item.DifficultyType.ToName(),
}); ; }); ;
index++;
} }
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
pageModel.PageData = resultList; pageModel.PageData = resultList;
...@@ -705,7 +708,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -705,7 +708,7 @@ namespace Edu.WebApi.Controllers.Course
copyModel.UpdateBy = base.UserInfo.Id; copyModel.UpdateBy = base.UserInfo.Id;
copyModel.UpdateTime = DateTime.Now; copyModel.UpdateTime = DateTime.Now;
} }
var flag = false; var flag = questionModule.SetQuestionModule(copyModel);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
else else
......
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