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