Commit 829b68cc authored by 黄奎's avatar 黄奎

新增页面

parent 02ff4072
using Mall.Common.AOP;
using Mall.Common.Enum.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 模板市场实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Template_Market
{
/// <summary>
/// 主键编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 图片
/// </summary>
public string Pics
{
get;
set;
}
/// <summary>
/// 价格
/// </summary>
public decimal? Price
{
get;
set;
}
/// <summary>
/// 是否使用(0-禁用,1-使用)
/// </summary>
public int? IsUse
{
get;
set;
}
/// <summary>
/// 是否显示(0-不显示,1-显示)
/// </summary>
public int? IsShow
{
get;
set;
}
/// <summary>
/// 模板数据
/// </summary>
public string TemplateData
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? SortNum
{
get;
set;
}
/// <summary>
/// 创建人
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 状态
/// </summary>
public int? Status
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 模板市场扩展实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Template_Market_Extend : Model.Entity.MarketingCenter.RB_Template_Market
{
}
}
\ No newline at end of file
using Mall.Model.Entity.MarketingCenter;
using Mall.Repository;
using Mall.Repository.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Module.MarketingCenter
{
/// <summary>
/// 模板市场处理类
/// </summary>
public class TemplateMarketModule
{
/// <summary>
/// 模板市场仓储层对象
/// </summary>
private readonly RB_Template_MarketRepository template_MarketRepository = new RB_Template_MarketRepository();
/// <summary>
/// 模板市场分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Template_Market_Extend> GetTemplateMarketPageListModule(int pageIndex, int pageSize, out long rowCount, RB_Template_Market_Extend query)
{
return template_MarketRepository.GetTemplateMarketPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 模板市场列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Template_Market_Extend> GetTemplateMarketListModule(RB_Template_Market_Extend query)
{
return template_MarketRepository.GetTemplateMarketListRepository(query);
}
/// <summary>
/// 添加修改模板市场
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTemplateMarketModule(RB_Template_Market_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.Name),extModel.Name.Trim() },
{nameof(RB_Template_Market_Extend.Pics),extModel.Pics },
{nameof(RB_Template_Market_Extend.Price),extModel.Price },
{nameof(RB_Template_Market_Extend.IsUse),extModel.IsUse },
{nameof(RB_Template_Market_Extend.IsShow),extModel.IsShow },
{nameof(RB_Template_Market_Extend.TemplateData),extModel.TemplateData },
{nameof(RB_Template_Market_Extend.SortNum),extModel.SortNum },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), extModel.Id));
}
else
{
var newId = template_MarketRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取模板市场实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Template_Market_Extend GetTemplateMarketModule(object Id)
{
return template_MarketRepository.GetEntity<RB_Template_Market_Extend>(Id);
}
/// <summary>
/// 删除模板市场
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveTemplateMarketModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.Status),1 },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
/// <summary>
/// 更新模板市场是否显示
/// </summary>
/// <param name="Id">编号</param>
/// <param name="IsShow">是否显示(0-不显示,1-显示)</param>
/// <returns></returns>
public bool UpdateTemplateMarketIsShowModule(object Id,int IsShow)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.IsShow),IsShow },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
/// <summary>
/// 更新模板市场是否使用
/// </summary>
/// <param name="Id">编号</param>
/// <param name="IsUse">是否使用(0-禁用,1-使用)</param>
/// <returns></returns>
public bool UpdateTemplateMarketIsUseModule(object Id, int IsUse)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.IsUse),IsUse },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
}
}
......@@ -68,7 +68,7 @@ namespace Mall.Repository.MarketingCenter
}
if (query.QIds != null && !string.IsNullOrEmpty(query.QIds.Trim()))
{
builder.AppendFormat(" AND {0} IN({1}) ",nameof(RB_Miniprogram_Template_Extend.Id), query.QIds);
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Miniprogram_Template_Extend.Id), query.QIds);
}
}
return Get<RB_Miniprogram_Template_Extend>(builder.ToString()).ToList();
......
using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Extend.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.MarketingCenter
{
/// <summary>
/// 模板市场仓储类
/// </summary>
public class RB_Template_MarketRepository: RepositoryBase<RB_Template_Market>
{
/// <summary>
/// 模板市场分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Template_Market_Extend> GetTemplateMarketPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Template_Market_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM RB_Template_Market WHERE Status=0 ");
if (query != null)
{
if (query.Name != null && !string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Template_Market_Extend.Name)} like '%{query.Name.Trim()}%'");
}
}
return GetPage<RB_Template_Market_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 模板市场列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Template_Market_Extend> GetTemplateMarketListRepository(RB_Template_Market_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM RB_Template_Market WHERE Status=0 ");
if (query != null)
{
if (query.Name != null && !string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Template_Market_Extend.Name)} like '%{query.Name.Trim()}%'");
}
}
return Get<RB_Template_Market_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -31,6 +31,11 @@ namespace Mall.WebApi.Controllers.MarketingCenter
/// </summary>
private readonly MiniprogramPageTemplModule miniprogramPageTemplModule = new MiniprogramPageTemplModule();
/// <summary>
/// 模板市场处理类
/// </summary>
private readonly TemplateMarketModule templateMarketModule = new TemplateMarketModule();
#region 模板管理
/// <summary>
/// 新增修改小程序模板
......@@ -230,5 +235,103 @@ namespace Mall.WebApi.Controllers.MarketingCenter
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 模板市场
/// <summary>
/// 模板市场分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTemplateMarketPageListModule()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Template_Market_Extend>(parms.msg.ToString());
var list = templateMarketModule.GetTemplateMarketPageListModule(pagelist.pageIndex, pagelist.pageSize, out long count, query);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 模板市场列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTemplateMarketList()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Template_Market_Extend>(parms.msg.ToString());
var list = templateMarketModule.GetTemplateMarketListModule(query);
return ApiResult.Success("", list);
}
/// <summary>
/// 根据编号获取模板市场实体
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTemplateMarket()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = templateMarketModule.GetTemplateMarketModule(Id);
return ApiResult.Success("", extModel);
}
/// <summary>
/// 添加修改模板市场
/// </summary>
/// <returns></returns>
public ApiResult SetTemplateMarket()
{
var extModel = JsonConvert.DeserializeObject<RB_Template_Market_Extend>(RequestParm.msg.ToString());
Int32.TryParse(RequestParm.uid, out int Uid);
extModel.CreateBy = Uid;
extModel.CreateDate = DateTime.Now;
extModel.Status = 0;
var flag = templateMarketModule.SetTemplateMarketModule(extModel);
return flag ? ApiResult.Success(data: extModel.Id) : ApiResult.Failed();
}
/// <summary>
/// 删除模板市场
/// </summary>
/// <returns></returns>
public ApiResult RemoveTemplateMarketModule()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = templateMarketModule.RemoveTemplateMarketModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 更新模板市场是否显示
/// </summary>
/// <returns></returns>
public ApiResult UpdateTemplateMarketIsShow()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var IsShow = parms.GetInt("IsShow", 0);
var flag = templateMarketModule.UpdateTemplateMarketIsShowModule(Id, IsShow);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 更新模板市场是否显示
/// </summary>
/// <returns></returns>
public ApiResult UpdateTemplateMarketIsUse()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var IsUse = parms.GetInt("IsUse", 0);
var flag = templateMarketModule.UpdateTemplateMarketIsUseModule(Id, IsUse);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
\ No newline at end of file
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