Commit 542d91eb authored by 黄奎's avatar 黄奎

新增实体类

parent 9fb081ff
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 商城插件表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Tenant_Plug
{
/// <summary>
/// 商城插件主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 插件编号
/// </summary>
public int PlugId { get; set; }
/// <summary>
/// 插件自定义名称
/// </summary>
public string PlugName { get; set; }
}
}
...@@ -29,5 +29,10 @@ namespace Mall.Model.Extend.User ...@@ -29,5 +29,10 @@ namespace Mall.Model.Extend.User
return str; return str;
} }
} }
/// <summary>
/// 商城编号
/// </summary>
public int TenantId { get; set; }
} }
} }
using Mall.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 商城插件表扩展实体类
/// </summary>
public class RB_Tenant_Plug_Extend: RB_Tenant_Plug
{
}
}
using Mall.AOP.CustomerAttribute;
using Mall.Model.Extend.User;
using Mall.Repository.User;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Module.User
{
/// <summary>
/// 商城插件处理类
/// </summary>
public class TenantPlugModule
{
/// <summary>
/// 商城插件表仓储层对象
/// </summary>
private readonly RB_Tenant_PlugRepository tenant_PlugRepository = new RB_Tenant_PlugRepository();
/// <summary>
/// 获取商城插件列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Tenant_Plug_Extend> GetTenantPlugListModule(RB_Tenant_Plug_Extend query)
{
return tenant_PlugRepository.GetTenantPlugListRepository(query);
}
/// <summary>
/// 新增修改商户插件
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
[TransactionCallHandler]
public bool SetTenantPlugModule(List<RB_Tenant_Plug_Extend> list)
{
bool flag = false;
if (list != null && list.Count > 0)
{
tenant_PlugRepository.DeleteOne(new WhereHelper(nameof(RB_Tenant_Menu_Extend.TenantId), list[0].TenantId));
foreach (var item in list)
{
flag = tenant_PlugRepository.Insert(item) > 0;
}
}
return flag;
}
}
}
...@@ -23,7 +23,10 @@ namespace Mall.Repository.User ...@@ -23,7 +23,10 @@ namespace Mall.Repository.User
builder.Append(" SELECT * FROM RB_PlugIn WHERE 1=1 AND Status=0 "); builder.Append(" SELECT * FROM RB_PlugIn WHERE 1=1 AND Status=0 ");
if (query != null) if (query != null)
{ {
if (query.TenantId > 0)
{
builder.AppendFormat(@" AND Id IN(SELECT PlugId FROM rb_tenant_plug WHERE TenantId={1}) ", query.TenantId);
}
} }
return Get<RB_PlugIn_Extend>(builder.ToString()).ToList(); return Get<RB_PlugIn_Extend>(builder.ToString()).ToList();
} }
......
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Mall.Repository.User
{
/// <summary>
/// 商城插件表仓储层
/// </summary>
public class RB_Tenant_PlugRepository : BaseRepository<RB_Tenant_Plug>
{
/// <summary>
/// 获取商城插件列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Tenant_Plug_Extend> GetTenantPlugListRepository(RB_Tenant_Plug_Extend query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_tenant_plug
WHERE 1=1
");
if (query == null)
{
return new List<RB_Tenant_Plug_Extend>();
}
else
{
if (query.TenantId > 0)
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_Tenant_Plug_Extend.TenantId), query.TenantId);
}
if (query.Id > 0)
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_Tenant_Plug_Extend.Id), query.Id);
}
if (!string.IsNullOrEmpty(query.PlugName))
{
builder.AppendFormat(@" AND {0} LIKE @PlugName ", nameof(RB_Tenant_Plug_Extend.PlugName));
parameters.Add("PlugName", "%" + query.PlugName.Trim() + "%");
}
}
return Get<RB_Tenant_Plug_Extend>(builder.ToString(), parameters).ToList();
}
}
}
...@@ -26,17 +26,27 @@ namespace Mall.WebApi.Controllers.User ...@@ -26,17 +26,27 @@ namespace Mall.WebApi.Controllers.User
/// <summary> /// <summary>
/// 内容管理 /// 内容管理
/// </summary> /// </summary>
private Module.User.ContentModule contentModule = new ContentModule(); private ContentModule contentModule = new ContentModule();
/// <summary> /// <summary>
/// 菜单处理类 /// 菜单处理类
/// </summary> /// </summary>
private Module.User.MenuModule menuModule = new Module.User.MenuModule(); private MenuModule menuModule = new MenuModule();
/// <summary> /// <summary>
/// 商户菜单处理类 /// 商户菜单处理类对象
/// </summary> /// </summary>
private Module.User.TenantMenuModule tenantMenuModule = AOPHelper.CreateAOPObject<TenantMenuModule>(); private TenantMenuModule tenantMenuModule = AOPHelper.CreateAOPObject<TenantMenuModule>();
/// <summary>
/// 商城插件处理类对象
/// </summary>
private readonly TenantPlugModule tenantPlugModule = AOPHelper.CreateAOPObject<TenantPlugModule>();
/// <summary>
/// 插件处理类对象
/// </summary>
private readonly PlugInModule plugInModule = new PlugInModule();
/// <summary> /// <summary>
/// 营销中心插件配置处理类 /// 营销中心插件配置处理类
...@@ -435,7 +445,7 @@ namespace Mall.WebApi.Controllers.User ...@@ -435,7 +445,7 @@ namespace Mall.WebApi.Controllers.User
#region 商城菜单 #region 商城菜单
/// <summary> /// <summary>
/// 获取小程序分页列表 /// 获取小程序菜单列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
...@@ -642,5 +652,82 @@ namespace Mall.WebApi.Controllers.User ...@@ -642,5 +652,82 @@ namespace Mall.WebApi.Controllers.User
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
#endregion #endregion
#region 商城插件
/// <summary>
/// 获取小程序插件列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetTenantPlug()
{
var list = JsonConvert.DeserializeObject<List<RB_Tenant_Plug_Extend>>(RequestParm.msg.ToString());
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
item.TenantId = RequestParm.TenantId;
}
}
var flag = tenantPlugModule.SetTenantPlugModule(list);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取商户插件列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTenantPlugList()
{
List<object> result = new List<object>();
var plugList = plugInModule.GetPlugInListModule(new RB_PlugIn_Extend());
if (plugList != null && plugList.Count > 0)
{
var tenantPlugList = tenantPlugModule.GetTenantPlugListModule( new RB_Tenant_Plug_Extend { TenantId = RequestParm.TenantId });
var plugTypeList = plugList.GroupBy(qitem => qitem.PlugType).Select(qitem => new { qitem.Key});
foreach (var item in plugTypeList)
{
List<object> secondList = new List<object>();
var subList = plugList.Where(qitem => qitem.PlugType == item.Key).ToList();
foreach (var subItem in subList)
{
secondList.Add(new
{
subItem.Id,
subItem.Name,
subItem.PlugId,
subItem.PlugType,
subItem.Icon,
IsChecked = tenantPlugList?.Where(qitem => qitem.PlugId == subItem.PlugId)?.Count() > 0,
});
}
string PlugTypeName = "";
if (item.Key == 1)
{
PlugTypeName = "基础组件";
}
else if (item.Key == 2)
{
PlugTypeName = "营销组件";
}
else if (item.Key == 3)
{
PlugTypeName = "其他组件";
}
result.Add(new
{
Id="",
Name= PlugTypeName,
PlugId=0,
PlugType=item.Key,
Icon=""
});
}
}
return ApiResult.Success(data: result);
}
#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