Commit 76e01cac authored by 黄奎's avatar 黄奎

新增实体类

parent 7d45527f
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 课程作业详情实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Course_JobDetails
{
/// <summary>
/// 作业详情编号
/// </summary>
public int DetailsId { get; set; }
/// <summary>
/// 作业编号
/// </summary>
public int JobId { get; set; }
/// <summary>
/// 问题编号
/// </summary>
public int QuestionId { get; set; }
/// <summary>
/// 作业分数
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 排序
/// </summary>
public int SortNum { get; set; }
}
}
......@@ -116,5 +116,10 @@ namespace Edu.Model.Entity.Course
/// 客户电话
/// </summary>
public string CustomerTel { get; set; }
/// <summary>
/// 客户人数
/// </summary>
public int JoinNum { get; set; }
}
}
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Question;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Question;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程作业详情视图实体类
/// </summary>
public class RB_Course_JobDetails_ViewModel : RB_Course_JobDetails
{
/// <summary>
/// 问题名称
/// </summary>
public string Title { get; set; }
/// <summary>
/// 问题内容
/// </summary>
public string QuestionContent { get; set; }
/// <summary>
/// 难易程度(1-易,2-中,3-难)
/// </summary>
public DifficultyTypeEnum DifficultyType { get; set; }
/// <summary>
/// 答案解析
/// </summary>
public string AnswerParse { get; set; }
/// <summary>
/// 问题类型编号
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// </summary>
public string QuestionTypeKey { get; set; }
/// <summary>
/// 知识点
/// </summary>
public string Knowledge { get; set; }
/// <summary>
/// 是否同步修改引用此题目的作业和考试(1-是)
/// </summary>
public int IsUpdateJobExam { get; set; }
/// <summary>
/// 问题答案【JSON字符串】
/// </summary>
public string Answer { get; set; }
/// <summary>
/// 填空题(答案顺序打乱也判正确)
/// </summary>
public int IsMutex { get; set; }
/// <summary>
/// 题目所属大类
/// </summary>
public QuestionCategoryEnum? Category { get; set; }
/// <summary>
/// 考级程度
/// </summary>
public LevelTypeEnum? LevelType { get; set; }
}
}
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Course
{
......@@ -17,5 +18,10 @@ namespace Edu.Model.ViewModel.Course
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
/// <summary>
/// 作业详情列表
/// </summary>
public List<RB_Course_JobDetails_ViewModel> JobDetailsList { get; set; }
}
}

