Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
6e6be1d3
Commit
6e6be1d3
authored
Apr 21, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增diy插件管理
parent
51d6ff89
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
174 additions
and
7 deletions
+174
-7
RB_Tenant_Plug.cs
Mall.Model/Entity/User/RB_Tenant_Plug.cs
+0
-2
PlugInModule.cs
Mall.Module.User/PlugInModule.cs
+73
-0
RB_PlugInRepository.cs
Mall.Repository/User/RB_PlugInRepository.cs
+42
-2
MContentController.cs
Mall.WebApi/Controllers/User/MContentController.cs
+55
-1
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+4
-2
No files found.
Mall.Model/Entity/User/RB_Tenant_Plug.cs
View file @
6e6be1d3
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.User
...
...
Mall.Module.User/PlugInModule.cs
View file @
6e6be1d3
...
...
@@ -3,6 +3,8 @@ using System.Collections.Generic;
using
System.Text
;
using
Mall.Model.Extend.User
;
using
Mall.Repository
;
using
System.Linq
;
using
VT.FW.DB
;
namespace
Mall.Module.User
{
...
...
@@ -25,5 +27,76 @@ namespace Mall.Module.User
{
return
plugInRepository
.
GetListRepository
(
query
);
}
/// <summary>
/// 根据查询条件获取插件分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_PlugIn_Extend
>
GetPlugInPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_PlugIn_Extend
query
)
{
return
plugInRepository
.
GetPlugInPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 新增修改插件
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetPlugInModule
(
RB_PlugIn_Extend
model
)
{
bool
flag
=
false
;
if
(
model
.
PlugId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_PlugIn_Extend
.
PlugType
),
model
.
PlugType
},
{
nameof
(
RB_PlugIn_Extend
.
Id
),
model
.
Id
},
{
nameof
(
RB_PlugIn_Extend
.
Name
),
model
.
Name
},
{
nameof
(
RB_PlugIn_Extend
.
Icon
),
model
.
Icon
},
};
flag
=
plugInRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_PlugIn_Extend
.
PlugId
),
model
.
PlugId
));
}
else
{
var
newId
=
plugInRepository
.
Insert
(
model
);
model
.
PlugId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据编号获取插件详情
/// </summary>
/// <param name="PlugId"></param>
/// <returns></returns>
public
RB_PlugIn_Extend
GetPlugInModule
(
int
PlugId
)
{
var
model
=
GetPlugInPageModule
(
1
,
1
,
out
long
rowsCount
,
new
RB_PlugIn_Extend
()
{
PlugId
=
PlugId
})?.
FirstOrDefault
();
return
model
;
}
/// <summary>
/// 修改插件状态
/// </summary>
/// <param name="PlugId">插件编号</param>
/// <param name="Status">插件状态(0-正常,1-删除)</param>
/// <returns></returns>
public
bool
SetPlugInStatusModule
(
int
PlugId
,
int
Status
)
{
bool
flag
=
false
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_PlugIn_Extend
.
Status
),
Status
},
};
flag
=
plugInRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_PlugIn_Extend
.
PlugId
),
PlugId
));
return
flag
;
}
}
}
Mall.Repository/User/RB_PlugInRepository.cs
View file @
6e6be1d3
...
...
@@ -4,6 +4,7 @@ using System.Text;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System.Linq
;
using
VT.FW.DB.Dapper
;
namespace
Mall.Repository.User
{
...
...
@@ -20,15 +21,54 @@ namespace Mall.Repository.User
public
List
<
RB_PlugIn_Extend
>
GetListRepository
(
RB_PlugIn_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
" SELECT * FROM RB_PlugIn WHERE 1=1 AND Status=0 "
);
builder
.
Append
(
@"
SELECT A.*
FROM RB_PlugIn AS A
WHERE 1=1 AND A.Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
@" AND
Id IN(SELECT PlugId FROM rb_tenant_plug WHERE TenantId={1
}) "
,
query
.
TenantId
);
builder
.
AppendFormat
(
@" AND
A.PlugId IN(SELECT PlugId FROM rb_tenant_plug WHERE TenantId={0
}) "
,
query
.
TenantId
);
}
}
return
Get
<
RB_PlugIn_Extend
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 根据查询条件获取插件分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_PlugIn_Extend
>
GetPlugInPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_PlugIn_Extend
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
" SELECT * FROM RB_PlugIn WHERE 1=1 "
);
if
(
query
!=
null
)
{
if
(
query
.
Status
>
-
1
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_PlugIn_Extend
.
Status
),
query
.
Status
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Name
))
{
builder
.
AppendFormat
(
@" AND {0} LIKE @Name "
,
nameof
(
RB_PlugIn_Extend
.
Name
),
query
.
Status
);
parameters
.
Add
(
"Name"
,
"%"
+
query
.
Name
.
Trim
()
+
"%"
);
}
if
(
query
.
PlugType
>
0
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_PlugIn_Extend
.
PlugType
),
query
.
PlugType
);
}
if
(
query
.
PlugId
>
0
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_PlugIn_Extend
.
PlugId
),
query
.
PlugId
);
}
}
return
GetPage
<
RB_PlugIn_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
Mall.WebApi/Controllers/User/MContentController.cs
View file @
6e6be1d3
...
...
@@ -722,12 +722,66 @@ namespace Mall.WebApi.Controllers.User
Name
=
PlugTypeName
,
PlugId
=
0
,
PlugType
=
item
.
Key
,
Icon
=
""
Icon
=
""
,
SubList
=
secondList
});
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// 获取插件分页列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetPlugInPage
()
{
ResultPageModel
pageModel
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_PlugIn_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
plugInModule
.
GetPlugInPageModule
(
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
SetPlugIn
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_PlugIn_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
Status
=
0
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
var
flag
=
plugInModule
.
SetPlugInModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取插件实体
/// </summary>
/// <returns></returns>
public
ApiResult
GetPlugIn
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
PlugId
=
parms
.
GetInt
(
"PlugId"
,
0
);
var
extModel
=
plugInModule
.
GetPlugInModule
(
PlugId
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 修改插件状态
/// </summary>
/// <returns></returns>
public
ApiResult
SetPlugInStatus
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
PlugId
=
parms
.
GetInt
(
"PlugId"
,
0
);
var
Status
=
parms
.
GetInt
(
"Status"
,
0
);
var
flag
=
plugInModule
.
SetPlugInStatusModule
(
PlugId
,
Status
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/TenantController.cs
View file @
6e6be1d3
...
...
@@ -1789,8 +1789,10 @@ namespace Mall.WebApi.Controllers.User
/// <returns></returns>
public
ApiResult
GetPlugInList
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_PlugIn_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
new
RB_PlugIn_Extend
()
{
TenantId
=
RequestParm
.
TenantId
};
var
list
=
plugInModule
.
GetPlugInListModule
(
extModel
);
var
distinctList
=
list
.
GroupBy
(
qitem
=>
new
{
qitem
.
PlugType
,
qitem
.
GroupName
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
PlugType
,
qitem
.
Key
.
GroupName
});
List
<
object
>
resultList
=
new
List
<
object
>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment