diff --git a/code/allapp/allapp-go/biz/handler/money/money_category_service.go b/code/allapp/allapp-go/biz/handler/money/money_category_service.go index 50beff11..8b10f1c6 100644 --- a/code/allapp/allapp-go/biz/handler/money/money_category_service.go +++ b/code/allapp/allapp-go/biz/handler/money/money_category_service.go @@ -7,6 +7,7 @@ import ( "allapp/db" "allapp/db/repo" "allapp/utils/errorx" + "allapp/utils/idgen" "allapp/utils/response" "context" @@ -16,11 +17,11 @@ import ( "github.com/cloudwego/hertz/pkg/protocol/consts" ) -// QueryUserMoneyCategory . +// List . // @router /money/category [GET] -func QueryUserMoneyCategory(ctx context.Context, c *app.RequestContext) { +func List(ctx context.Context, c *app.RequestContext) { var err error - var req money.QueryMoneyCategoryReq + var req money.ListMoneyCategoryReq err = c.BindAndValidate(&req) if err != nil { c.String(consts.StatusBadRequest, err.Error()) @@ -37,7 +38,7 @@ func QueryUserMoneyCategory(ctx context.Context, c *app.RequestContext) { } // 构造返回数据,切片类型是 []*UserMoneyCategory - resp := &money.QueryMoneyCategoryResp{ + resp := &money.ListMoneyCategoryResp{ Categories: make([]*money.MoneyCategory, 0, len(moneyUserCategories)), } @@ -116,3 +117,48 @@ func UpdateMoneyCategorySort(ctx context.Context, c *app.RequestContext) { // 返回成功 response.Success(c).Send() } + +// CreateMoneyCategory . +// @router /money/category/create [POST] +func CreateMoneyCategory(ctx context.Context, c *app.RequestContext) { + var err error + var req money.CreateMoneyCategoryReq + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + resp := new(money.CreateMoneyCategoryResp) + + ID := idgen.NextId() + + params := repo.InsertMoneyUserCategoryParams{ + ID: ID, + UserID: middleware.GetUserID(ctx), + Name: req.Name, + Icon: req.Icon, + Type: req.Type, + // 默认排序号为ID + SortNumber: 0, + } + + // 插入 + db.WithTx(ctx, func(q *repo.Queries) error { + err = q.InsertMoneyUserCategory(ctx, params) + if err != nil { + return err + } + return nil + }) + + if err != nil { + errorx.AddError(c, err) + return + } + + resp.Id = ID + + response.Success(c).Data(resp).Send() +} + diff --git a/code/allapp/allapp-go/biz/model/api/api.pb.go b/code/allapp/allapp-go/biz/model/api/api.pb.go index 37434df6..d82e6a07 100644 --- a/code/allapp/allapp-go/biz/model/api/api.pb.go +++ b/code/allapp/allapp-go/biz/model/api/api.pb.go @@ -3,7 +3,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: api.proto package api @@ -583,9 +583,8 @@ var file_api_proto_rawDesc = []byte{ 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8e, 0x8d, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x42, 0x20, 0x5a, 0x1e, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, - 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x2f, 0x61, 0x70, 0x69, + 0x76, 0x65, 0x42, 0x16, 0x5a, 0x14, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, + 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x61, 0x70, 0x69, } var file_api_proto_goTypes = []interface{}{ diff --git a/code/allapp/allapp-go/biz/model/money/money.pb.go b/code/allapp/allapp-go/biz/model/money/money.pb.go index 090f3dad..bd7e2651 100644 --- a/code/allapp/allapp-go/biz/model/money/money.pb.go +++ b/code/allapp/allapp-go/biz/model/money/money.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: money.proto package money @@ -29,97 +29,106 @@ var file_money_proto_rawDesc = []byte{ 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0xfb, 0x02, 0x0a, 0x14, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6a, 0x0a, 0x16, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x6f, 0x32, 0xd9, 0x03, 0x0a, 0x14, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x56, 0x0a, 0x04, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, + 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, + 0x1c, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x65, + 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x13, 0xca, + 0xc1, 0x18, 0x0f, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, + 0x72, 0x79, 0x12, 0x74, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1d, 0x2e, + 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, + 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, + 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, + 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1a, 0xd2, 0xc1, + 0x18, 0x16, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, + 0x79, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x53, 0x6f, 0x72, 0x74, 0x12, 0x21, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0xd2, 0xc1, 0x18, + 0x1a, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x70, 0x0a, 0x13, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, + 0x72, 0x79, 0x12, 0x1d, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x13, 0xca, 0xc1, 0x18, 0x0f, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, - 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x74, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, - 0x79, 0x12, 0x1d, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, - 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, - 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x22, 0x1a, 0xd2, 0xc1, 0x18, 0x16, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x80, 0x01, 0x0a, - 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x21, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x6d, 0x6f, - 0x6e, 0x65, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, - 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, - 0x1e, 0xd2, 0xc1, 0x18, 0x1a, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x72, 0x74, 0x32, - 0xce, 0x03, 0x0a, 0x12, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, - 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, - 0x65, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, - 0x65, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x17, 0xd2, 0xc1, 0x18, 0x13, - 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x6d, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, + 0x70, 0x22, 0x1a, 0xd2, 0xc1, 0x18, 0x16, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x63, 0x61, + 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x32, 0xce, 0x03, + 0x0a, 0x12, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, - 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, - 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x18, 0xd2, 0xc1, 0x18, 0x14, 0x2f, 0x6d, - 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x69, 0x6e, 0x73, 0x65, - 0x72, 0x74, 0x12, 0x6d, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, - 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x18, 0xd2, 0xc1, 0x18, 0x14, 0x2f, 0x6d, 0x6f, - 0x6e, 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x6d, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x17, 0xd2, 0xc1, 0x18, 0x13, 0x2f, 0x6d, + 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x6d, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x49, + 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x49, + 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x18, 0xd2, 0xc1, 0x18, 0x14, 0x2f, 0x6d, 0x6f, 0x6e, - 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, - 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x6d, - 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, + 0x12, 0x6d, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x18, 0xd2, 0xc1, 0x18, 0x14, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, + 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, + 0x6d, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x22, 0x18, 0xd2, 0xc1, 0x18, 0x14, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, + 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x18, + 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_money_proto_goTypes = []interface{}{ - (*QueryMoneyCategoryReq)(nil), // 0: money.QueryMoneyCategoryReq + (*ListMoneyCategoryReq)(nil), // 0: money.ListMoneyCategoryReq (*DeleteMoneyCategoryReq)(nil), // 1: money.DeleteMoneyCategoryReq (*UpdateMoneyCategorySortReq)(nil), // 2: money.UpdateMoneyCategorySortReq - (*QueryMoneyRecordsParams)(nil), // 3: money.QueryMoneyRecordsParams - (*InsertMoneyRecordParams)(nil), // 4: money.InsertMoneyRecordParams - (*UpdateMoneyRecordParams)(nil), // 5: money.UpdateMoneyRecordParams - (*DeleteMoneyRecordParams)(nil), // 6: money.DeleteMoneyRecordParams - (*QueryMoneyCategoryResp)(nil), // 7: money.QueryMoneyCategoryResp - (*DeleteMoneyCategoryResp)(nil), // 8: money.DeleteMoneyCategoryResp - (*UpdateMoneyCategorySortResp)(nil), // 9: money.UpdateMoneyCategorySortResp - (*QueryMoneyRecordsResult)(nil), // 10: money.QueryMoneyRecordsResult - (*InsertMoneyRecordResult)(nil), // 11: money.InsertMoneyRecordResult - (*UpdateMoneyRecordResult)(nil), // 12: money.UpdateMoneyRecordResult - (*DeleteMoneyRecordResult)(nil), // 13: money.DeleteMoneyRecordResult + (*CreateMoneyCategoryReq)(nil), // 3: money.CreateMoneyCategoryReq + (*QueryMoneyRecordsParams)(nil), // 4: money.QueryMoneyRecordsParams + (*InsertMoneyRecordParams)(nil), // 5: money.InsertMoneyRecordParams + (*UpdateMoneyRecordParams)(nil), // 6: money.UpdateMoneyRecordParams + (*DeleteMoneyRecordParams)(nil), // 7: money.DeleteMoneyRecordParams + (*ListMoneyCategoryResp)(nil), // 8: money.ListMoneyCategoryResp + (*DeleteMoneyCategoryResp)(nil), // 9: money.DeleteMoneyCategoryResp + (*UpdateMoneyCategorySortResp)(nil), // 10: money.UpdateMoneyCategorySortResp + (*CreateMoneyCategoryResp)(nil), // 11: money.CreateMoneyCategoryResp + (*QueryMoneyRecordsResult)(nil), // 12: money.QueryMoneyRecordsResult + (*InsertMoneyRecordResult)(nil), // 13: money.InsertMoneyRecordResult + (*UpdateMoneyRecordResult)(nil), // 14: money.UpdateMoneyRecordResult + (*DeleteMoneyRecordResult)(nil), // 15: money.DeleteMoneyRecordResult } var file_money_proto_depIdxs = []int32{ - 0, // 0: money.MoneyCategoryService.QueryUserMoneyCategory:input_type -> money.QueryMoneyCategoryReq + 0, // 0: money.MoneyCategoryService.List:input_type -> money.ListMoneyCategoryReq 1, // 1: money.MoneyCategoryService.DeleteUserMoneyCategory:input_type -> money.DeleteMoneyCategoryReq 2, // 2: money.MoneyCategoryService.UpdateMoneyCategorySort:input_type -> money.UpdateMoneyCategorySortReq - 3, // 3: money.MoneyRecordService.QueryMoneyRecord:input_type -> money.QueryMoneyRecordsParams - 4, // 4: money.MoneyRecordService.InsertMoneyRecord:input_type -> money.InsertMoneyRecordParams - 5, // 5: money.MoneyRecordService.UpdateMoneyRecord:input_type -> money.UpdateMoneyRecordParams - 6, // 6: money.MoneyRecordService.DeleteMoneyRecord:input_type -> money.DeleteMoneyRecordParams - 7, // 7: money.MoneyCategoryService.QueryUserMoneyCategory:output_type -> money.QueryMoneyCategoryResp - 8, // 8: money.MoneyCategoryService.DeleteUserMoneyCategory:output_type -> money.DeleteMoneyCategoryResp - 9, // 9: money.MoneyCategoryService.UpdateMoneyCategorySort:output_type -> money.UpdateMoneyCategorySortResp - 10, // 10: money.MoneyRecordService.QueryMoneyRecord:output_type -> money.QueryMoneyRecordsResult - 11, // 11: money.MoneyRecordService.InsertMoneyRecord:output_type -> money.InsertMoneyRecordResult - 12, // 12: money.MoneyRecordService.UpdateMoneyRecord:output_type -> money.UpdateMoneyRecordResult - 13, // 13: money.MoneyRecordService.DeleteMoneyRecord:output_type -> money.DeleteMoneyRecordResult - 7, // [7:14] is the sub-list for method output_type - 0, // [0:7] is the sub-list for method input_type + 3, // 3: money.MoneyCategoryService.CreateMoneyCategory:input_type -> money.CreateMoneyCategoryReq + 4, // 4: money.MoneyRecordService.QueryMoneyRecord:input_type -> money.QueryMoneyRecordsParams + 5, // 5: money.MoneyRecordService.InsertMoneyRecord:input_type -> money.InsertMoneyRecordParams + 6, // 6: money.MoneyRecordService.UpdateMoneyRecord:input_type -> money.UpdateMoneyRecordParams + 7, // 7: money.MoneyRecordService.DeleteMoneyRecord:input_type -> money.DeleteMoneyRecordParams + 8, // 8: money.MoneyCategoryService.List:output_type -> money.ListMoneyCategoryResp + 9, // 9: money.MoneyCategoryService.DeleteUserMoneyCategory:output_type -> money.DeleteMoneyCategoryResp + 10, // 10: money.MoneyCategoryService.UpdateMoneyCategorySort:output_type -> money.UpdateMoneyCategorySortResp + 11, // 11: money.MoneyCategoryService.CreateMoneyCategory:output_type -> money.CreateMoneyCategoryResp + 12, // 12: money.MoneyRecordService.QueryMoneyRecord:output_type -> money.QueryMoneyRecordsResult + 13, // 13: money.MoneyRecordService.InsertMoneyRecord:output_type -> money.InsertMoneyRecordResult + 14, // 14: money.MoneyRecordService.UpdateMoneyRecord:output_type -> money.UpdateMoneyRecordResult + 15, // 15: money.MoneyRecordService.DeleteMoneyRecord:output_type -> money.DeleteMoneyRecordResult + 8, // [8:16] is the sub-list for method output_type + 0, // [0:8] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/code/allapp/allapp-go/biz/model/money/money_category_types.pb.go b/code/allapp/allapp-go/biz/model/money/money_category_types.pb.go index 2aea6205..dfa944d3 100644 --- a/code/allapp/allapp-go/biz/model/money/money_category_types.pb.go +++ b/code/allapp/allapp-go/biz/model/money/money_category_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: money/money_category_types.proto package money @@ -102,14 +102,14 @@ func (x *MoneyCategory) GetSortNumber() int32 { } // 查询记账分类请求 -type QueryMoneyCategoryReq struct { +type ListMoneyCategoryReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *QueryMoneyCategoryReq) Reset() { - *x = QueryMoneyCategoryReq{} +func (x *ListMoneyCategoryReq) Reset() { + *x = ListMoneyCategoryReq{} if protoimpl.UnsafeEnabled { mi := &file_money_money_category_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -117,13 +117,13 @@ func (x *QueryMoneyCategoryReq) Reset() { } } -func (x *QueryMoneyCategoryReq) String() string { +func (x *ListMoneyCategoryReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryMoneyCategoryReq) ProtoMessage() {} +func (*ListMoneyCategoryReq) ProtoMessage() {} -func (x *QueryMoneyCategoryReq) ProtoReflect() protoreflect.Message { +func (x *ListMoneyCategoryReq) ProtoReflect() protoreflect.Message { mi := &file_money_money_category_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -135,13 +135,13 @@ func (x *QueryMoneyCategoryReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use QueryMoneyCategoryReq.ProtoReflect.Descriptor instead. -func (*QueryMoneyCategoryReq) Descriptor() ([]byte, []int) { +// Deprecated: Use ListMoneyCategoryReq.ProtoReflect.Descriptor instead. +func (*ListMoneyCategoryReq) Descriptor() ([]byte, []int) { return file_money_money_category_types_proto_rawDescGZIP(), []int{1} } // 查询记账分类响应 -type QueryMoneyCategoryResp struct { +type ListMoneyCategoryResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -149,8 +149,8 @@ type QueryMoneyCategoryResp struct { Categories []*MoneyCategory `protobuf:"bytes,1,rep,name=Categories,proto3" form:"categories" json:"categories"` } -func (x *QueryMoneyCategoryResp) Reset() { - *x = QueryMoneyCategoryResp{} +func (x *ListMoneyCategoryResp) Reset() { + *x = ListMoneyCategoryResp{} if protoimpl.UnsafeEnabled { mi := &file_money_money_category_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -158,13 +158,13 @@ func (x *QueryMoneyCategoryResp) Reset() { } } -func (x *QueryMoneyCategoryResp) String() string { +func (x *ListMoneyCategoryResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryMoneyCategoryResp) ProtoMessage() {} +func (*ListMoneyCategoryResp) ProtoMessage() {} -func (x *QueryMoneyCategoryResp) ProtoReflect() protoreflect.Message { +func (x *ListMoneyCategoryResp) ProtoReflect() protoreflect.Message { mi := &file_money_money_category_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -176,12 +176,12 @@ func (x *QueryMoneyCategoryResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use QueryMoneyCategoryResp.ProtoReflect.Descriptor instead. -func (*QueryMoneyCategoryResp) Descriptor() ([]byte, []int) { +// Deprecated: Use ListMoneyCategoryResp.ProtoReflect.Descriptor instead. +func (*ListMoneyCategoryResp) Descriptor() ([]byte, []int) { return file_money_money_category_types_proto_rawDescGZIP(), []int{2} } -func (x *QueryMoneyCategoryResp) GetCategories() []*MoneyCategory { +func (x *ListMoneyCategoryResp) GetCategories() []*MoneyCategory { if x != nil { return x.Categories } @@ -418,6 +418,116 @@ func (*UpdateMoneyCategorySortResp) Descriptor() ([]byte, []int) { return file_money_money_category_types_proto_rawDescGZIP(), []int{7} } +type CreateMoneyCategoryReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" form:"name" json:"name" vd:"$ != '' && len($) <= 5"` + Icon string `protobuf:"bytes,2,opt,name=Icon,proto3" form:"icon" json:"icon" vd:"$ != ''"` + Type int32 `protobuf:"varint,3,opt,name=Type,proto3" form:"type" json:"type"` +} + +func (x *CreateMoneyCategoryReq) Reset() { + *x = CreateMoneyCategoryReq{} + if protoimpl.UnsafeEnabled { + mi := &file_money_money_category_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMoneyCategoryReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMoneyCategoryReq) ProtoMessage() {} + +func (x *CreateMoneyCategoryReq) ProtoReflect() protoreflect.Message { + mi := &file_money_money_category_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMoneyCategoryReq.ProtoReflect.Descriptor instead. +func (*CreateMoneyCategoryReq) Descriptor() ([]byte, []int) { + return file_money_money_category_types_proto_rawDescGZIP(), []int{8} +} + +func (x *CreateMoneyCategoryReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateMoneyCategoryReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CreateMoneyCategoryReq) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +type CreateMoneyCategoryResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"` +} + +func (x *CreateMoneyCategoryResp) Reset() { + *x = CreateMoneyCategoryResp{} + if protoimpl.UnsafeEnabled { + mi := &file_money_money_category_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMoneyCategoryResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMoneyCategoryResp) ProtoMessage() {} + +func (x *CreateMoneyCategoryResp) ProtoReflect() protoreflect.Message { + mi := &file_money_money_category_types_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMoneyCategoryResp.ProtoReflect.Descriptor instead. +func (*CreateMoneyCategoryResp) Descriptor() ([]byte, []int) { + return file_money_money_category_types_proto_rawDescGZIP(), []int{9} +} + +func (x *CreateMoneyCategoryResp) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + var File_money_money_category_types_proto protoreflect.FileDescriptor var file_money_money_category_types_proto_rawDesc = []byte{ @@ -435,36 +545,49 @@ var file_money_money_category_types_proto_rawDesc = []byte{ 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x53, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0a, 0x53, - 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x22, 0x5e, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, - 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x0a, - 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, - 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x63, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, - 0x65, 0x73, 0x22, 0x3a, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, - 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x02, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x10, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, - 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x02, 0x49, 0x64, 0x22, 0x19, - 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x60, 0x0a, 0x15, 0x4d, 0x6f, 0x6e, - 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x74, - 0x65, 0x6d, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, - 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x53, 0x6f, - 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0f, - 0xca, 0xbb, 0x18, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, - 0x0a, 0x53, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x58, 0x0a, 0x1a, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, - 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x3a, 0x0a, 0x04, 0x44, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, - 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, - 0x74, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x1d, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, - 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, - 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x71, 0x22, 0x5d, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, + 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x0a, 0x43, 0x61, + 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, + 0x67, 0x6f, 0x72, 0x79, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, + 0x22, 0x3a, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, + 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x02, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x10, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb, + 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x02, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x60, 0x0a, 0x15, 0x4d, 0x6f, 0x6e, 0x65, 0x79, + 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, + 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, + 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x53, 0x6f, 0x72, 0x74, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0f, 0xca, 0xbb, + 0x18, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0a, 0x53, + 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x58, 0x0a, 0x1a, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x3a, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, + 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x49, + 0x74, 0x65, 0x6d, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x64, 0x61, 0x74, 0x61, 0x52, 0x04, 0x44, + 0x61, 0x74, 0x61, 0x22, 0x1d, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, + 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x22, 0x97, 0x01, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, + 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x36, 0x0a, + 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xca, 0xbb, 0x18, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0xda, 0xbb, 0x18, 0x16, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x27, 0x27, + 0x20, 0x26, 0x26, 0x20, 0x6c, 0x65, 0x6e, 0x28, 0x24, 0x29, 0x20, 0x3c, 0x3d, 0x20, 0x35, 0x52, + 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x63, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x13, 0xca, 0xbb, 0x18, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0xda, 0xbb, 0x18, + 0x07, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x27, 0x27, 0x52, 0x04, 0x49, 0x63, 0x6f, 0x6e, 0x12, 0x1c, + 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x08, 0xca, 0xbb, + 0x18, 0x04, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x31, 0x0a, 0x17, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x42, + 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -479,19 +602,21 @@ func file_money_money_category_types_proto_rawDescGZIP() []byte { return file_money_money_category_types_proto_rawDescData } -var file_money_money_category_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_money_money_category_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_money_money_category_types_proto_goTypes = []interface{}{ (*MoneyCategory)(nil), // 0: money.MoneyCategory - (*QueryMoneyCategoryReq)(nil), // 1: money.QueryMoneyCategoryReq - (*QueryMoneyCategoryResp)(nil), // 2: money.QueryMoneyCategoryResp + (*ListMoneyCategoryReq)(nil), // 1: money.ListMoneyCategoryReq + (*ListMoneyCategoryResp)(nil), // 2: money.ListMoneyCategoryResp (*DeleteMoneyCategoryReq)(nil), // 3: money.DeleteMoneyCategoryReq (*DeleteMoneyCategoryResp)(nil), // 4: money.DeleteMoneyCategoryResp (*MoneyCategorySortItem)(nil), // 5: money.MoneyCategorySortItem (*UpdateMoneyCategorySortReq)(nil), // 6: money.UpdateMoneyCategorySortReq (*UpdateMoneyCategorySortResp)(nil), // 7: money.UpdateMoneyCategorySortResp + (*CreateMoneyCategoryReq)(nil), // 8: money.CreateMoneyCategoryReq + (*CreateMoneyCategoryResp)(nil), // 9: money.CreateMoneyCategoryResp } var file_money_money_category_types_proto_depIdxs = []int32{ - 0, // 0: money.QueryMoneyCategoryResp.Categories:type_name -> money.MoneyCategory + 0, // 0: money.ListMoneyCategoryResp.Categories:type_name -> money.MoneyCategory 5, // 1: money.UpdateMoneyCategorySortReq.Data:type_name -> money.MoneyCategorySortItem 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type @@ -519,7 +644,7 @@ func file_money_money_category_types_proto_init() { } } file_money_money_category_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryMoneyCategoryReq); i { + switch v := v.(*ListMoneyCategoryReq); i { case 0: return &v.state case 1: @@ -531,7 +656,7 @@ func file_money_money_category_types_proto_init() { } } file_money_money_category_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryMoneyCategoryResp); i { + switch v := v.(*ListMoneyCategoryResp); i { case 0: return &v.state case 1: @@ -602,6 +727,30 @@ func file_money_money_category_types_proto_init() { return nil } } + file_money_money_category_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMoneyCategoryReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_money_money_category_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMoneyCategoryResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -609,7 +758,7 @@ func file_money_money_category_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_money_money_category_types_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/code/allapp/allapp-go/biz/model/money/money_record_types.pb.go b/code/allapp/allapp-go/biz/model/money/money_record_types.pb.go index 8ad84721..e136a038 100644 --- a/code/allapp/allapp-go/biz/model/money/money_record_types.pb.go +++ b/code/allapp/allapp-go/biz/model/money/money_record_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: money/money_record_types.proto package money @@ -865,10 +865,9 @@ var file_money_money_record_types_proto_rawDesc = []byte{ 0x12, 0x1e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x04, 0x24, 0x21, 0x3d, 0x30, 0x52, 0x02, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, - 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, - 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, - 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x18, 0x5a, 0x16, 0x61, + 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, + 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/code/allapp/allapp-go/biz/router/money/middleware.go b/code/allapp/allapp-go/biz/router/money/middleware.go index 880470b7..53b264c2 100644 --- a/code/allapp/allapp-go/biz/router/money/middleware.go +++ b/code/allapp/allapp-go/biz/router/money/middleware.go @@ -60,3 +60,13 @@ func _deletemoneyrecordMw() []app.HandlerFunc { // your code... return nil } + +func _createmoneycategoryMw() []app.HandlerFunc { + // your code... + return nil +} + +func _listMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/code/allapp/allapp-go/biz/router/money/money.go b/code/allapp/allapp-go/biz/router/money/money.go index 797332c7..c7c07817 100644 --- a/code/allapp/allapp-go/biz/router/money/money.go +++ b/code/allapp/allapp-go/biz/router/money/money.go @@ -19,8 +19,9 @@ func Register(r *server.Hertz) { root := r.Group("/", rootMw()...) { _money := root.Group("/money", _moneyMw()...) - _money.GET("/category", append(_queryusermoneycategoryMw(), money.QueryUserMoneyCategory)...) + _money.GET("/category", append(_listMw(), money.List)...) _category := _money.Group("/category", _categoryMw()...) + _category.POST("/create", append(_createmoneycategoryMw(), money.CreateMoneyCategory)...) _category.POST("/delete", append(_deleteusermoneycategoryMw(), money.DeleteUserMoneyCategory)...) _category.POST("/updateSort", append(_updatemoneycategorysortMw(), money.UpdateMoneyCategorySort)...) { diff --git a/code/allapp/allapp-go/db/queries/money_user_category.sql b/code/allapp/allapp-go/db/queries/money_user_category.sql index 831d6117..dda6dfe6 100644 --- a/code/allapp/allapp-go/db/queries/money_user_category.sql +++ b/code/allapp/allapp-go/db/queries/money_user_category.sql @@ -18,4 +18,8 @@ WHERE id = $1; -- name: DeleteMoneyCategoryByUserId :exec DELETE FROM money_user_category -WHERE user_id = $1; \ No newline at end of file +WHERE user_id = $1; + +-- name: InsertMoneyUserCategory :exec +INSERT INTO money_user_category (id, user_id, name, icon, type, sort_number) +VALUES ($1, $2, $3, $4, $5, $6); \ No newline at end of file diff --git a/code/allapp/allapp-go/db/repo/money_user_category.sql.go b/code/allapp/allapp-go/db/repo/money_user_category.sql.go index 48e750ad..57b52a4b 100644 --- a/code/allapp/allapp-go/db/repo/money_user_category.sql.go +++ b/code/allapp/allapp-go/db/repo/money_user_category.sql.go @@ -71,3 +71,29 @@ func (q *Queries) FindUserMoneyCategoriesByUserID(ctx context.Context, userID in } return items, nil } + +const insertMoneyUserCategory = `-- name: InsertMoneyUserCategory :exec +INSERT INTO money_user_category (id, user_id, name, icon, type, sort_number) +VALUES ($1, $2, $3, $4, $5, $6) +` + +type InsertMoneyUserCategoryParams struct { + ID int64 + UserID int64 + Name string + Icon string + Type int32 + SortNumber int32 +} + +func (q *Queries) InsertMoneyUserCategory(ctx context.Context, arg InsertMoneyUserCategoryParams) error { + _, err := q.db.Exec(ctx, insertMoneyUserCategory, + arg.ID, + arg.UserID, + arg.Name, + arg.Icon, + arg.Type, + arg.SortNumber, + ) + return err +} diff --git a/code/allapp/allapp-go/idl/money/money.proto b/code/allapp/allapp-go/idl/money/money.proto index 7f844180..fb4d466c 100644 --- a/code/allapp/allapp-go/idl/money/money.proto +++ b/code/allapp/allapp-go/idl/money/money.proto @@ -9,7 +9,7 @@ import "money/money_category_types.proto"; import "money/money_record_types.proto"; service MoneyCategoryService { - rpc QueryUserMoneyCategory(QueryMoneyCategoryReq) returns (QueryMoneyCategoryResp){ + rpc List(ListMoneyCategoryReq) returns (ListMoneyCategoryResp){ option (api.get) = '/money/category'; }; rpc DeleteUserMoneyCategory(DeleteMoneyCategoryReq) returns (DeleteMoneyCategoryResp){ @@ -18,6 +18,9 @@ service MoneyCategoryService { rpc UpdateMoneyCategorySort(UpdateMoneyCategorySortReq) returns (UpdateMoneyCategorySortResp){ option (api.post) = '/money/category/updateSort'; }; + rpc CreateMoneyCategory(CreateMoneyCategoryReq) returns (CreateMoneyCategoryResp){ + option (api.post) = '/money/category/create'; + }; } service MoneyRecordService { diff --git a/code/allapp/allapp-go/idl/money/money_category_types.proto b/code/allapp/allapp-go/idl/money/money_category_types.proto index bf64e3b8..16e6abb8 100644 --- a/code/allapp/allapp-go/idl/money/money_category_types.proto +++ b/code/allapp/allapp-go/idl/money/money_category_types.proto @@ -15,10 +15,10 @@ message MoneyCategory { } // 查询记账分类请求 -message QueryMoneyCategoryReq {} +message ListMoneyCategoryReq {} // 查询记账分类响应 -message QueryMoneyCategoryResp { +message ListMoneyCategoryResp { repeated MoneyCategory Categories = 1 [(api.body)="categories"]; } @@ -43,3 +43,19 @@ message UpdateMoneyCategorySortReq { // 修改分类排序响应 message UpdateMoneyCategorySortResp {} + +message CreateMoneyCategoryReq { + string Name = 1 [ + (api.body)="name", + (api.vd) = "$ != '' && len($) <= 5" + ]; + string Icon = 2 [ + (api.body)="icon", + (api.vd) = "$ != ''" + ]; + int32 Type = 3 [(api.body)="type"]; +} + +message CreateMoneyCategoryResp { + int64 Id = 1 [(api.body)="id"]; +} diff --git a/code/allapp/allapp-rn/src/types/money/category.ts b/code/allapp/allapp-rn/src/types/money/category.ts index 11e14803..dfb80b65 100644 --- a/code/allapp/allapp-rn/src/types/money/category.ts +++ b/code/allapp/allapp-rn/src/types/money/category.ts @@ -33,3 +33,13 @@ export enum MoneyCategoryEnum { Expense = 0, // 支出 Income = 1, // 收入 } + +export interface CreateMoneyCategoryParams { + name: string + icon: string + type: MoneyCategoryEnum +} + +export interface CreateMoneyCategoryResult { + id: number +}