Commit 2e5d4d2b authored by 黄奎's avatar 黄奎

新增实体类

parent dbe0eb0f
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
......
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
......
using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程分类树形结构实体类
/// </summary>
[Serializable]
public class CourseCategoryTree_ViewModel
{
/// <summary>
......
using System;
using VT.FW.DB;
namespace Edu.Model.ViewModel.Course
{
......@@ -7,7 +6,6 @@ namespace Edu.Model.ViewModel.Course
/// 课程分类视图实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Course_Category_ViewModel : Model.Entity.Course.RB_Course_Category
{
/// <summary>
......
using System;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程章节视图实体类
/// </summary>
[Serializable]
public class RB_Course_Chapter_ViewModel : Model.Entity.Course.RB_Course_Chapter
{
/// <summary>
/// 课程编号【逗号分隔】
/// </summary>
public string CourseIds { get; set; }
}
}
using System;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程通知接收视图实体类
/// </summary>
[Serializable]
public class RB_Course_NoticeRevice_ViewModel:Model.Entity.Course.RB_Course_NoticeRevice
{
/// <summary>
/// 通知编号【逗号分隔】
/// </summary>
public string NoticeIds { get; set; }
}
}
using System;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程通知视图实体类
/// </summary>
[Serializable]
public class RB_Course_Notice_ViewModel : Model.Entity.Course.RB_Course_Notice
{
/// <summary>
/// 课程编号【逗号分隔】
/// </summary>
public string CourseIds { get; set; }
}
}
\ No newline at end of file
using System;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程视图实体类
/// </summary>
[Serializable]
public class RB_Course_ViewModel : Model.Entity.Course.RB_Course
{
}
}
\ No newline at end of file
using Edu.Common.Enum;
using Edu.Model.ViewModel.Course;
using Edu.Repository.Course;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Course
{
/// <summary>
/// 课程处理类
/// </summary>
public class CourseModule
{
/// <summary>
/// 课程章节仓储层对象
/// </summary>
private readonly RB_Course_ChapterRepository chapterRepository = new RB_Course_ChapterRepository();
/// <summary>
/// 课程通知仓储层对象
/// </summary>
private readonly RB_Course_NoticeRepository noticeRepository = new RB_Course_NoticeRepository();
/// <summary>
/// 课程通知接收仓储层对象
/// </summary>
private readonly RB_Course_NoticeReviceRepository noticeReviceRepository = new RB_Course_NoticeReviceRepository();
/// <summary>
/// 课程处理仓储层对象
/// </summary>
private readonly RB_CourseRepository courseRepository = new RB_CourseRepository();
/// <summary>
/// 获取课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_ViewModel> GetCourseListModule(RB_Course_ViewModel query)
{
return courseRepository.GetCourseListRepository(query);
}
/// <summary>
/// 获取课程分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_ViewModel> GetCoursePageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Course_ViewModel query)
{
return courseRepository.GetCoursePageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 根据课程编号获取课程实体
/// </summary>
/// <param name="CourseId"></param>
/// <returns></returns>
public RB_Course_ViewModel GetCourseModule(object CourseId)
{
return courseRepository.GetEntity<RB_Course_ViewModel>(CourseId);
}
/// <summary>
/// 新增修改课程
/// </summary>
/// <returns></returns>
public bool SetCourseModule(RB_Course_ViewModel model)
{
bool flag;
if (model.CourseId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.CoverImg),model.CoverImg },
{nameof(RB_Course_ViewModel.CourseName),model.CourseName },
{nameof(RB_Course_ViewModel.CourseIntro),model.CourseIntro },
{nameof(RB_Course_ViewModel.CateId),model.CateId },
};
flag = courseRepository.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), model.CourseId));
}
else
{
var newId = courseRepository.Insert(model);
model.CourseId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 删除课程
/// </summary>
/// <param name="CourseId"></param>
/// <returns></returns>
public bool RemoveCourseModule(object CourseId)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.Status),(int)DateStateEnum.Delete },
};
bool flag = courseRepository.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), CourseId));
return flag;
}
}
}
using Edu.Model.ViewModel.Course;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程仓储层
/// </summary>
public class RB_CourseRepository : BaseRepository<Model.Entity.Course.RB_Course>
{
/// <summary>
/// 获取课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_ViewModel> GetCourseListRepository(RB_Course_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Course
WHERE 1=1
");
if (query != null)
{
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND {0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (query.CateId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
}
}
return Get<RB_Course_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取课程分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_ViewModel> GetCoursePageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Course_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Course
WHERE 1=1
");
if (query != null)
{
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND {0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (query.CateId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
}
}
return GetPage<RB_Course_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程章节仓储层
/// </summary>
public class RB_Course_ChapterRepository : BaseRepository<Model.Entity.Course.RB_Course_Chapter>
{
/// <summary>
/// 获取课程章节列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Chapter_ViewModel> GetChapterListRepository(RB_Course_Chapter_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_course_chapter
WHERE 1=1
");
if (query != null)
{
if (query.CourseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Chapter_ViewModel.CourseId), query.CourseId);
}
if (!string.IsNullOrWhiteSpace(query.CourseIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Course_Chapter_ViewModel.CourseId), query.CourseIds);
}
}
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程通知仓储层
/// </summary>
public class RB_Course_NoticeRepository : BaseRepository<Model.Entity.Course.RB_Course_Notice>
{
/// <summary>
/// 获取课程通知分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Notice_ViewModel> GetNoticePageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Course_Notice_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_course_notice
WHERE 1=1
");
if (query != null)
{
if (query.CourseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Notice_ViewModel.CourseId), query.CourseId);
}
if (!string.IsNullOrWhiteSpace(query.CourseIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Course_Notice_ViewModel.CourseId), query.CourseIds);
}
}
return GetPage<RB_Course_Notice_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
using Edu.Model.ViewModel.Course;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程通知接收仓储层
/// </summary>
public class RB_Course_NoticeReviceRepository : BaseRepository<Model.Entity.Course.RB_Course_NoticeRevice>
{
/// <summary>
/// 获取课程通知接收列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_NoticeRevice_ViewModel> GetNoticeReviceListRepository(RB_Course_NoticeRevice_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Course_NoticeRevice
WHERE 1=1
");
if (query != null)
{
if (query.NoticeId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_NoticeRevice_ViewModel.NoticeId), query.NoticeId);
}
if (!string.IsNullOrWhiteSpace(query.NoticeIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Course_NoticeRevice_ViewModel.NoticeId), query.NoticeIds);
}
}
return Get<RB_Course_NoticeRevice_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
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