Commit ae437b7b authored by 黄奎's avatar 黄奎

新增字段

parent aa5d2a0b
......@@ -359,5 +359,10 @@ namespace Mall.Model.Entity.BaseSetUp
/// 是否开启全局分类包邮规则
/// </summary>
public int IsFreeShipping { get; set; }
/// <summary>
/// 是否显示价格(0-不显示,1-显示)
/// </summary>
public int IsShowPrice { get; set; }
}
}
using Mall.Common.Enum;
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 韩国馆新闻实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Commerce_News
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImg { get; set; }
/// <summary>
/// 新闻标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 行业
/// </summary>
public string Industry { get; set; }
/// <summary>
/// 发布时间
/// </summary>
public DateTime PublishTime { get; set; }
/// <summary>
/// 新闻详情
/// </summary>
public string NewsInfo { get; set; }
/// <summary>
/// 商户号id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateDate { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
}
}
using Mall.Model.Entity.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 韩国馆新闻扩展实体类
/// </summary>
public class RB_Commerce_News_Extend : RB_Commerce_News
{
}
}
using Mall.Model.Extend.TradePavilion;
using Mall.Repository.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Module.TradePavilion
{
/// <summary>
/// 韩国馆新闻处理类
/// </summary>
public class CommerceNewsModule
{
/// <summary>
/// 韩国馆新闻仓储层对象
/// </summary>
private readonly RB_Commerce_NewsRepository commerce_NewsRepository = new RB_Commerce_NewsRepository();
/// <summary>
/// 获取新闻分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Commerce_News_Extend> GetCommerceNewsPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Commerce_News_Extend query)
{
return commerce_NewsRepository.GetCommerceNewsPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 新增修改新闻
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCommerceNewsModule(RB_Commerce_News_Extend model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Commerce_News_Extend.CoverImg),model.CoverImg},
{ nameof(RB_Commerce_News_Extend.Title),model.Title},
{ nameof(RB_Commerce_News_Extend.Industry),model.Industry},
{ nameof(RB_Commerce_News_Extend.PublishTime),model.PublishTime},
{ nameof(RB_Commerce_News_Extend.NewsInfo),model.NewsInfo},
{ nameof(RB_Commerce_News_Extend.UpdateBy),model.UpdateBy},
{ nameof(RB_Commerce_News_Extend.UpdateDate),model.UpdateDate},
};
flag = commerce_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Commerce_News_Extend.Id),model.Id));
}
else
{
var newId = commerce_NewsRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取新闻信息实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Commerce_News_Extend GetCommerceNewsModule(int Id)
{
return commerce_NewsRepository.GetEntity<RB_Commerce_News_Extend>(Id);
}
/// <summary>
/// 更新新闻信息状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveCommerceNewsModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Commerce_News_Extend.Status),Status },
};
bool flag = commerce_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Commerce_News_Extend.Id), Id));
return flag;
}
}
}
using Mall.Common.Enum;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Mall.Repository.TradePavilion
{
/// <summary>
/// 韩国馆新闻仓储层
/// </summary>
public class RB_Commerce_NewsRepository : BaseRepository<RB_Commerce_News>
{
/// <summary>
/// 获取新闻分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Commerce_News_Extend> GetCommerceNewsPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Commerce_News_Extend query)
{
rowsCount = 0;
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_commerce_news AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Commerce_News_Extend.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Commerce_News_Extend>();
}
else
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Commerce_News_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Commerce_News_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.Title))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Commerce_News_Extend.Title));
parameters.Add("Name", "%" + query.Title.Trim() + "%");
}
}
return GetPage<RB_Commerce_Activity_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
......@@ -2517,6 +2517,7 @@ namespace Mall.WebApi.Controllers
is_show_cart = mallBaseModel?.ListShopCar,
is_show_sales_num = mallBaseModel?.ListBuyCount,
is_show_goods_name = mallBaseModel?.ListName,
is_show_goods_price= mallBaseModel?.IsShowPrice??0,//是否显示商品价格【hk2020-02-21新增】
is_underline_price = mallBaseModel?.DetailsLineationPrice,
is_express = mallBaseModel?.DeatilsExpress,
is_not_share_show = mallBaseModel?.OtherNoShare,
......
......@@ -46,6 +46,11 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </summary>
private readonly CommerceConsultModule consultModule = new CommerceConsultModule();
/// <summary>
/// 韩国馆新闻处理类
/// </summary>
private readonly CommerceNewsModule commerceNewsModule = new CommerceNewsModule();
#region 联系人管理
/// <summary>
......@@ -557,5 +562,82 @@ namespace Mall.WebApi.Controllers.TradePavilion
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 新闻信息管理
/// <summary>
/// 获取新闻信息分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetCommerceNewsPage()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_Commerce_News_Extend()
{
Title = parms.GetStringValue("Title")
};
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = commerceNewsModule.GetCommerceNewsPageListModule(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 GetCommerceNews()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = commerceNewsModule.GetCommerceNewsModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除新闻信息
/// </summary>
/// <returns></returns>
public ApiResult RemoveCommerceNews()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var Status = parms.GetInt("Status", 0);
var flag = commerceNewsModule.RemoveCommerceNewsModule(Id, Status);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 新增修改新闻
/// </summary>
/// <returns></returns>
public ApiResult SetCommerceNews()
{
JObject jObj = JObject.Parse(RequestParm.msg.ToString());
var extModel = new RB_Commerce_News_Extend()
{
Id = jObj.GetInt("Id"),
CoverImg=jObj.GetStringValue("CoverImg"),
Title= jObj.GetStringValue("Title"),
Industry = jObj.GetStringValue("Industry"),
PublishTime = jObj.GetDateTime("PublishTime"),
NewsInfo = jObj.GetStringValue("NewsInfo"),
};
extModel.Status = Common.Enum.DateStateEnum.Normal;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
Int32.TryParse(RequestParm.uid, out int Uid);
extModel.CreateBy = Uid;
extModel.CreateDate = DateTime.Now;
extModel.UpdateBy = Uid;
extModel.UpdateDate = DateTime.Now;
var flag = commerceNewsModule.SetCommerceNewsModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
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