Commit 89c5b620 authored by 黄奎's avatar 黄奎

新增实体类

parent a6fc3c42
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 文章表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Article
{
/// <summary>
/// 文章编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 文章标题
/// </summary>
public string Title
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? SortNum
{
get;
set;
}
/// <summary>
/// 禁用状态(0-禁用,1-启用)
/// </summary>
public int? IsDisable
{
get;
set;
}
/// <summary>
/// 文章内容
/// </summary>
public string Content
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 门店表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Stores
{
/// <summary>
/// 门店编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 门店名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 门店电话
/// </summary>
public string Tel
{
get;
set;
}
/// <summary>
/// 门店地址
/// </summary>
public string Address
{
get;
set;
}
/// <summary>
/// 门店经度纬度
/// </summary>
public string LngLat
{
get;
set;
}
/// <summary>
/// 门店评分
/// </summary>
public int? Score
{
get;
set;
}
/// <summary>
/// 门店介绍
/// </summary>
public string Intro
{
get;
set;
}
/// <summary>
/// 门店封面图
/// </summary>
public string CoverImg
{
get;
set;
}
/// <summary>
/// 门店轮播图
/// </summary>
public string NavImg
{
get;
set;
}
/// <summary>
/// 营业开始时间
/// </summary>
public string StartTime
{
get;
set;
}
/// <summary>
/// 营业结束时间
/// </summary>
public string EndTime
{
get;
set;
}
/// <summary>
/// 是否全天营业(1-是)
/// </summary>
public int? IsAllDay
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题分类表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic_Type
{
/// <summary>
/// 专题分类编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 专题分类名称
/// </summary>
public string TopicName
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? SortNum
{
get;
set;
}
/// <summary>
/// 禁用状态(0-禁用,1-启用)
/// </summary>
public int? IsDisable
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 视频表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Video
{
/// <summary>
/// 视频编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 视频标题
/// </summary>
public string Title
{
get;
set;
}
/// <summary>
/// 视频来源(1-源地址,2-腾讯)
/// </summary>
public int? SourceType
{
get;
set;
}
/// <summary>
/// 视频链接
/// </summary>
public string VedioUrl
{
get;
set;
}
/// <summary>
/// 视频封面图
/// </summary>
public string VedioCoverImg
{
get;
set;
}
/// <summary>
/// 视频详情介绍
/// </summary>
public string VedioIntro
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 文章表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Article_Extend : Model.Entity.User.RB_Article
{
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 门店表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Stores_Extend : Model.Entity.User.RB_Stores
{
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题分类表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic_Type_Extend : Model.Entity.User.RB_Topic_Type
{
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 视频表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Video_Extend : Model.Entity.User.RB_Video
{
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.User;
namespace Mall.Module.User
{
/// <summary>
/// 内容处理类
/// </summary>
public class ContentModule
{
/// <summary>
/// 专题分类表仓储层对象
/// </summary>
private RB_Topic_TypeRepository topic_TypeRepository = new RB_Topic_TypeRepository();
/// <summary>
/// 门店表仓储层对象
/// </summary>
private RB_StoresRepository storesRepository = new RB_StoresRepository();
/// <summary>
/// 视频表仓储层对象
/// </summary>
private RB_VideoRepository videoRepository = new RB_VideoRepository();
/// <summary>
/// 文章表仓储层对象
/// </summary>
private RB_ArticleRepository articleRepository = new RB_ArticleRepository();
#region 专题分类
/// <summary>
/// 专题分类分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Type_Extend> GetTopicTypePageListModule(int pageIndex, int pageSize, out long rowCount, RB_Topic_Type_Extend query)
{
return topic_TypeRepository.GetTopicTypePageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 获取专题分类列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Type_Extend> GetTopicTypeListModule(RB_Topic_Type_Extend query)
{
return topic_TypeRepository.GetTopicTypeListRepository(query);
}
/// <summary>
/// 新增修改专题分类
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTopicTypeModule(RB_Topic_Type_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Type_Extend.TopicName),extModel.TopicName.Trim()},
{ nameof(RB_Topic_Type_Extend.SortNum),extModel.SortNum},
{ nameof(RB_Topic_Type_Extend.IsDisable),extModel.IsDisable},
};
flag = topic_TypeRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Type_Extend.Id), extModel.Id));
}
else
{
var newId = topic_TypeRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取专题分类实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Topic_Type_Extend GetTopicTypeModule(object Id)
{
return topic_TypeRepository.GetEntity<RB_Topic_Type_Extend>(Id);
}
/// <summary>
/// 删除专题分类
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveTopicTypeModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Type_Extend.Status),1},
};
flag = topic_TypeRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Type_Extend.Id), Id));
return flag;
}
#endregion
#region 门店
/// <summary>
/// 门店分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Stores_Extend> GetStoresPageListModule(int pageIndex, int pageSize, out long rowCount, RB_Stores_Extend query)
{
return storesRepository.GetStoresPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 门店分类列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stores_Extend> GetStoresListModule(RB_Stores_Extend query)
{
return storesRepository.GetStoresListRepository(query);
}
/// <summary>
/// 新增修改门店
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetStoresModule(RB_Stores_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Stores_Extend.Name),extModel.Name.Trim()},
{ nameof(RB_Stores_Extend.Tel),extModel.Tel},
{ nameof(RB_Stores_Extend.Address),extModel.Address},
{ nameof(RB_Stores_Extend.LngLat),extModel.LngLat},
{ nameof(RB_Stores_Extend.Score),extModel.Score},
{ nameof(RB_Stores_Extend.Intro),extModel.Intro},
{ nameof(RB_Stores_Extend.CoverImg),extModel.CoverImg},
{ nameof(RB_Stores_Extend.NavImg),extModel.NavImg},
{ nameof(RB_Stores_Extend.StartTime),extModel.StartTime},
{ nameof(RB_Stores_Extend.EndTime),extModel.EndTime},
{ nameof(RB_Stores_Extend.IsAllDay),extModel.IsAllDay},
};
flag = storesRepository.Update(fileds, new WhereHelper(nameof(RB_Stores_Extend.Id), extModel.Id));
}
else
{
var newId = storesRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取门店实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Stores_Extend GetStoresModule(object Id)
{
return storesRepository.GetEntity<RB_Stores_Extend>(Id);
}
/// <summary>
/// 删除门店
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveStoresModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Stores_Extend.Status),1},
};
flag = storesRepository.Update(fileds, new WhereHelper(nameof(RB_Stores_Extend.Id), Id));
return flag;
}
#endregion
#region 视频
/// <summary>
/// 视频分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Video_Extend> GetVideoPageListModule(int pageIndex, int pageSize, out long rowCount, RB_Video_Extend query)
{
return videoRepository.GetVideoPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 获取视频列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Video_Extend> GetVideoListModule(RB_Video_Extend query)
{
return videoRepository.GetVideoListRepository(query);
}
/// <summary>
/// 新增修改视频
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetVideoModule(RB_Video_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Video_Extend.Title),extModel.Title.Trim()},
{ nameof(RB_Video_Extend.SourceType),extModel.SourceType},
{ nameof(RB_Video_Extend.VedioUrl),extModel.VedioUrl},
{ nameof(RB_Video_Extend.VedioCoverImg),extModel.VedioCoverImg},
{ nameof(RB_Video_Extend.VedioIntro),extModel.VedioIntro},
};
flag = videoRepository.Update(fileds, new WhereHelper(nameof(RB_Video_Extend.Id), extModel.Id));
}
else
{
var newId = videoRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取视频实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Video_Extend GetVideoModule(object Id)
{
return videoRepository.GetEntity<RB_Video_Extend>(Id);
}
/// <summary>
/// 删除视频
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveVideoModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Video_Extend.Status),1},
};
flag = videoRepository.Update(fileds, new WhereHelper(nameof(RB_Video_Extend.Id), Id));
return flag;
}
#endregion
#region 文章
/// <summary>
/// 文章分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Article_Extend> GetArticlePageListModule(int pageIndex, int pageSize, out long rowCount, RB_Article_Extend query)
{
return articleRepository.GetArticlePageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 获取文章列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Article_Extend> GetArticleListModule(RB_Article_Extend query)
{
return articleRepository.GetArticleListRepository(query);
}
/// <summary>
/// 新增修改文章
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetArticleModule(RB_Article_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Article_Extend.Title),extModel.Title.Trim()},
{ nameof(RB_Article_Extend.SortNum),extModel.SortNum},
{ nameof(RB_Article_Extend.IsDisable),extModel.IsDisable},
{ nameof(RB_Article_Extend.Content),extModel.Content},
};
flag = articleRepository.Update(fileds, new WhereHelper(nameof(RB_Video_Extend.Id), extModel.Id));
}
else
{
var newId = articleRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取文章实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Article_Extend GetArticleModule(object Id)
{
return articleRepository.GetEntity<RB_Article_Extend>(Id);
}
/// <summary>
/// 删除文章
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveArticleModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Article_Extend.Status),1},
};
flag = articleRepository.Update(fileds, new WhereHelper(nameof(RB_Article_Extend.Id), Id));
return flag;
}
/// <summary>
/// 更新文章状态
/// </summary>
/// <param name="Id"></param>
/// <param name="IsDisable"></param>
/// <returns></returns>
public bool UpdateArticleIsDisableModule(object Id,int IsDisable)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Article_Extend.IsDisable),IsDisable},
};
flag = articleRepository.Update(fileds, new WhereHelper(nameof(RB_Article_Extend.Id), Id));
return flag;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 文章表仓储层
/// </summary>
public class RB_ArticleRepository : RepositoryBase<RB_Article>
{
/// <summary>
/// 文章分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Article_Extend> GetArticlePageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Article_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Article WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.Id), query.Id);
}
builder.Append(" ORDER BY SortNum ");
return GetPage<RB_Article_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取文章列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Article_Extend> GetArticleListRepository(RB_Article_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Article WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Article_Extend.Id), query.Id);
}
builder.Append(" ORDER BY SortNum ");
return Get<RB_Article_Extend>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 门店表仓储层
/// </summary>
public class RB_StoresRepository : RepositoryBase<RB_Stores>
{
/// <summary>
/// 门店分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Stores_Extend> GetStoresPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Stores_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Stores WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.Id), query.Id);
}
builder.Append(" ORDER BY Id DESC ");
return GetPage<RB_Stores_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 门店分类列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stores_Extend> GetStoresListRepository(RB_Stores_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Stores WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Stores_Extend.Id), query.Id);
}
builder.Append(" ORDER BY Id DESC ");
return Get<RB_Stores_Extend>(builder.ToString()).ToList();
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 专题分类表仓储层
/// </summary>
public class RB_Topic_TypeRepository : RepositoryBase<RB_Topic_Type>
{
/// <summary>
/// 专题分类分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Type_Extend> GetTopicTypePageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Topic_Type_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Topic_Type WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.Id), query.Id);
}
builder.Append(" ORDER BY SortNum ");
return GetPage<RB_Topic_Type_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取专题分类列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Type_Extend> GetTopicTypeListRepository(RB_Topic_Type_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Topic_Type WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Type_Extend.Id), query.Id);
}
builder.Append(" ORDER BY SortNum ");
return Get<RB_Topic_Type_Extend>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 视频表仓储层
/// </summary>
public class RB_VideoRepository : RepositoryBase<RB_Video>
{
/// <summary>
/// 视频分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Video_Extend> GetVideoPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Video_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Video WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.Id), query.Id);
}
builder.Append(" ORDER BY Id DESC ");
return GetPage<RB_Video_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取视频列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Video_Extend> GetVideoListRepository(RB_Video_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Video WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Video_Extend.Id), query.Id);
}
builder.Append(" ORDER BY Id DESC ");
return Get<RB_Video_Extend>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.User;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Microsoft.AspNetCore.Authorization;
using Mall.Model.Entity.User;
namespace Mall.WebApi.Controllers.User
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class MContentController : BaseController
{
/// <summary>
/// 内容管理
/// </summary>
private Module.User.ContentModule contentModule = new ContentModule();
#region 专题分类
/// <summary>
/// 专题分类分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicTypePageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Topic_Type_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicTypePageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取专题分类列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicTypeList()
{
var query = JsonConvert.DeserializeObject<RB_Topic_Type_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicTypeListModule( query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改专题分类
/// </summary>
/// <returns></returns>
public ApiResult SetTopicType()
{
var extModel = JsonConvert.DeserializeObject<RB_Topic_Type_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
var flag = contentModule.SetTopicTypeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取专题分类实体
/// </summary>
/// <returns></returns>
public ApiResult GetTopicType()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetTopicTypeModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除专题分类
/// </summary>
/// <returns></returns>
public ApiResult RemoveTopicTypeModule()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveTopicTypeModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 门店
/// <summary>
/// 门店分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetStoresPageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Stores_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetStoresPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 门店分类列表
/// </summary>
/// <returns></returns>
public ApiResult GetStoresList()
{
var query = JsonConvert.DeserializeObject<RB_Stores_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetStoresListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改门店
/// </summary>
/// <returns></returns>
public ApiResult SetStores()
{
var extModel = JsonConvert.DeserializeObject<RB_Stores_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
var flag = contentModule.SetStoresModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取门店实体
/// </summary>
/// <returns></returns>
public ApiResult GetStores()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetStoresModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除门店
/// </summary>
/// <returns></returns>
public ApiResult RemoveStores()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveStoresModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 视频
/// <summary>
/// 视频分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetVideoPageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Video_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetVideoPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取视频列表
/// </summary>
/// <returns></returns>
public ApiResult GetVideoListModule()
{
var query = JsonConvert.DeserializeObject<RB_Video_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetVideoListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改视频
/// </summary>
/// <returns></returns>
public ApiResult SetVideo()
{
var extModel = JsonConvert.DeserializeObject<RB_Video_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
var flag = contentModule.SetVideoModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取视频实体
/// </summary>
/// <returns></returns>
public ApiResult GetVideo()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetVideoModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除视频
/// </summary>
/// <returns></returns>
public ApiResult RemoveVideo()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveVideoModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 文章
/// <summary>
/// 文章分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetArticlePageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Article_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetArticlePageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取文章列表
/// </summary>
/// <returns></returns>
public ApiResult GetArticleList()
{
var query = JsonConvert.DeserializeObject<RB_Article_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetArticleListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改文章
/// </summary>
/// <returns></returns>
public ApiResult SetArticle()
{
var extModel = JsonConvert.DeserializeObject<RB_Article_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
var flag = contentModule.SetArticleModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取文章实体
/// </summary>
/// <returns></returns>
public ApiResult GetArticle()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetArticleModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除文章
/// </summary>
/// <returns></returns>
public ApiResult RemoveArticle()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveArticleModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 更新状态
/// </summary>
/// <returns></returns>
public ApiResult UpdateArticleStatus()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var IsDisable = parms.GetInt("IsDisable");
var flag = contentModule.UpdateArticleIsDisableModule(Id, IsDisable);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
\ No newline at end of file
......@@ -4,10 +4,6 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Remove="web.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JWT" Version="5.3.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
......
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