作者 yangfu

角色名称匹配修改

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