|
@@ -2,6 +2,7 @@ package sop_stage
|
|
|
|
|
|
import (
|
|
import (
|
|
"context"
|
|
"context"
|
|
|
|
+ "fmt"
|
|
|
|
|
|
"wechat-api/ent/predicate"
|
|
"wechat-api/ent/predicate"
|
|
"wechat-api/ent/sopstage"
|
|
"wechat-api/ent/sopstage"
|
|
@@ -31,10 +32,12 @@ func NewGetSopStageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
|
|
|
|
|
|
func (l *GetSopStageListLogic) GetSopStageList(req *types.SopStageListReq) (*types.SopStageListResp, error) {
|
|
func (l *GetSopStageListLogic) GetSopStageList(req *types.SopStageListReq) (*types.SopStageListResp, error) {
|
|
var predicates []predicate.SopStage
|
|
var predicates []predicate.SopStage
|
|
- if req.Name != nil {
|
|
|
|
- predicates = append(predicates, sopstage.NameContains(*req.Name))
|
|
|
|
|
|
+ if req.TaskId != nil {
|
|
|
|
+ predicates = append(predicates, sopstage.TaskID(*req.TaskId))
|
|
|
|
+ } else {
|
|
|
|
+ return nil, dberrorhandler.DefaultEntError(l.Logger, fmt.Errorf("TaskID 不能为空"), req)
|
|
}
|
|
}
|
|
- data, err := l.svcCtx.DB.SopStage.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
|
|
|
|
|
|
+ data, err := l.svcCtx.DB.SopStage.Query().Where(predicates...).All(l.ctx)
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
@@ -42,9 +45,8 @@ func (l *GetSopStageListLogic) GetSopStageList(req *types.SopStageListReq) (*typ
|
|
|
|
|
|
resp := &types.SopStageListResp{}
|
|
resp := &types.SopStageListResp{}
|
|
resp.Msg = errormsg.Success
|
|
resp.Msg = errormsg.Success
|
|
- resp.Data.Total = data.PageDetails.Total
|
|
|
|
|
|
|
|
- for _, v := range data.List {
|
|
|
|
|
|
+ for _, v := range data {
|
|
var conditionList []types.Condition
|
|
var conditionList []types.Condition
|
|
if len(v.ConditionList) > 0 {
|
|
if len(v.ConditionList) > 0 {
|
|
conditionList = make([]types.Condition, len(v.ConditionList))
|
|
conditionList = make([]types.Condition, len(v.ConditionList))
|