Commit 133f30b0 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 1fb8a42e 82565612
......@@ -11,21 +11,16 @@ namespace Edu.Common.Enum.Question
public enum LevelTypeEnum
{
/// <summary>
/// 高考日语
///N1
/// </summary>
[EnumField("高考日语")]
GaoKao = 6,
[EnumField("N1")]
N1 = 1,
/// <summary>
/// N5
/// </summary>
[EnumField("N5")]
N5 = 5,
/// <summary>
///N4
///N2
/// </summary>
[EnumField("N4")]
N4 = 4,
[EnumField("N2")]
N2 = 2,
/// <summary>
///N3
......@@ -34,15 +29,20 @@ namespace Edu.Common.Enum.Question
N3 = 3,
/// <summary>
///N2
///N4
/// </summary>
[EnumField("N2")]
N2 = 2,
[EnumField("N4")]
N4 = 4,
/// <summary>
///N1
/// N5
/// </summary>
[EnumField("N1")]
N1 = 1,
[EnumField("N5")]
N5 = 5,
/// <summary>
/// 高考日语
/// </summary>
[EnumField("高考日语")]
GaoKao = 6,
}
}
......@@ -17,7 +17,12 @@ namespace Edu.Model.Entity.Question
public int BankId { get; set; }
/// <summary>
/// BankName
/// 题库编号
/// </summary>
public string BankNo { get; set; }
/// <summary>
/// 题库名称
/// </summary>
public string BankName { get; set; }
......
using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Common.Enum.Question;
using Edu.Model.ViewModel.Question;
using Edu.Repository.Question;
using System.Collections.Generic;
......@@ -64,7 +65,8 @@ namespace Edu.Module.Question
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Question_Bank_ViewModel.BankName), model.BankName }
{nameof(RB_Question_Bank_ViewModel.BankName), model.BankName },
{nameof(RB_Question_Bank_ViewModel.BankNo), model.BankNo },
};
flag = question_BankRepository.Update(fileds, new WhereHelper(nameof(RB_Question_Bank_ViewModel.BankId), model.BankId));
}
......@@ -181,6 +183,17 @@ namespace Edu.Module.Question
return flag;
}
/// <summary>
/// 批量修改问题考级程度
/// </summary>
/// <param name="levelTypeEnum"></param>
/// <param name="questionIdList"></param>
/// <returns></returns>
public bool SetBatchQuestionLevelModule(LevelTypeEnum levelTypeEnum, List<int> questionIdList)
{
return questionRepository.SetBatchQuestionLevelRepository(levelTypeEnum, questionIdList);
}
/// <summary>
/// 批量添加问题
/// </summary>
......
using Edu.Common.Enum;
using Edu.Common.Enum.Question;
using Edu.Model.ViewModel.Question;
using System.Collections.Generic;
using System.Linq;
......@@ -97,6 +98,19 @@ WHERE 1=1 ");
return GetPage<RB_Question_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
/// <summary>
/// 批量更新问题考级程度
/// </summary>
/// <param name="levelTypeEnum"></param>
/// <param name="questionIdList"></param>
/// <returns></returns>
public bool SetBatchQuestionLevelRepository(LevelTypeEnum levelTypeEnum, List<int> questionIdList)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" UPDATE RB_Question SET LevelType={0} WHERE QuestionId IN ({1}) ", (int)levelTypeEnum, string.Join(",", questionIdList));
return base.Execute(builder.ToString()) > 0;
}
}
}
\ No newline at end of file
......@@ -48,10 +48,10 @@ WHERE 1=1 ");
}
if (!string.IsNullOrEmpty(query.BankName))
{
builder.AppendFormat(" AND A.{0} LIKE @BankName ", nameof(RB_Question_Bank_ViewModel.BankName));
builder.AppendFormat(" AND (A.{0} LIKE @BankName OR A.{1} LIKE @BankName)", nameof(RB_Question_Bank_ViewModel.BankName), nameof(RB_Question_Bank_ViewModel.BankNo));
parameters.Add("BankName", "%" + query.BankName.Trim() + "%");
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Question_Bank_ViewModel.BankId));
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_Bank_ViewModel.BankNo));
return GetPage<RB_Question_Bank_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
......
......@@ -44,6 +44,7 @@ namespace Edu.WebApi.Controllers.Course
query.Group_Id = base.UserInfo.Group_Id;
var list = questionModule.GetQuestionBankPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<object> resultList = new List<object>();
int index = 1;
foreach (var item in list)
{
if (item.CreateBy > 0)
......@@ -52,11 +53,14 @@ namespace Edu.WebApi.Controllers.Course
}
resultList.Add(new
{
RowNum=(pageModel.PageIndex-1)* pageModel.PageSize+index,
item.BankId,
item.BankNo,
item.BankName,
item.CreateByName,
item.QuestionCount
});
});
index++;
}
pageModel.Count = rowsCount;
pageModel.PageData = resultList;
......@@ -579,6 +583,19 @@ namespace Edu.WebApi.Controllers.Course
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 批量修改问题考级程度
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetBatchQuestionLevel()
{
var LevelType = (LevelTypeEnum)base.ParmJObj.GetInt("LevelType");
List<int> questionIds = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("questionIds"));
var flag = questionModule.SetBatchQuestionLevelModule(LevelType, questionIds);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 选择题验证
/// </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