切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
陈志颖
4 years ago
提交
9d12308665708432c75529a87507aa72181d6851
1 个父辈
5bdac8e6
test:测试删除用户
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
54 行增加
和
22 行删除
pkg/application/columnSetting/service/column_setting.go
pkg/application/unifiedUserCenter/service/employee.go
pkg/domain/column_setting.go
pkg/infrastructure/repository/pg_column_setting_repository.go
pkg/application/columnSetting/service/column_setting.go
查看文件 @
9d12308
...
...
@@ -142,7 +142,10 @@ func (columnSettingService *ColumnSettingService) ListColumnSetting(listColumnSe
}
else
{
columnSettingRepository
=
value
}
if
count
,
columnSettings
,
err
:=
columnSettingRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
listColumnSettingQuery
));
err
!=
nil
{
if
count
,
columnSettings
,
err
:=
columnSettingRepository
.
Find
(
domain
.
ColumnSettingFindQuery
{
Offset
:
listColumnSettingQuery
.
Offset
,
Limit
:
listColumnSettingQuery
.
Limit
,
});
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
else
{
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
...
...
pkg/application/unifiedUserCenter/service/employee.go
查看文件 @
9d12308
...
...
@@ -361,7 +361,10 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error
}
else
{
columnSettingRepository
=
value
}
_
,
columnSettingsFound
,
err
:=
columnSettingRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
data
.
Ids
,
"companyId"
:
data
.
CompanyId
})
_
,
columnSettingsFound
,
err
:=
columnSettingRepository
.
Find
(
domain
.
ColumnSettingFindQuery
{
Ids
:
data
.
Ids
,
CompanyId
:
int
(
data
.
CompanyId
),
})
if
err
!=
nil
{
return
lib
.
ThrowError
(
lib
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/domain/column_setting.go
查看文件 @
9d12308
...
...
@@ -92,11 +92,20 @@ type ColumnSetting struct {
InvalidValue
[]
Column
`json:"invalidValue"`
}
type
ColumnSettingFindQuery
struct
{
Ids
[]
int64
Uid
int64
CompanyId
int
Offset
int
Limit
int
}
type
ColumnSettingRepository
interface
{
Save
(
columnSetting
*
ColumnSetting
)
(
*
ColumnSetting
,
error
)
Remove
(
columnSetting
*
ColumnSetting
,
columnSettings
[]
*
ColumnSetting
)
(
*
ColumnSetting
,
[]
*
ColumnSetting
,
error
)
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
ColumnSetting
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
[]
*
ColumnSetting
,
error
)
//Find(queryOptions map[string]interface{}) (int64, []*ColumnSetting, error)
Find
(
ColumnSettingFindQuery
)
(
int64
,
[]
*
ColumnSetting
,
error
)
}
func
(
columnSetting
*
ColumnSetting
)
Identify
()
interface
{}
{
...
...
pkg/infrastructure/repository/pg_column_setting_repository.go
查看文件 @
9d12308
...
...
@@ -118,36 +118,53 @@ func (repository *ColumnSettingRepository) FindOne(queryOptions map[string]inter
}
}
func
(
repository
*
ColumnSettingRepository
)
Find
(
queryOptions
map
[
string
]
interface
{}
)
(
int64
,
[]
*
domain
.
ColumnSetting
,
error
)
{
func
(
repository
*
ColumnSettingRepository
)
Find
(
queryOptions
domain
.
ColumnSettingFindQuery
)
(
int64
,
[]
*
domain
.
ColumnSetting
,
error
)
{
tx
:=
repository
.
transactionContext
.
PgTx
var
columnSettingModels
[]
*
models
.
ColumnSetting
columnSettings
:=
make
([]
*
domain
.
ColumnSetting
,
0
)
query
:=
tx
.
Model
(
&
columnSettingModels
)
if
ids
,
ok
:=
queryOptions
[
"ids"
];
ok
&&
len
(
ids
.
([]
int64
))
!=
0
{
query
=
query
.
Where
(
"column_setting.uid in(?)"
,
ids
)
if
len
(
queryOptions
.
Ids
)
>
0
{
query
=
query
.
Where
(
"column_setting.uid in(?)"
,
queryOptions
.
Ids
)
}
if
uid
,
ok
:=
queryOptions
[
"uid"
];
ok
{
query
=
query
.
Where
(
"column_setting.uid = ?"
,
uid
)
if
queryOptions
.
Uid
>
0
{
query
=
query
.
Where
(
"column_setting.uid = ?"
,
queryOptions
.
Uid
)
}
if
companyId
,
ok
:=
queryOptions
[
"companyId"
];
ok
{
query
=
query
.
Where
(
"column_setting.company_id = ?"
,
companyId
)
if
queryOptions
.
CompanyId
>
0
{
query
=
query
.
Where
(
"column_setting.company_id = ?"
,
queryOptions
.
CompanyId
)
}
if
offset
,
ok
:=
queryOptions
[
"offset"
];
ok
{
queryOffset
:=
offset
.
(
int
)
if
queryOffset
>
-
1
{
query
=
query
.
Offset
(
queryOffset
)
}
}
else
{
query
=
query
.
Offset
(
0
)
if
queryOptions
.
Offset
>
-
1
{
query
=
query
.
Offset
(
queryOptions
.
Offset
)
}
if
limit
,
ok
:=
queryOptions
[
"limit"
];
ok
{
queryLimit
:=
limit
.
(
int
)
if
queryLimit
>
-
1
{
query
=
query
.
Limit
(
queryLimit
)
}
if
queryOptions
.
Limit
>
0
{
query
=
query
.
Limit
(
queryOptions
.
Limit
)
}
else
{
query
=
query
.
Limit
(
20
)
}
//if ids, ok := queryOptions["ids"]; ok && len(ids.([]int64)) != 0 {
// query = query.Where("column_setting.uid in(?)", ids)
//}
//if uid, ok := queryOptions["uid"]; ok {
// query = query.Where("column_setting.uid = ?", uid)
//}
//if companyId, ok := queryOptions["companyId"]; ok {
// query = query.Where("column_setting.company_id = ?", companyId)
//}
//if offset, ok := queryOptions["offset"]; ok {
// queryOffset := offset.(int)
// if queryOffset > -1 {
// query = query.Offset(queryOffset)
// }
//} else {
// query = query.Offset(0)
//}
//if limit, ok := queryOptions["limit"]; ok {
// queryLimit := limit.(int)
// if queryLimit > -1 {
// query = query.Limit(queryLimit)
// }
//} else {
// query = query.Limit(20)
//}
if
count
,
err
:=
query
.
Order
(
"id DESC"
)
.
SelectAndCount
();
err
!=
nil
{
return
0
,
columnSettings
,
err
}
else
{
...
...
请
注册
或
登录
后发表评论