Commit 9f18c3ca authored by 黄奎's avatar 黄奎

页面修改

parent abf73c7e
using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using EduSpider.Model.Query;
using System.Collections.Generic;
using VTX.FW.Config;
using VTX.FW.DB;
namespace EduSpider.IRepository
{
/// <summary>
/// 学生评论详情仓储接口
/// </summary>
public interface IStuCommentDetailsRepository : IDBRepository<RB_Stu_CommentDetails>, IDependency
{
/// <summary>
/// 批量新增修改学员评论详情
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool BatchSetStuCommentDetails(List<RB_Stu_CommentDetails> list);
/// <summary>
/// 获取学员评价详情
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_CommentDetails_Extend> GetStuCommentDetailsListRepository(RB_Stu_CommentDetails_Extend query);
/// <summary>
/// 修改学生评价
/// </summary>
/// <param name="Ids"></param>
/// <param name="Info"></param>
/// <returns></returns>
public bool SetStuCommentDetailsInfoRepository(string Ids, string Info);
/// <summary>
/// 修改学员评论状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public bool SetStuCommentDetailsShowTypeRepository(int ShowType, string Ids);
/// <summary>
/// 根据课程评论次数修改可见等级
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimesRepository(int CourseId, int Times, int ShowType);
/// <summary>
/// 根据编号删除学员评论
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public bool DeleteStuCommentRepository(string Ids);
}
}
......@@ -17,7 +17,7 @@ namespace EduSpider.IRepository
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStuCommentRepository(RB_Stu_Comment_Extend model);
public bool SetStuCommentRepository(RB_Stu_Comment_Extend model, bool IsAdd = false);
/// <summary>
/// 批量新增学员评价
......
using System;
using VTX.FW.Attr;
namespace EduSpider.Model.Entity
{
/// <summary>
/// 学员评价详情表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Stu_CommentDetails
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 学员评价主表编号
/// </summary>
public int CommentMainId { get; set; }
/// <summary>
/// 开始作业编号
/// </summary>
public int StartHomeWorkId { get; set; }
/// <summary>
/// 家庭作业编号
/// </summary>
public int HomeWorkId { get; set; }
/// <summary>
/// 学员登录编号
/// </summary>
public int StuUid { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 评语次数
/// </summary>
public int Times { get; set; }
/// <summary>
/// 评语
/// </summary>
public string Info { get; set; }
/// <summary>
/// 创建类型(1-系统创建,2-老师创建)
/// </summary>
public int CreateType { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建人姓名
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 显示类型(1-全部可见,2-部分可见,3-不可见)
/// </summary>
public int ShowType { get; set; }
/// <summary>
/// 删除状态(0-正常,1-删除)
/// </summary>
public int Status { get; set; }
/// <summary>
/// 多个作业编号
/// </summary>
public string HomeWorkIds { get; set; }
}
}
using EduSpider.Model.Entity;
namespace EduSpider.Model.Extend
{
/// <summary>
/// 学员评价详情扩展实体类
/// </summary>
public class RB_Stu_CommentDetails_Extend : RB_Stu_CommentDetails
{
/// <summary>
/// 学员评价主表编号
/// </summary>
public string QCommentMainIds { get; set; }
/// <summary>
/// 学生名称
/// </summary>
public string StuName { get; set; }
}
}
......@@ -46,14 +46,9 @@
public int HomeWorkId { get; set; }
/// <summary>
/// 开始作业编号
/// </summary>
public int StartHomeWorkId { get; set; }
/// <summary>
/// 结束作业编号
/// 作业编号
/// </summary>
public int EndHomeWorkId { get; set; }
public string QHomeWorkIds { get; set; }
/// <summary>
/// 创建类型(1-系统创建,2-老师创建)
......
using EduSpider.IRepository;
using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using EduSpider.Model.Query;
using EduSpider.Repository.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VTX.FW.DB.Dapper;
namespace EduSpider.Repository
{
/// <summary>
/// 学员评论详情仓储接口
/// </summary>
public class StuCommentDetailsRepository : BaseRepository<RB_Stu_CommentDetails>, IStuCommentDetailsRepository
{
/// <summary>
/// 批量新增修改学员评论详情
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool BatchSetStuCommentDetails(List<RB_Stu_CommentDetails> list)
{
bool flag = false;
foreach (var item in list)
{
var defaultModel = GetStuCommentDetailsListRepository(new RB_Stu_CommentDetails_Extend()
{
CourseId = item.CourseId,
Times = item.Times,
StuUid = item.StuUid,
HomeWorkId = item.HomeWorkId,
}).FirstOrDefault();
string createTimeStr = "";
if (defaultModel != null)
{
createTimeStr = VTX.FW.Helper.ConvertHelper.FormatTime(defaultModel.CreateTime.AddSeconds(1));
}
else
{
var homeWorkModel = new StuHomeWorkRepository().GetStuHomeWorkDetailsListRepository(new CourseQuery()
{
CourseId = item.CourseId,
HomeWorkId = item.HomeWorkId,
StuIds = item.StuUid.ToString()
}).FirstOrDefault();
if (homeWorkModel != null)
{
createTimeStr = VTX.FW.Helper.ConvertHelper.FormatTime(homeWorkModel.add_time.AddSeconds(1));
}
}
if (!string.IsNullOrEmpty(createTimeStr))
{
item.CreateTime = Convert.ToDateTime(createTimeStr);
}
else
{
item.CreateTime = DateTime.Now;
}
// flag = base.Insert(item) > 0;
}
flag = base.BatchInsert(list);
return flag;
}
/// <summary>
/// 获取学员评价详情
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_CommentDetails_Extend> GetStuCommentDetailsListRepository(RB_Stu_CommentDetails_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,s.StudentName as StuName
FROM RB_Stu_CommentDetails AS A LEFT JOIN rb_student s on A.StuUid = s.StudentUid
WHERE 1=1
");
if (query != null)
{
if (!string.IsNullOrWhiteSpace(query.QCommentMainIds))
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Stu_CommentDetails_Extend.CommentMainId), query.QCommentMainIds);
}
if (query.CommentMainId > 0)
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Stu_CommentDetails_Extend.CommentMainId), query.CommentMainId);
}
if (query.CourseId > 0)
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Stu_CommentDetails_Extend.CourseId), query.CourseId);
}
if (query.Times > 0)
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Stu_CommentDetails_Extend.Times), query.Times);
}
if (query.StuUid > 0)
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Stu_CommentDetails_Extend.StuUid), query.StuUid);
}
if (query.HomeWorkId > 0)
{
builder.AppendFormat(@" AND A.{0} ={1} ", nameof(RB_Stu_CommentDetails_Extend.HomeWorkId), query.HomeWorkId);
}
}
return Get<RB_Stu_CommentDetails_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 修改学生评价
/// </summary>
/// <param name="Ids"></param>
/// <param name="Info"></param>
/// <returns></returns>
public bool SetStuCommentDetailsInfoRepository(string Ids,string Info)
{
string sql = string.Format("UPDATE RB_Stu_CommentDetails SET Info=@Info WHERE Id IN({0}) ", Ids);
DynamicParameters parameters = new DynamicParameters();
parameters.Add("Info", Info);
return base.Execute(sql,parameters) > 0;
}
/// <summary>
/// 根据课程编号和次数修改评价可见状态
/// </summary>
/// <param name="CourseId"></param>
/// <param name="Times"></param>
/// <param name="ShowType"></param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimesRepository(int CourseId, int Times, int ShowType)
{
string sql = string.Format("UPDATE RB_Stu_CommentDetails SET ShowType={0} WHERE CourseId={1} AND Times={2}", ShowType, CourseId, Times);
return base.Execute(sql) > 0;
}
/// <summary>
/// 修改学员评论可见状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public bool SetStuCommentDetailsShowTypeRepository(int ShowType, string Ids)
{
string sql = string.Format("UPDATE RB_Stu_CommentDetails SET ShowType={0} WHERE Id IN({1}) ", ShowType, Ids);
return base.Execute(sql) > 0;
}
/// <summary>
/// 根据编号删除评论
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public bool DeleteStuCommentRepository(string Ids)
{
string sql = string.Format("UPDATE RB_Stu_CommentDetails SET Status=1 WHERE Id IN({0}) ", Ids);
return base.Execute(sql) > 0;
}
}
}
......@@ -22,11 +22,14 @@ namespace EduSpider.Repository
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStuCommentRepository(RB_Stu_Comment_Extend model)
public bool SetStuCommentRepository(RB_Stu_Comment_Extend model,bool IsAdd=false)
{
bool flag = false;
if (!IsAdd)
{
var oldModel = GetCourseCommentTimesListRepository(new CourseQuery() { CourseId = model.CourseId, CreateCommentType = model.CreateType, CommentTimes = model.Times }).FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
}
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -126,8 +129,7 @@ WHERE 1=1
var homeworkList = new StuHomeWorkRepository().GetStuHomeWorkDetailsListRepository(new CourseQuery()
{
CourseId = model.CourseId,
StartHomeWorkId = model.Details[0].StartHomeWorkId,
EndHomeWorkId = model.Details[0].HomeWorkId
QHomeWorkIds= model.Details[0].HomeWorkIds,
});
var courseComment = new RB_Course_Comment_Extend();
var defaultComment = new RB_Comment_Extend();
......@@ -171,7 +173,7 @@ WHERE 1=1
}
}
flag = SetStuCommentRepository(model);
flag = SetStuCommentRepository(model,IsAdd:true);
return flag;
}
}
......
......@@ -61,13 +61,9 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Stu_HomeWork_Extend.homework_id), query.HomeWorkId);
}
if (query.StartHomeWorkId > 0)
if (!string.IsNullOrEmpty(query.QHomeWorkIds))
{
builder.AppendFormat(" AND A.{0}>={1} ", nameof(RB_Stu_HomeWork_Extend.homework_id), query.StartHomeWorkId);
}
if (query.EndHomeWorkId > 0)
{
builder.AppendFormat(" AND A.{0}<={1} ", nameof(RB_Stu_HomeWork_Extend.homework_id), query.EndHomeWorkId);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Stu_HomeWork_Extend.homework_id), query.QHomeWorkIds);
}
}
var dataList = Get<RB_Stu_HomeWork_Extend>(builder.ToString()).ToList();
......
......@@ -206,7 +206,7 @@ namespace EduSpider.WebApi.Controllers
CourseId = base.ReqParameters.GetInt("CourseId"),
CourseName = base.ReqParameters.GetString("CourseName"),
};
var courseRuleList = CourseService.GetCourseCommentList(query);
var courseRuleList = CourseService.GetCourseCommentList(query).OrderBy(qitem=>qitem.Times).ToList();
List<object> result = new List<object>();
if (courseRuleList != null && courseRuleList.Count > 0)
{
......@@ -230,7 +230,7 @@ namespace EduSpider.WebApi.Controllers
}
else
{
var sysCommentList = CourseService.GetSysComment(new CourseQuery() { KeyWords = query.CourseName, CommentTimes = query.CommentTimes });
var sysCommentList = CourseService.GetSysComment(new CourseQuery() { KeyWords = query.CourseName, CommentTimes = query.CommentTimes }).OrderBy(qitem=>qitem.Times).ToList();
if (sysCommentList != null && sysCommentList.Count > 0)
{
foreach (var item in sysCommentList)
......
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