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
2a713684
Commit
2a713684
authored
Oct 22, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
a39cce4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletion
+74
-1
MiniprogramAdminModule.cs
Mall.Module.User/MiniprogramAdminModule.cs
+25
-1
RB_Miniprogram_AdminRepository.cs
Mall.Repository/User/RB_Miniprogram_AdminRepository.cs
+44
-0
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+5
-0
No files found.
Mall.Module.User/MiniprogramAdminModule.cs
View file @
2a713684
...
...
@@ -31,6 +31,23 @@ namespace Mall.Module.User
return
miniprogram_AdminRepository
.
GetMiniprogramAdminPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 检查用户是否存在
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
CheckExistsAdminModule
(
RB_Miniprogram_Admin_Extend
model
)
{
var
oldModel
=
miniprogram_AdminRepository
.
GetMiniprogramAdminEntityRepository
(
new
RB_Miniprogram_Admin_Extend
()
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
UserId
=
model
.
UserId
});
var
flag
=
oldModel
?.
AdminId
>
0
;
return
flag
;
}
/// <summary>
/// 新增修改小程序管理员
/// </summary>
...
...
@@ -38,7 +55,14 @@ namespace Mall.Module.User
/// <returns></returns>
public
bool
SetMiniprogramAdminModule
(
RB_Miniprogram_Admin_Extend
model
)
{
bool
flag
=
false
;
bool
flag
;
var
oldModel
=
miniprogram_AdminRepository
.
GetMiniprogramAdminEntityRepository
(
new
RB_Miniprogram_Admin_Extend
()
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
UserId
=
model
.
UserId
});
model
.
AdminId
=
oldModel
?.
AdminId
??
0
;
if
(
model
.
AdminId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
...
Mall.Repository/User/RB_Miniprogram_AdminRepository.cs
View file @
2a713684
...
...
@@ -52,7 +52,51 @@ WHERE 1=1
builder
.
AppendFormat
(
" AND B.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
Source
),
(
int
)
query
.
Source
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
AdminId
));
return
GetPage
<
RB_Miniprogram_Admin_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 获取管理员实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
RB_Miniprogram_Admin_Extend
GetMiniprogramAdminEntityRepository
(
RB_Miniprogram_Admin_Extend
query
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,B.Photo,B.Moblie,B.`Name`,B.OpenId,B.Source
FROM rb_miniprogram_admin AS A LEFT JOIN rb_member_user AS B ON A.UserId=B.Id
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Name
))
{
builder
.
AppendFormat
(
$@" and B.
{
nameof
(
RB_Miniprogram_Admin_Extend
.
Name
)}
like @Name "
);
parameters
.
Add
(
"Name"
,
"%"
+
query
.
Name
.
Trim
()
+
"%"
);
}
if
(
query
.
Source
>
0
)
{
builder
.
AppendFormat
(
" AND B.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
Source
),
(
int
)
query
.
Source
);
}
if
(
query
.
UserId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Miniprogram_Admin_Extend
.
UserId
),
query
.
UserId
);
}
}
return
Get
<
RB_Miniprogram_Admin_Extend
>(
builder
.
ToString
(),
parameters
)?.
FirstOrDefault
();
}
}
}
Mall.WebApi/Controllers/User/UserController.cs
View file @
2a713684
...
...
@@ -941,6 +941,11 @@ namespace Mall.WebApi.Controllers.User
{
return
ApiResult
.
ParamIsNull
(
message
:
"请选择小程序用户!"
);
}
if
(
adminModule
.
CheckExistsAdminModule
(
demodel
))
{
return
ApiResult
.
Failed
(
message
:
"已存在此用户!"
);
}
bool
flag
=
adminModule
.
SetMiniprogramAdminModule
(
demodel
);
if
(
flag
)
{
...
...
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