namespace Edu.Model.ViewModel.Question
{
}
\ No newline at end of file
......@@ -89,7 +89,20 @@ namespace Edu.Module.Course
/// <returns></returns>
public List<RB_Course_ViewModel> GetCourseListModule(RB_Course_ViewModel query)
{
return courseRepository.GetCourseListRepository(query);
var list= courseRepository.GetCourseListRepository(query);
if (query.IsQPrice == 1 && list != null && list.Count > 0)
{
var ids = string.Join(",", list.Select(qitem => qitem.CourseId));
var preferentialList = course_PreferentialRepository.GetCoursePreferentialListRepostory(new RB_Course_Preferential_Extend()
{
QCourseIds = ids
});
foreach (var item in list)
{
item.PreferentialList = preferentialList?.Where(qitem => qitem.CourseId == item.CourseId)?.OrderBy(qitem => qitem.PriceDiscountType)?.ToList() ?? new List<RB_Course_Preferential_Extend>();
}
}
return list;
}
/// <summary>
......
......@@ -78,7 +78,6 @@ namespace Edu.Module.Course
public virtual bool SetCourseOfferModule(RB_Course_Offer_ViewModel model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -96,6 +95,7 @@ namespace Edu.Module.Course
{nameof(RB_Course_Offer_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Course_Offer_ViewModel.CustomerName),model.CustomerName },
{nameof(RB_Course_Offer_ViewModel.CustomerTel),model.CustomerTel },
{nameof(RB_Course_Offer_ViewModel.JoinNum),model.JoinNum },
};
flag = course_OfferRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Offer_ViewModel.Id), model.Id));
}
......
......@@ -27,7 +27,6 @@ FROM RB_Course AS A LEFT JOIN rb_course_category AS B ON A.CateId=B.CateId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
//builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null)
{
......
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程作业仓储层
/// </summary>
public class RB_Course_JobDetailsRepository : BaseRepository<RB_Course_JobDetails>
{
/// <summary>
/// 获取课程作业题目列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_JobDetails_ViewModel> GetCourseJobDetailsListRepository(RB_Course_JobDetails_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.Title,B.QuestionContent,B.DifficultyType,B.AnswerParse,B.QuestionTypeId,B.QuestionTypeKey,B.Knowledge,B.IsUpdateJobExam
,B.Answer,B.IsMutex,B.Category,B.LevelType
FROM RB_Course_JobDetails AS A INNER JOIN rb_question AS B ON A.QuestionId=B.QuestionId
WHERE 1=1
");
if (query == null)
{
return new List<RB_Course_JobDetails_ViewModel>();
}
else
{
if (query.JobId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_JobDetails_ViewModel.JobId), query.JobId);
}
}
return Get<RB_Course_JobDetails_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -200,11 +200,42 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost]
public ApiResult GetCourseList()
{
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Course_ViewModel>(RequestParm.Msg.ToString());
var query = new RB_Course_ViewModel()
{
IsQPrice= base.ParmJObj.GetInt("IsQPrice", 0),
};
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var list = courseModule.GetCourseListModule(query);
return ApiResult.Success(data: list);
return ApiResult.Success(data: list.Select(qitem => new
{
qitem.CourseId,
qitem.CourseName,
qitem.CateId,
qitem.CateName,
qitem.CoverImg,
qitem.TeacherIdList,
qitem.OriginalPrice,
qitem.SellPrice,
qitem.SalePlatList,
qitem.SalePlatArr,
qitem.ClassHours,
PreferentialList = qitem?.PreferentialList?.Select(sItem => new
{
sItem.Id,
sItem.PriceDiscountType,
sItem.PriceDiscountTypeStr,
sItem.CourseId,
sItem.SaleCommissionType,
sItem.SaleCommissionMoney,
sItem.B2BCommissionType,
sItem.B2BCommissionMoney,
sItem.BuyNum,
sItem.SendNum,
sItem.PriceType,
sItem.PriceMoney
})
}));
}
......
......@@ -92,6 +92,7 @@ namespace Edu.WebApi.Controllers.Course
qitem.OfferDetails,
qitem.CustomerName,
qitem.CustomerTel,
qitem.JoinNum,
});
return ApiResult.Success(data: pageModel);
}
......@@ -133,7 +134,8 @@ namespace Edu.WebApi.Controllers.Course
TotalDiscountPrice = base.ParmJObj.GetDecimal("TotalDiscountPrice"),
CustomerInfo = base.ParmJObj.GetStringValue("CustomerInfo"),
CustomerName=base.ParmJObj.GetStringValue("CustomerName"),
CustomerTel=base.ParmJObj.GetStringValue("CustomerTel")
CustomerTel=base.ParmJObj.GetStringValue("CustomerTel"),
JoinNum=base.ParmJObj.GetInt("JoinNum")
};
try
{
......@@ -180,7 +182,8 @@ namespace Edu.WebApi.Controllers.Course
extModel?.CreateBy,
extModel?.CustomerTel,
extModel?.CustomerName,
CreateByName= extModel.CreateBy>0 ? UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.AccountName ?? "":"",
extModel?.JoinNum,
CreateByName = extModel.CreateBy>0 ? UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.AccountName ?? "":"",
extModel?.SerialNum,
OfferDetails = extModel?.OfferDetails ?? new List<RB_Course_OfferDetails_ViewModel>()
};
......
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