切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
2cc9918b31633354470273eda3d654735ebe9518
1 个父辈
109c8cca
角色添加用户
角色查询用户列表 接口完成
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
10 行增加
和
5 行删除
pkg/application/role/role_user_service.go
pkg/infrastructure/pg/models/evaluation_rule.go
pkg/infrastructure/pg/models/role_user.go
pkg/infrastructure/repository/pg_role_user_repository.go
pkg/application/role/role_user_service.go
查看文件 @
2cc9918
...
...
@@ -28,6 +28,11 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{
}()
roleUserRepository
:=
factory
.
CreateRoleUserRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
//int64Array := make([]int64, 0)
//for i := range in.UserIds {
// int64Num, _ := strconv.ParseInt(in.UserIds[i], 10, 64)
// int64Array = append(int64Array, int64Num)
//}
// 检测已存在的关联用户
_
,
rus
,
err
:=
roleUserRepository
.
Find
(
map
[
string
]
interface
{}{
"roleId"
:
in
.
RoleId
,
"companyId"
:
in
.
CompanyId
,
"userIds"
:
in
.
UserIds
,
"limit"
:
9999999
})
if
err
!=
nil
{
...
...
pkg/infrastructure/pg/models/evaluation_rule.go
查看文件 @
2cc9918
...
...
@@ -17,5 +17,5 @@ type EvaluationRule struct {
Score
domain
.
Score
`comment:"评分"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"
pg:",soft_delete"
`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
}
...
...
pkg/infrastructure/pg/models/role_user.go
查看文件 @
2cc9918
...
...
@@ -10,5 +10,5 @@ type RoleUser struct {
CompanyId
int64
`comment:"公司ID"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"
pg:",soft_delete"
`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
}
...
...
pkg/infrastructure/repository/pg_role_user_repository.go
查看文件 @
2cc9918
...
...
@@ -125,7 +125,7 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64
}
if
userIds
,
ok
:=
queryOptions
[
"userIds"
];
ok
{
query
.
Where
(
"user_id in (?)"
,
userIds
)
query
.
Where
(
"user_id in (?)"
,
pg
.
In
(
userIds
)
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
...
...
@@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error {
return
err
}
func
(
repo
*
RoleUserRepository
)
FindAllContainUser
(
page
Size
int
,
pageNumber
int
,
companyId
int64
,
roleId
int64
)
([]
*
domain
.
RoleContainUser
,
error
)
{
func
(
repo
*
RoleUserRepository
)
FindAllContainUser
(
page
Number
int
,
pageSize
int
,
companyId
int64
,
roleId
int64
)
([]
*
domain
.
RoleContainUser
,
error
)
{
limit
:=
pageSize
offset
:=
limit
*
(
pageNumber
-
1
)
if
offset
<
0
{
...
...
@@ -192,7 +192,7 @@ func (repo *RoleUserRepository) FindAllContainUser(pageSize int, pageNumber int,
"role_user".role_id,
"role_user".user_id,
"user".name as user_name,
"user".email as user_email
,
"user".email as user_email
`
whereFrom
:=
`
FROM "role_user"
...
...
请
注册
或
登录
后发表评论