Commit c0bd0207 authored by 黄奎's avatar 黄奎

11111

parent dcbe2381
using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using System.Collections.Generic;
namespace EduSpider.IRepository
......@@ -13,13 +13,21 @@ namespace EduSpider.IRepository
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool SetCourseCommentDetailsRepository(List<RB_Course_CommentDetails> list);
public bool SetCourseCommentDetailsRepository(List<RB_Course_CommentDetails_Extend> list);
/// <summary>
/// 获取课程评价配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_CommentDetails> GetCourseCommentDetailsListRepository(RB_Course_Comment query);
public List<RB_Course_CommentDetails_Extend> GetCourseCommentDetailsListRepository(RB_Course_CommentDetails_Extend query);
/// <summary>
/// 根据编号删除课程评价详情配置
/// </summary>
/// <param name="DetailIds"></param>
/// <returns></returns>
public bool DeleteCourseCommentDetailsRepository(string DetailIds);
}
}
......@@ -22,7 +22,7 @@ namespace EduSpider.IServices
/// <returns></returns>
public List<RB_Course_Student_Extend> GetStuCourseList(CourseQuery query);
/// <summary>
/// 获取学员考试和家庭作业列表
/// </summary>
......@@ -50,5 +50,35 @@ namespace EduSpider.IServices
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetHomeWorkDetails(CourseQuery query);
/// <summary>
/// 新增修改课程评价配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCourseComment(RB_Course_Comment_Extend model);
/// <summary>
/// 获取课程评价配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Comment_Extend> GetCourseCommentList(CourseQuery query);
/// <summary>
/// 根据评价编号删除课程评价配置
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public bool DeleteCourseComment(string Ids);
/// <summary>
/// 根据编号删除课程评价详情配置
/// </summary>
/// <param name="DetailIds"></param>
/// <returns></returns>
public bool DeleteCourseCommentDetail(string DetailIds);
}
}
using EduSpider.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EduSpider.Model.Extend
{
/// <summary>
/// 课程评价配置详情扩展实体类
/// </summary>
public class RB_Course_CommentDetails_Extend : RB_Course_CommentDetails
{
/// <summary>
/// 课程评价配置编号【查询使用】
/// </summary>
public string QCourseCommentIds { get; set; }
}
}
......@@ -11,6 +11,6 @@ namespace EduSpider.Model.Extend
/// <summary>
/// 课程评价配置详情列表
/// </summary>
public List<RB_Course_CommentDetails> CommentDetails { get; set; }
public List<RB_Course_CommentDetails_Extend> CommentDetails { get; set; }
}
}
using EduSpider.IRepository;
using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -18,7 +19,7 @@ namespace EduSpider.Repository
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool SetCourseCommentDetailsRepository(List<RB_Course_CommentDetails> list)
public bool SetCourseCommentDetailsRepository(List<RB_Course_CommentDetails_Extend> list)
{
bool flag = true;
if (list != null && list.Count > 0)
......@@ -54,7 +55,7 @@ namespace EduSpider.Repository
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_CommentDetails> GetCourseCommentDetailsListRepository(RB_Course_Comment query)
public List<RB_Course_CommentDetails_Extend> GetCourseCommentDetailsListRepository(RB_Course_CommentDetails_Extend query)
{
StringBuilder builder = new();
builder.AppendFormat(@"
......@@ -64,12 +65,23 @@ WHERE 1=1
");
if (query != null)
{
if (query.Id > 0)
if (!string.IsNullOrEmpty(query.QCourseCommentIds))
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_CommentDetails.CourseCommentId), query.Id);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Course_CommentDetails_Extend.CourseCommentId), query.QCourseCommentIds);
}
}
return Get<RB_Course_CommentDetails>(builder.ToString()).ToList();
return Get<RB_Course_CommentDetails_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 根据编号删除课程评价详情配置
/// </summary>
/// <param name="DetailIds"></param>
/// <returns></returns>
public bool DeleteCourseCommentDetailsRepository(string DetailIds)
{
string sql = string.Format("UPDATE RB_Course_CommentDetails SET Status=1 WHERE DetailId IN({0}) ", DetailIds);
return base.Execute(sql) > 0;
}
}
}
......@@ -2,11 +2,9 @@
using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using EduSpider.Model.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EduSpider.Repository
{
......@@ -15,6 +13,11 @@ namespace EduSpider.Repository
/// </summary>
public class CourseCommentRepository : Base.BaseRepository<RB_Course_Comment>, ICourseCommentRepository
{
/// <summary>
/// 课程评价配置详情仓储对象
/// </summary>
private readonly CourseCommentDetailsRepository courseCommentDetailsRepository = new();
/// <summary>
/// 批量新增修改课程评价
/// </summary>
......@@ -27,8 +30,8 @@ namespace EduSpider.Repository
{
Dictionary<string, object> fileds = new()
{
{nameof(RB_Course_Comment_Extend.Title),model.Title },
{nameof(RB_Course_Comment_Extend.ShowType),model.ShowType },
{ nameof(RB_Course_Comment_Extend.Title), model.Title },
{ nameof(RB_Course_Comment_Extend.ShowType), model.ShowType },
};
flag = base.UpdateOne(fileds, new VTX.FW.DB.WhereHelper(nameof(RB_Course_Comment_Extend.Id), model.Id));
}
......@@ -38,6 +41,14 @@ namespace EduSpider.Repository
model.Id = newId;
flag = newId > 0;
}
if (model.CommentDetails != null && model.CommentDetails.Count > 0)
{
foreach (var item in model.CommentDetails)
{
item.CourseCommentId = model.Id;
}
flag = courseCommentDetailsRepository.SetCourseCommentDetailsRepository(model.CommentDetails);
}
return flag;
}
......@@ -61,7 +72,17 @@ WHERE 1=1
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Comment_Extend.CourseId), query.CourseId);
}
}
return Get<RB_Course_Comment_Extend>(builder.ToString()).ToList();
var list = Get<RB_Course_Comment_Extend>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
string Ids = string.Join(",", list.Select(qitem => qitem.Id));
List<RB_Course_CommentDetails_Extend> detailsList = courseCommentDetailsRepository.GetCourseCommentDetailsListRepository(new RB_Course_CommentDetails_Extend() { QCourseCommentIds = Ids });
foreach (var item in list)
{
item.CommentDetails = detailsList?.Where(qitem => qitem.CourseCommentId == item.Id)?.ToList() ?? new List<RB_Course_CommentDetails_Extend>();
}
}
return list;
}
/// <summary>
......
......@@ -55,7 +55,19 @@ namespace EduSpider.Services
[Autowired]
public IExam_ScoreRepository Exam_ScoreRepository { get; set; }
/// <summary>
/// 课程评价配置仓储接口
/// </summary>
[Autowired]
public ICourseCommentRepository CourseCommentRepository { get; set; }
/// <summary>
/// 课程评价详情配置仓储接口
/// </summary>
[Autowired]
public ICourseCommentDetailsRepository CourseCommentDetailsRepository { get; set; }
/// <summary>
/// 获取学员课程列表
......@@ -112,8 +124,8 @@ namespace EduSpider.Services
Score_p = score_p,
ExamRank = item.Rank,
ExamRankRate = item.RankRate,
ExamId= item.ExamId,
ExamScoreId=item.Id,
ExamId = item.ExamId,
ExamScoreId = item.Id,
});
}
}
......@@ -171,7 +183,7 @@ namespace EduSpider.Services
item.ResultType,
item.ResultTypeStr,
item.Title,
TimeTile=subTitle,
TimeTile = subTitle,
CreateTime = createTime,
DataObj = obj
});
......@@ -253,13 +265,54 @@ namespace EduSpider.Services
{
HomeWorkId = item.homework_id,
HomeWorkTitle = item.Homework_title,
Status= item.status,
Status = item.status,
StatusStr = str,
});
}
}
return result;
}
/// <summary>
/// 新增修改课程评价配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCourseComment(RB_Course_Comment_Extend model)
{
return CourseCommentRepository.SetCourseCommentRepository(model);
}
/// <summary>
/// 获取课程评价配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Comment_Extend> GetCourseCommentList(CourseQuery query)
{
var list = CourseCommentRepository.GetCourseCommentListRepository(query);
return list;
}
/// <summary>
/// 根据评价编号删除课程评价配置
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public bool DeleteCourseComment(string Ids)
{
return CourseCommentRepository.DeleteCourseCommentRepository(Ids);
}
/// <summary>
/// 根据编号删除课程评价详情配置
/// </summary>
/// <param name="DetailIds"></param>
/// <returns></returns>
public bool DeleteCourseCommentDetail(string DetailIds)
{
return CourseCommentDetailsRepository.DeleteCourseCommentDetailsRepository(DetailIds);
}
}
}
using EduSpider.IServices;
using EduSpider.Model.Extend;
using EduSpider.WebApi.Controllers.Base;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using VTX.FW.Api;
using VTX.FW.Attr;
......@@ -13,6 +15,8 @@ namespace EduSpider.WebApi.Controllers
/// </summary>
public class TeacherController : BaseController
{
/// <summary>
/// 课程仓储接口
/// </summary>
......@@ -30,7 +34,7 @@ namespace EduSpider.WebApi.Controllers
var query = new Model.Query.CourseQuery()
{
TeacherIds = base.BaseUserId.ToString(),
KeyWords=base.ReqParameters.GetString("KeyWords"),
KeyWords = base.ReqParameters.GetString("KeyWords"),
};
//全部课程
List<object> AllCourseList = new();
......@@ -39,7 +43,7 @@ namespace EduSpider.WebApi.Controllers
//进行中
List<object> NotFinishList = new();
var list = CourseService.GetTeacherCourseList(query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
......@@ -128,5 +132,96 @@ namespace EduSpider.WebApi.Controllers
var list = CourseService.GetHomeWorkDetails(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取课程评语列表
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpGet]
public ApiResult GetCourseCommentList()
{
var query = new Model.Query.CourseQuery()
{
CourseId = base.ReqParameters.GetInt("CourseId")
};
var list = CourseService.GetCourseCommentList(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增可以课程评语
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpGet]
public ApiResult SetCourseComment()
{
var model = new RB_Course_Comment_Extend()
{
Id = base.ReqParameters.GetInt("Id"),
CourseId = base.ReqParameters.GetInt("CourseId"),
Title = base.ReqParameters.GetString("Title"),
ShowType = base.ReqParameters.GetInt("ShowType"),
};
model.CreateBy = base.BaseUserId;
model.CreateTime = System.DateTime.Now;
model.Status = 0;
model.CommentDetails = new List<RB_Course_CommentDetails_Extend>();
string commentDetails = base.ReqParameters.GetString("CommentDetails");
if (!string.IsNullOrWhiteSpace(commentDetails))
{
JArray array = JArray.Parse(commentDetails);
if (array != null && array.Count > 0)
{
foreach (var jItem in array)
{
var sObj = JObject.Parse(jItem.ToString());
var details = new RB_Course_CommentDetails_Extend()
{
DetailId = sObj.GetInt("DetailId"),
CourseCommentId = sObj.GetInt("CourseCommentId"),
StartNum = sObj.GetDecimal("StartNum"),
EndNum = sObj.GetDecimal("EndNum"),
Info = sObj.GetString("Info"),
Status = 0,
CreateBy = base.BaseUserId,
CreateTime = System.DateTime.Now,
UpdateBy = base.BaseUserId,
UpdateTime = System.DateTime.Now,
};
model.CommentDetails.Add(details);
}
}
}
var flag = CourseService.SetCourseComment(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 删除课程评语
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpGet]
public ApiResult RemoveCourseComment()
{
string Ids = base.ReqParameters.GetString("Ids");
var flag = CourseService.DeleteCourseComment(Ids);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号删除课程评价详情配置
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpGet]
public ApiResult RemoveCourseCommentDetail()
{
string DetailIds = base.ReqParameters.GetString("DetailIds");
var flag = CourseService.DeleteCourseCommentDetail(DetailIds);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>G:\Publish\jinjieapi.oytour.com</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
\ No newline at end of file
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