作者 yangfu

角色名称匹配修改

... ... @@ -27,6 +27,8 @@ type ListRoleQuery struct {
OrgId int64 `cname:"组织ID" json:"orgId,omitempty"`
// 匹配多个组织
InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"`
// 角色名称
MatchRoleName string `cname:"匹配角色名称" json:"matchRoleName,omitempty"`
}
func (listRoleQuery *ListRoleQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -185,6 +185,9 @@ func (repository *RoleRepository) Find(queryOptions map[string]interface{}) (int
if orgName, ok := queryOptions["orgName"]; ok && len(orgName.(string)) > 0 {
query.Where(fmt.Sprintf("ext->>'orgName' like '%%%v%%'", orgName))
}
if matchRoleName, ok := queryOptions["matchRoleName"]; ok && len(matchRoleName.(string)) > 0 {
query.Where(fmt.Sprintf("role_name like '%%%v%%'", matchRoleName))
}
// 包含删除的
if v, ok := queryOptions["includeDeleted"]; ok && !(v.(bool)) {
query.Where("deleted_at is null")
... ...