切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
ea05439444811e7940db56b21934f1d3a8531ff8
1 个父辈
a5f1f535
1. 修复 权限管理人员 分页BUG
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
14 行增加
和
8 行删除
pkg/application/role/command/role_query_user.go
pkg/application/role/role_service.go
pkg/application/role/role_user_service.go
pkg/domain/role_user.go
pkg/infrastructure/repository/pg_role_user_repository.go
pkg/application/role/command/role_query_user.go
查看文件 @
ea05439
...
...
@@ -5,8 +5,8 @@ import "github.com/beego/beego/v2/core/validation"
// QueryRoleUserCommand 查询角色列表(关联用户)
type
QueryRoleUserCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
PageNumber
int64
`cname:"分页页码" json:"pageNumber" valid:"Required"`
PageSize
int64
`cname:"分页数量" json:"pageSize" valid:"Required"`
PageNumber
int64
`cname:"分页页码" json:"pageNumber"`
PageSize
int64
`cname:"分页数量" json:"pageSize"`
}
func
(
in
*
QueryRoleUserCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
...
...
pkg/application/role/role_service.go
查看文件 @
ea05439
...
...
@@ -190,7 +190,7 @@ func (rs *RoleService) ListForUser(in *command.QueryRoleUserCommand) (interface{
for
i
:=
range
roles
{
v
:=
roles
[
i
]
tempList
,
err
:=
ruRepository
.
FindAllContainUser
(
1
,
10
,
in
.
CompanyId
,
v
.
Id
)
_
,
tempList
,
err
:=
ruRepository
.
FindAllContainUser
(
1
,
10
,
in
.
CompanyId
,
v
.
Id
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/application/role/role_user_service.go
查看文件 @
ea05439
...
...
@@ -104,12 +104,12 @@ func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface
}()
ruRepository
:=
factory
.
CreateRoleUserRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
tempList
,
err
:=
ruRepository
.
FindAllContainUser
(
in
.
PageNumber
,
in
.
PageSize
,
in
.
CompanyId
,
in
.
RoleId
)
t
otal
,
t
empList
,
err
:=
ruRepository
.
FindAllContainUser
(
in
.
PageNumber
,
in
.
PageSize
,
in
.
CompanyId
,
in
.
RoleId
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
tool_funs
.
SimpleWrapGridMap
(
int64
(
len
(
tempList
))
,
tempList
),
nil
return
tool_funs
.
SimpleWrapGridMap
(
total
,
tempList
),
nil
}
...
...
pkg/domain/role_user.go
查看文件 @
ea05439
...
...
@@ -28,5 +28,5 @@ type RoleUserRepository interface {
Find
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
[]
*
RoleUser
,
error
)
Count
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
error
)
BatchDeleteById
(
ids
[]
int64
)
error
FindAllContainUser
(
pageSize
int
,
pageNumber
int
,
companyId
int64
,
roleId
int64
)
([]
*
RoleContainUser
,
error
)
FindAllContainUser
(
pageSize
int
,
pageNumber
int
,
companyId
int64
,
roleId
int64
)
(
int64
,
[]
*
RoleContainUser
,
error
)
}
...
...
pkg/infrastructure/repository/pg_role_user_repository.go
查看文件 @
ea05439
...
...
@@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error {
return
err
}
func
(
repo
*
RoleUserRepository
)
FindAllContainUser
(
pageNumber
int
,
pageSize
int
,
companyId
int64
,
roleId
int64
)
([]
*
domain
.
RoleContainUser
,
error
)
{
func
(
repo
*
RoleUserRepository
)
FindAllContainUser
(
pageNumber
int
,
pageSize
int
,
companyId
int64
,
roleId
int64
)
(
int64
,
[]
*
domain
.
RoleContainUser
,
error
)
{
limit
:=
pageSize
offset
:=
limit
*
(
pageNumber
-
1
)
if
offset
<
0
{
...
...
@@ -210,9 +210,15 @@ func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int,
}
dataSql
+=
whereFrom
dataSql
=
fmt
.
Sprintf
(
"%s limit %d offset %d"
,
dataSql
,
limit
,
offset
)
countSql
:=
` SELECT COUNT(*) `
+
whereFrom
tx
:=
repo
.
transactionContext
.
PgTx
var
total
int64
var
dataList
=
make
([]
*
domain
.
RoleContainUser
,
0
)
_
,
err
:=
tx
.
Query
(
&
dataList
,
dataSql
,
param
...
)
return
dataList
,
err
// 获取总数量
_
,
_
=
tx
.
QueryOne
(
pg
.
Scan
(
&
total
),
countSql
,
param
...
)
return
total
,
dataList
,
err
}
...
...
请
注册
或
登录
后发表评论