|
|
@ -26,17 +26,12 @@ func NewGetRoleListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRo
|
|
|
|
|
|
|
|
|
|
|
|
func (l *GetRoleListLogic) GetRoleList(in *core.RoleReq) (*core.RoleListResp, error) {
|
|
|
|
func (l *GetRoleListLogic) GetRoleList(in *core.RoleReq) (*core.RoleListResp, error) {
|
|
|
|
var predicates []predicate.Role
|
|
|
|
var predicates []predicate.Role
|
|
|
|
if in.ID != 0 {
|
|
|
|
|
|
|
|
predicates = append(predicates, role.IDEQ(in.ID))
|
|
|
|
|
|
|
|
goto Query
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if in.Name != "" {
|
|
|
|
if in.Name != "" {
|
|
|
|
predicates = append(predicates, role.NameContains(in.Name))
|
|
|
|
predicates = append(predicates, role.NameContains(in.Name))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if in.Code != "" {
|
|
|
|
if in.Code != "" {
|
|
|
|
predicates = append(predicates, role.CodeEQ(in.Code))
|
|
|
|
predicates = append(predicates, role.CodeContains(in.Code))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Query:
|
|
|
|
|
|
|
|
query := l.svcCtx.DB.Role.Query().
|
|
|
|
query := l.svcCtx.DB.Role.Query().
|
|
|
|
Where(predicates...)
|
|
|
|
Where(predicates...)
|
|
|
|
if in.WithUser {
|
|
|
|
if in.WithUser {
|
|
|
|