This commit is contained in:
oneao committed 2025-11-30 22:40:56 +08:00
1 parent 5308dc8fda
commit d51eacb8ad
32 files changed
+1788 -513

No files matched your search

@@ -4,13 +4,14 @@ package auth
import (
"cn/oneao/base-go/db"
dbtype "cn/oneao/base-go/db/sqlc"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/logx"
"cn/oneao/base-go/utils/jwtx"
"cn/oneao/base-go/utils/response"
"context"
"cn/oneao/base-go/biz/model/auth"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
@@ -30,7 +31,7 @@ func LoginDefault(ctx context.Context, c *app.RequestContext) {
account := req.Account
password := req.Password
params := dbtype.GetUserForLoginParams{
params := repo.GetUserForLoginParams{
Account: account,
Password: password,
}
@@ -5,11 +5,12 @@ package auth
import (
auth "cn/oneao/base-go/biz/model/auth"
"cn/oneao/base-go/db"
dbtype "cn/oneao/base-go/db/sqlc"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/idgen"
"cn/oneao/base-go/utils/response"
"context"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/jackc/pgx/v5"
@@ -64,7 +65,7 @@ func RegisterDefault(ctx context.Context, c *app.RequestContext) {
}()
// 插入用户
params := dbtype.InsertUserParams{
params := repo.InsertUserParams{
ID: idgen.NextId(),
Account: account,
Password: password,
@@ -96,9 +97,9 @@ func initMoneyCategoryTx(ctx context.Context, tx pgx.Tx, userId int64) error {
return nil
}
userCategories := make([]dbtype.BatchInsertMoneyUserCategoriesParams, 0, len(sysCategories))
userCategories := make([]repo.BatchInsertMoneyUserCategoriesParams, 0, len(sysCategories))
for _, sysCat := range sysCategories {
userCategories = append(userCategories, dbtype.BatchInsertMoneyUserCategoriesParams{
userCategories = append(userCategories, repo.BatchInsertMoneyUserCategoriesParams{
ID: idgen.NextId(),
UserID: userId,
Name: sysCat.Name,
@@ -9,6 +9,7 @@ import (
"context"
auth "cn/oneao/base-go/biz/model/auth"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
@@ -1,14 +1,16 @@
// Code generated by hertz generator.
package money_category
package money
import (
money_category "cn/oneao/base-go/biz/model/money_category"
"cn/oneao/base-go/biz/model/money"
"cn/oneao/base-go/biz/router/middleware"
"cn/oneao/base-go/db"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/response"
"context"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
@@ -17,7 +19,7 @@ import (
// @router /money/category [GET]
func QueryUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
var err error
var req money_category.QueryUserMoneyCategoryReq
var req money.QueryMoneyCategoryReq
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -34,18 +36,18 @@ func QueryUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
}
// 构造返回数据,切片类型是 []*UserMoneyCategory
resp := &money_category.QueryUserMoneyCategoryResp{
Categories: make([]*money_category.UserMoneyCategory, 0, len(moneyUserCategories)),
resp := &money.QueryMoneyCategoryResp{
Categories: make([]*money.MoneyCategory, 0, len(moneyUserCategories)),
}
for _, c := range moneyUserCategories {
category := &money_category.UserMoneyCategory{
category := &money.MoneyCategory{
Id: c.ID,
Name: c.Name,
Icon: c.Icon,
Type: c.Type.Int32,
SortNumber: c.SortNumber.Int32,
Type: c.Type,
SortNumber: c.SortNumber,
}
resp.Categories = append(resp.Categories, category)
}
@@ -54,10 +56,10 @@ func QueryUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
}
// DeleteUserMoneyCategory .
// @router /money/category/delete [GET]
// @router /money/category/delete [POST]
func DeleteUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
var err error
var req money_category.DeleteUserMoneyCategoryReq
var req money.DeleteMoneyCategoryReq
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -71,7 +73,45 @@ func DeleteUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
return
}
resp := new(money_category.DeleteUserMoneyCategoryResp)
resp := new(money.DeleteMoneyCategoryResp)
response.Success(c).Data(resp).Send()
}
// UpdateMoneyCategorySort .
// @router /money/category/updateSort [POST]
func UpdateMoneyCategorySort(ctx context.Context, c *app.RequestContext) {
var req money.UpdateMoneyCategorySortReq
if err := c.BindAndValidate(&req); err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
// 组装批量更新参数
params := make([]repo.BatchUpdateMoneyCategorySortParams, 0, len(req.Data))
for _, datum := range req.Data {
params = append(params, repo.BatchUpdateMoneyCategorySortParams{
ID: datum.Id,
SortNumber: datum.SortNumber,
})
}
// 使用统一事务封装
err := db.WithTx(ctx, func(q *repo.Queries) error {
batch := q.BatchUpdateMoneyCategorySort(ctx, params)
if err := db.RunBatch(ctx, batch); err != nil {
return err
}
return nil
})
if err != nil {
errorx.AddError(c, err)
return
}
// 返回成功
response.Success(c).Send()
}
@@ -0,0 +1,131 @@
// Code generated by hertz generator.
package money
import (
"cn/oneao/base-go/biz/router/middleware"
"cn/oneao/base-go/db"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/response"
"context"
"fmt"
"sort"
"time"
money "cn/oneao/base-go/biz/model/money"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/jackc/pgx/v5/pgtype"
"github.com/shopspring/decimal"
"google.golang.org/protobuf/types/known/timestamppb"
)
// QueryMoneyRecord .
// @router /money/record [POST]
func QueryMoneyRecord(ctx context.Context, c *app.RequestContext) {
var req money.QueryMoneyRecordsParams
if err := c.BindAndValidate(&req); err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
// 解析年月
startTime, err := time.Parse("2006-01", req.RecordTime)
if err != nil {
errorx.AddError(c, fmt.Errorf("invalid record_time format: %v", err))
return
}
endTime := startTime.AddDate(0, 1, 0).Add(-time.Nanosecond)
// 获取 userID
userID := middleware.GetUserID(ctx)
// 查询记录
params := repo.FindUserMoneyRecordsParams{
UserID: userID,
RecordTime: pgtype.Timestamp{Time: startTime, Valid: true},
RecordTime_2: pgtype.Timestamp{Time: endTime, Valid: true},
}
records, err := db.Queries.FindUserMoneyRecords(ctx, params)
if err != nil {
errorx.AddError(c, err)
return
}
// 分组统计
groupMap := make(map[string]*money.MoneyRecordGroup)
totalIncome := decimal.NewFromInt(0)
totalExpense := decimal.NewFromInt(0)
for _, r := range records {
day := r.RecordTime.Time.Format("2006-01-02")
group, ok := groupMap[day]
if !ok {
group = &money.MoneyRecordGroup{
RecordTime: day,
Income: "0.00",
Expense: "0.00",
Records: make([]*money.MoneyRecordItem, 0),
}
groupMap[day] = group
}
// 构造单条记录
item := &money.MoneyRecordItem{
Base: &money.MoneyRecordBase{
Id: r.ID,
CategoryId: r.CategoryID,
UserId: r.UserID,
Amount: r.Amount.Int.String(),
Remark: r.Remark.String,
RecordTime: timestamppb.New(r.RecordTime.Time),
CreateTime: timestamppb.New(r.CreateTime.Time),
UpdateTime: timestamppb.New(r.UpdateTime.Time),
},
CategoryName: r.CategoryName.String,
CategoryIcon: r.CategoryIcon.String,
CategoryType: r.CategoryType.Int32,
}
group.Records = append(group.Records, item)
// 收支累加
amount, _ := decimal.NewFromString(r.Amount.Int.String())
if r.CategoryType.Int32 == 1 {
incomeDec, _ := decimal.NewFromString(group.Income)
incomeDec = incomeDec.Add(amount)
group.Income = incomeDec.Round(2).StringFixed(2)
totalIncome = totalIncome.Add(amount)
} else if r.CategoryType.Int32 == 0 {
expenseDec, _ := decimal.NewFromString(group.Expense)
expenseDec = expenseDec.Add(amount)
group.Expense = expenseDec.Round(2).StringFixed(2)
totalExpense = totalExpense.Add(amount)
}
}
// 对日期排序,最新在前
dates := make([]string, 0, len(groupMap))
for k := range groupMap {
dates = append(dates, k)
}
sort.Slice(dates, func(i, j int) bool { return dates[i] > dates[j] })
// 构建最终返回数组
resultGroups := make([]*money.MoneyRecordGroup, 0, len(dates))
for _, day := range dates {
resultGroups = append(resultGroups, groupMap[day])
}
result := &money.QueryMoneyRecordsResult{
Records: resultGroups,
TotalIncome: totalIncome.Round(2).StringFixed(2),
TotalExpense: totalExpense.Round(2).StringFixed(2),
}
response.Success(c).Data(result).Send()
}
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v4.25.3
// protoc v6.33.1
// source: api.proto
package api
@@ -0,0 +1,639 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// source: money_category.proto
package money
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type QueryMoneyCategoryReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *QueryMoneyCategoryReq) Reset() {
*x = QueryMoneyCategoryReq{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryMoneyCategoryReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryMoneyCategoryReq) ProtoMessage() {}
func (x *QueryMoneyCategoryReq) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[0]
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 QueryMoneyCategoryReq.ProtoReflect.Descriptor instead.
func (*QueryMoneyCategoryReq) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{0}
}
type MoneyCategory struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" form:"id" json:"id" query:"id"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" form:"name" json:"name" query:"name"`
Icon string `protobuf:"bytes,3,opt,name=icon,proto3" form:"icon" json:"icon" query:"icon"`
Type int32 `protobuf:"varint,4,opt,name=type,proto3" form:"type" json:"type" query:"type"`
SortNumber int32 `protobuf:"varint,5,opt,name=sort_number,json=sortNumber,proto3" form:"sort_number" json:"sort_number" query:"sort_number"`
}
func (x *MoneyCategory) Reset() {
*x = MoneyCategory{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MoneyCategory) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoneyCategory) ProtoMessage() {}
func (x *MoneyCategory) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[1]
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 MoneyCategory.ProtoReflect.Descriptor instead.
func (*MoneyCategory) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{1}
}
func (x *MoneyCategory) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MoneyCategory) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *MoneyCategory) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
func (x *MoneyCategory) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
func (x *MoneyCategory) GetSortNumber() int32 {
if x != nil {
return x.SortNumber
}
return 0
}
type QueryMoneyCategoryResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Categories []*MoneyCategory `protobuf:"bytes,1,rep,name=categories,proto3" form:"categories" json:"categories" query:"categories"`
}
func (x *QueryMoneyCategoryResp) Reset() {
*x = QueryMoneyCategoryResp{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryMoneyCategoryResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryMoneyCategoryResp) ProtoMessage() {}
func (x *QueryMoneyCategoryResp) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[2]
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 QueryMoneyCategoryResp.ProtoReflect.Descriptor instead.
func (*QueryMoneyCategoryResp) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{2}
}
func (x *QueryMoneyCategoryResp) GetCategories() []*MoneyCategory {
if x != nil {
return x.Categories
}
return nil
}
type DeleteMoneyCategoryReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id" vd:"$ != 0"`
}
func (x *DeleteMoneyCategoryReq) Reset() {
*x = DeleteMoneyCategoryReq{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteMoneyCategoryReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteMoneyCategoryReq) ProtoMessage() {}
func (x *DeleteMoneyCategoryReq) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[3]
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 DeleteMoneyCategoryReq.ProtoReflect.Descriptor instead.
func (*DeleteMoneyCategoryReq) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{3}
}
func (x *DeleteMoneyCategoryReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type DeleteMoneyCategoryResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteMoneyCategoryResp) Reset() {
*x = DeleteMoneyCategoryResp{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteMoneyCategoryResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteMoneyCategoryResp) ProtoMessage() {}
func (x *DeleteMoneyCategoryResp) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[4]
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 DeleteMoneyCategoryResp.ProtoReflect.Descriptor instead.
func (*DeleteMoneyCategoryResp) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{4}
}
type MoneyCategorySortItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" form:"id" json:"id" query:"id"`
SortNumber int32 `protobuf:"varint,2,opt,name=sort_number,json=sortNumber,proto3" form:"sort_number" json:"sort_number" query:"sort_number"`
}
func (x *MoneyCategorySortItem) Reset() {
*x = MoneyCategorySortItem{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MoneyCategorySortItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoneyCategorySortItem) ProtoMessage() {}
func (x *MoneyCategorySortItem) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[5]
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 MoneyCategorySortItem.ProtoReflect.Descriptor instead.
func (*MoneyCategorySortItem) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{5}
}
func (x *MoneyCategorySortItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MoneyCategorySortItem) GetSortNumber() int32 {
if x != nil {
return x.SortNumber
}
return 0
}
type UpdateMoneyCategorySortReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*MoneyCategorySortItem `protobuf:"bytes,1,rep,name=data,proto3" form:"data" json:"data" query:"data"`
}
func (x *UpdateMoneyCategorySortReq) Reset() {
*x = UpdateMoneyCategorySortReq{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateMoneyCategorySortReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateMoneyCategorySortReq) ProtoMessage() {}
func (x *UpdateMoneyCategorySortReq) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[6]
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 UpdateMoneyCategorySortReq.ProtoReflect.Descriptor instead.
func (*UpdateMoneyCategorySortReq) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{6}
}
func (x *UpdateMoneyCategorySortReq) GetData() []*MoneyCategorySortItem {
if x != nil {
return x.Data
}
return nil
}
type UpdateMoneyCategorySortResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateMoneyCategorySortResp) Reset() {
*x = UpdateMoneyCategorySortResp{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateMoneyCategorySortResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateMoneyCategorySortResp) ProtoMessage() {}
func (x *UpdateMoneyCategorySortResp) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[7]
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 UpdateMoneyCategorySortResp.ProtoReflect.Descriptor instead.
func (*UpdateMoneyCategorySortResp) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{7}
}
var File_money_category_proto protoreflect.FileDescriptor
var file_money_category_proto_rawDesc = []byte{
0x0a, 0x14, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x1a, 0x09, 0x61,
0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x7c, 0x0a, 0x0d, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f,
0x0a, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20,
0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22,
0x4e, 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, 0x34, 0x0a, 0x0a, 0x63, 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, 0x52, 0x0a, 0x63, 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, 0x48, 0x0a, 0x15, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43,
0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
0x22, 0x4e, 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, 0x30,
0x0a, 0x04, 0x64, 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, 0x52, 0x04, 0x64, 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, 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, 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, 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,
}
var (
file_money_category_proto_rawDescOnce sync.Once
file_money_category_proto_rawDescData = file_money_category_proto_rawDesc
)
func file_money_category_proto_rawDescGZIP() []byte {
file_money_category_proto_rawDescOnce.Do(func() {
file_money_category_proto_rawDescData = protoimpl.X.CompressGZIP(file_money_category_proto_rawDescData)
})
return file_money_category_proto_rawDescData
}
var file_money_category_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_money_category_proto_goTypes = []interface{}{
(*QueryMoneyCategoryReq)(nil), // 0: money.QueryMoneyCategoryReq
(*MoneyCategory)(nil), // 1: money.MoneyCategory
(*QueryMoneyCategoryResp)(nil), // 2: money.QueryMoneyCategoryResp
(*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
}
var file_money_category_proto_depIdxs = []int32{
1, // 0: money.QueryMoneyCategoryResp.categories:type_name -> money.MoneyCategory
5, // 1: money.UpdateMoneyCategorySortReq.data:type_name -> money.MoneyCategorySortItem
0, // 2: money.MoneyCategoryService.QueryUserMoneyCategory:input_type -> money.QueryMoneyCategoryReq
3, // 3: money.MoneyCategoryService.DeleteUserMoneyCategory:input_type -> money.DeleteMoneyCategoryReq
6, // 4: money.MoneyCategoryService.UpdateMoneyCategorySort:input_type -> money.UpdateMoneyCategorySortReq
2, // 5: money.MoneyCategoryService.QueryUserMoneyCategory:output_type -> money.QueryMoneyCategoryResp
4, // 6: money.MoneyCategoryService.DeleteUserMoneyCategory:output_type -> money.DeleteMoneyCategoryResp
7, // 7: money.MoneyCategoryService.UpdateMoneyCategorySort:output_type -> money.UpdateMoneyCategorySortResp
5, // [5:8] is the sub-list for method output_type
2, // [2:5] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_money_category_proto_init() }
func file_money_category_proto_init() {
if File_money_category_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_money_category_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryMoneyCategoryReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MoneyCategory); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryMoneyCategoryResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteMoneyCategoryReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteMoneyCategoryResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MoneyCategorySortItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateMoneyCategorySortReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateMoneyCategorySortResp); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_money_category_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_money_category_proto_goTypes,
DependencyIndexes: file_money_category_proto_depIdxs,
MessageInfos: file_money_category_proto_msgTypes,
}.Build()
File_money_category_proto = out.File
file_money_category_proto_rawDesc = nil
file_money_category_proto_goTypes = nil
file_money_category_proto_depIdxs = nil
}
@@ -0,0 +1,577 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// source: money_record.proto
package money
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MoneyRecordBase struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" form:"id" json:"id" query:"id"`
CategoryId int64 `protobuf:"varint,2,opt,name=category_id,json=categoryId,proto3" form:"category_id" json:"category_id" query:"category_id"`
UserId int64 `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" form:"user_id" json:"user_id" query:"user_id"`
Amount string `protobuf:"bytes,4,opt,name=amount,proto3" form:"amount" json:"amount" query:"amount"`
Remark string `protobuf:"bytes,5,opt,name=remark,proto3" form:"remark" json:"remark" query:"remark"`
RecordTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=record_time,json=recordTime,proto3" form:"record_time" json:"record_time" query:"record_time"`
CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" form:"create_time" json:"create_time" query:"create_time"`
UpdateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=update_time,json=updateTime,proto3" form:"update_time" json:"update_time" query:"update_time"`
}
func (x *MoneyRecordBase) Reset() {
*x = MoneyRecordBase{}
if protoimpl.UnsafeEnabled {
mi := &file_money_record_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MoneyRecordBase) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoneyRecordBase) ProtoMessage() {}
func (x *MoneyRecordBase) ProtoReflect() protoreflect.Message {
mi := &file_money_record_proto_msgTypes[0]
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 MoneyRecordBase.ProtoReflect.Descriptor instead.
func (*MoneyRecordBase) Descriptor() ([]byte, []int) {
return file_money_record_proto_rawDescGZIP(), []int{0}
}
func (x *MoneyRecordBase) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MoneyRecordBase) GetCategoryId() int64 {
if x != nil {
return x.CategoryId
}
return 0
}
func (x *MoneyRecordBase) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *MoneyRecordBase) GetAmount() string {
if x != nil {
return x.Amount
}
return ""
}
func (x *MoneyRecordBase) GetRemark() string {
if x != nil {
return x.Remark
}
return ""
}
func (x *MoneyRecordBase) GetRecordTime() *timestamppb.Timestamp {
if x != nil {
return x.RecordTime
}
return nil
}
func (x *MoneyRecordBase) GetCreateTime() *timestamppb.Timestamp {
if x != nil {
return x.CreateTime
}
return nil
}
func (x *MoneyRecordBase) GetUpdateTime() *timestamppb.Timestamp {
if x != nil {
return x.UpdateTime
}
return nil
}
type MoneyRecordItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Base *MoneyRecordBase `protobuf:"bytes,1,opt,name=base,proto3" form:"base" json:"base" query:"base"`
CategoryName string `protobuf:"bytes,2,opt,name=category_name,json=categoryName,proto3" form:"category_name" json:"category_name" query:"category_name"`
CategoryIcon string `protobuf:"bytes,3,opt,name=category_icon,json=categoryIcon,proto3" form:"category_icon" json:"category_icon" query:"category_icon"`
CategoryType int32 `protobuf:"varint,4,opt,name=category_type,json=categoryType,proto3" form:"category_type" json:"category_type" query:"category_type"`
}
func (x *MoneyRecordItem) Reset() {
*x = MoneyRecordItem{}
if protoimpl.UnsafeEnabled {
mi := &file_money_record_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MoneyRecordItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoneyRecordItem) ProtoMessage() {}
func (x *MoneyRecordItem) ProtoReflect() protoreflect.Message {
mi := &file_money_record_proto_msgTypes[1]
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 MoneyRecordItem.ProtoReflect.Descriptor instead.
func (*MoneyRecordItem) Descriptor() ([]byte, []int) {
return file_money_record_proto_rawDescGZIP(), []int{1}
}
func (x *MoneyRecordItem) GetBase() *MoneyRecordBase {
if x != nil {
return x.Base
}
return nil
}
func (x *MoneyRecordItem) GetCategoryName() string {
if x != nil {
return x.CategoryName
}
return ""
}
func (x *MoneyRecordItem) GetCategoryIcon() string {
if x != nil {
return x.CategoryIcon
}
return ""
}
func (x *MoneyRecordItem) GetCategoryType() int32 {
if x != nil {
return x.CategoryType
}
return 0
}
type MoneyRecordGroup struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RecordTime string `protobuf:"bytes,1,opt,name=record_time,json=recordTime,proto3" form:"record_time" json:"record_time" query:"record_time"`
Expense string `protobuf:"bytes,2,opt,name=expense,proto3" form:"expense" json:"expense" query:"expense"`
Income string `protobuf:"bytes,3,opt,name=income,proto3" form:"income" json:"income" query:"income"`
Records []*MoneyRecordItem `protobuf:"bytes,4,rep,name=records,proto3" form:"records" json:"records" query:"records"`
}
func (x *MoneyRecordGroup) Reset() {
*x = MoneyRecordGroup{}
if protoimpl.UnsafeEnabled {
mi := &file_money_record_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MoneyRecordGroup) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoneyRecordGroup) ProtoMessage() {}
func (x *MoneyRecordGroup) ProtoReflect() protoreflect.Message {
mi := &file_money_record_proto_msgTypes[2]
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 MoneyRecordGroup.ProtoReflect.Descriptor instead.
func (*MoneyRecordGroup) Descriptor() ([]byte, []int) {
return file_money_record_proto_rawDescGZIP(), []int{2}
}
func (x *MoneyRecordGroup) GetRecordTime() string {
if x != nil {
return x.RecordTime
}
return ""
}
func (x *MoneyRecordGroup) GetExpense() string {
if x != nil {
return x.Expense
}
return ""
}
func (x *MoneyRecordGroup) GetIncome() string {
if x != nil {
return x.Income
}
return ""
}
func (x *MoneyRecordGroup) GetRecords() []*MoneyRecordItem {
if x != nil {
return x.Records
}
return nil
}
type QueryMoneyRecordsParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RecordTime string `protobuf:"bytes,1,opt,name=record_time,json=recordTime,proto3" form:"record_time" json:"record_time" query:"record_time"`
}
func (x *QueryMoneyRecordsParams) Reset() {
*x = QueryMoneyRecordsParams{}
if protoimpl.UnsafeEnabled {
mi := &file_money_record_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryMoneyRecordsParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryMoneyRecordsParams) ProtoMessage() {}
func (x *QueryMoneyRecordsParams) ProtoReflect() protoreflect.Message {
mi := &file_money_record_proto_msgTypes[3]
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 QueryMoneyRecordsParams.ProtoReflect.Descriptor instead.
func (*QueryMoneyRecordsParams) Descriptor() ([]byte, []int) {
return file_money_record_proto_rawDescGZIP(), []int{3}
}
func (x *QueryMoneyRecordsParams) GetRecordTime() string {
if x != nil {
return x.RecordTime
}
return ""
}
type QueryMoneyRecordsResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Records []*MoneyRecordGroup `protobuf:"bytes,1,rep,name=records,proto3" form:"records" json:"records" query:"records"`
TotalIncome string `protobuf:"bytes,2,opt,name=total_income,json=totalIncome,proto3" form:"total_income" json:"total_income" query:"total_income"`
TotalExpense string `protobuf:"bytes,3,opt,name=total_expense,json=totalExpense,proto3" form:"total_expense" json:"total_expense" query:"total_expense"`
}
func (x *QueryMoneyRecordsResult) Reset() {
*x = QueryMoneyRecordsResult{}
if protoimpl.UnsafeEnabled {
mi := &file_money_record_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryMoneyRecordsResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryMoneyRecordsResult) ProtoMessage() {}
func (x *QueryMoneyRecordsResult) ProtoReflect() protoreflect.Message {
mi := &file_money_record_proto_msgTypes[4]
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 QueryMoneyRecordsResult.ProtoReflect.Descriptor instead.
func (*QueryMoneyRecordsResult) Descriptor() ([]byte, []int) {
return file_money_record_proto_rawDescGZIP(), []int{4}
}
func (x *QueryMoneyRecordsResult) GetRecords() []*MoneyRecordGroup {
if x != nil {
return x.Records
}
return nil
}
func (x *QueryMoneyRecordsResult) GetTotalIncome() string {
if x != nil {
return x.TotalIncome
}
return ""
}
func (x *QueryMoneyRecordsResult) GetTotalExpense() string {
if x != nil {
return x.TotalExpense
}
return ""
}
var File_money_record_proto protoreflect.FileDescriptor
var file_money_record_proto_rawDesc = []byte{
0x0a, 0x12, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x1a, 0x09, 0x61, 0x70, 0x69,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2, 0x02, 0x0a, 0x0f, 0x4d, 0x6f, 0x6e, 0x65,
0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x61, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63,
0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07,
0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75,
0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a,
0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f,
0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d,
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xac, 0x01, 0x0a,
0x0f, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d,
0x12, 0x2a, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d,
0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x63,
0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f,
0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f,
0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63,
0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x97, 0x01, 0x0a, 0x10,
0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70,
0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x65, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69,
0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x63,
0x6f, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x04,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e,
0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x07, 0x72, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x3a, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f,
0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x22, 0x94, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79,
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x31, 0x0a,
0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17,
0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73,
0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x49, 0x6e, 0x63,
0x6f, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70,
0x65, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6f, 0x74, 0x61,
0x6c, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x32, 0x7b, 0x0a, 0x12, 0x4d, 0x6f, 0x6e, 0x65,
0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x65,
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, 0x11, 0xd2, 0xc1, 0x18, 0x0d, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x72,
0x65, 0x63, 0x6f, 0x72, 0x64, 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,
}
var (
file_money_record_proto_rawDescOnce sync.Once
file_money_record_proto_rawDescData = file_money_record_proto_rawDesc
)
func file_money_record_proto_rawDescGZIP() []byte {
file_money_record_proto_rawDescOnce.Do(func() {
file_money_record_proto_rawDescData = protoimpl.X.CompressGZIP(file_money_record_proto_rawDescData)
})
return file_money_record_proto_rawDescData
}
var file_money_record_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_money_record_proto_goTypes = []interface{}{
(*MoneyRecordBase)(nil), // 0: money.MoneyRecordBase
(*MoneyRecordItem)(nil), // 1: money.MoneyRecordItem
(*MoneyRecordGroup)(nil), // 2: money.MoneyRecordGroup
(*QueryMoneyRecordsParams)(nil), // 3: money.QueryMoneyRecordsParams
(*QueryMoneyRecordsResult)(nil), // 4: money.QueryMoneyRecordsResult
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
}
var file_money_record_proto_depIdxs = []int32{
5, // 0: money.MoneyRecordBase.record_time:type_name -> google.protobuf.Timestamp
5, // 1: money.MoneyRecordBase.create_time:type_name -> google.protobuf.Timestamp
5, // 2: money.MoneyRecordBase.update_time:type_name -> google.protobuf.Timestamp
0, // 3: money.MoneyRecordItem.base:type_name -> money.MoneyRecordBase
1, // 4: money.MoneyRecordGroup.records:type_name -> money.MoneyRecordItem
2, // 5: money.QueryMoneyRecordsResult.records:type_name -> money.MoneyRecordGroup
3, // 6: money.MoneyRecordService.QueryMoneyRecord:input_type -> money.QueryMoneyRecordsParams
4, // 7: money.MoneyRecordService.QueryMoneyRecord:output_type -> money.QueryMoneyRecordsResult
7, // [7:8] is the sub-list for method output_type
6, // [6:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_money_record_proto_init() }
func file_money_record_proto_init() {
if File_money_record_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_money_record_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MoneyRecordBase); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_record_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MoneyRecordItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_record_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MoneyRecordGroup); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_record_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryMoneyRecordsParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_record_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryMoneyRecordsResult); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_money_record_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_money_record_proto_goTypes,
DependencyIndexes: file_money_record_proto_depIdxs,
MessageInfos: file_money_record_proto_msgTypes,
}.Build()
File_money_record_proto = out.File
file_money_record_proto_rawDesc = nil
file_money_record_proto_goTypes = nil
file_money_record_proto_depIdxs = nil
}
@@ -1,444 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v4.25.3
// source: money_category.proto
package money_category
import (
_ "cn/oneao/base-go/biz/model/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type QueryUserMoneyCategoryReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *QueryUserMoneyCategoryReq) Reset() {
*x = QueryUserMoneyCategoryReq{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryUserMoneyCategoryReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryUserMoneyCategoryReq) ProtoMessage() {}
func (x *QueryUserMoneyCategoryReq) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[0]
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 QueryUserMoneyCategoryReq.ProtoReflect.Descriptor instead.
func (*QueryUserMoneyCategoryReq) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{0}
}
type UserMoneyCategory struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" form:"id" json:"id" query:"id"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" form:"name" json:"name" query:"name"`
Icon string `protobuf:"bytes,3,opt,name=icon,proto3" form:"icon" json:"icon" query:"icon"`
Type int32 `protobuf:"varint,4,opt,name=type,proto3" form:"type" json:"type" query:"type"`
SortNumber int32 `protobuf:"varint,5,opt,name=sort_number,json=sortNumber,proto3" form:"sort_number" json:"sort_number" query:"sort_number"`
}
func (x *UserMoneyCategory) Reset() {
*x = UserMoneyCategory{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserMoneyCategory) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserMoneyCategory) ProtoMessage() {}
func (x *UserMoneyCategory) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[1]
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 UserMoneyCategory.ProtoReflect.Descriptor instead.
func (*UserMoneyCategory) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{1}
}
func (x *UserMoneyCategory) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *UserMoneyCategory) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *UserMoneyCategory) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
func (x *UserMoneyCategory) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
func (x *UserMoneyCategory) GetSortNumber() int32 {
if x != nil {
return x.SortNumber
}
return 0
}
type QueryUserMoneyCategoryResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Categories []*UserMoneyCategory `protobuf:"bytes,1,rep,name=categories,proto3" form:"categories" json:"categories" query:"categories"`
}
func (x *QueryUserMoneyCategoryResp) Reset() {
*x = QueryUserMoneyCategoryResp{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryUserMoneyCategoryResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryUserMoneyCategoryResp) ProtoMessage() {}
func (x *QueryUserMoneyCategoryResp) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[2]
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 QueryUserMoneyCategoryResp.ProtoReflect.Descriptor instead.
func (*QueryUserMoneyCategoryResp) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{2}
}
func (x *QueryUserMoneyCategoryResp) GetCategories() []*UserMoneyCategory {
if x != nil {
return x.Categories
}
return nil
}
type DeleteUserMoneyCategoryReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id" vd:"$!=''"`
}
func (x *DeleteUserMoneyCategoryReq) Reset() {
*x = DeleteUserMoneyCategoryReq{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteUserMoneyCategoryReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteUserMoneyCategoryReq) ProtoMessage() {}
func (x *DeleteUserMoneyCategoryReq) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[3]
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 DeleteUserMoneyCategoryReq.ProtoReflect.Descriptor instead.
func (*DeleteUserMoneyCategoryReq) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{3}
}
func (x *DeleteUserMoneyCategoryReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type DeleteUserMoneyCategoryResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteUserMoneyCategoryResp) Reset() {
*x = DeleteUserMoneyCategoryResp{}
if protoimpl.UnsafeEnabled {
mi := &file_money_category_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteUserMoneyCategoryResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteUserMoneyCategoryResp) ProtoMessage() {}
func (x *DeleteUserMoneyCategoryResp) ProtoReflect() protoreflect.Message {
mi := &file_money_category_proto_msgTypes[4]
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 DeleteUserMoneyCategoryResp.ProtoReflect.Descriptor instead.
func (*DeleteUserMoneyCategoryResp) Descriptor() ([]byte, []int) {
return file_money_category_proto_rawDescGZIP(), []int{4}
}
var File_money_category_proto protoreflect.FileDescriptor
var file_money_category_proto_rawDesc = []byte{
0x0a, 0x14, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61,
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x1b, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f,
0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x22, 0x80,
0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65,
0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x22, 0x5f, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f,
0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12,
0x41, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65,
0x67, 0x6f, 0x72, 0x79, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61,
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69,
0x65, 0x73, 0x22, 0x3d, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71,
0x12, 0x1f, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb,
0x18, 0x02, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x05, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x52, 0x02, 0x49,
0x64, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4d,
0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70,
0x32, 0xae, 0x02, 0x0a, 0x14, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x84, 0x01, 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, 0x29, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74,
0x65, 0x67, 0x6f, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x4d,
0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a,
0x2a, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 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, 0x8e, 0x01, 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, 0x2a, 0x2e, 0x6d,
0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x2e, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74,
0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x2b, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79,
0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1a, 0xca, 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, 0x42, 0x2b, 0x5a, 0x29, 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, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_money_category_proto_rawDescOnce sync.Once
file_money_category_proto_rawDescData = file_money_category_proto_rawDesc
)
func file_money_category_proto_rawDescGZIP() []byte {
file_money_category_proto_rawDescOnce.Do(func() {
file_money_category_proto_rawDescData = protoimpl.X.CompressGZIP(file_money_category_proto_rawDescData)
})
return file_money_category_proto_rawDescData
}
var file_money_category_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_money_category_proto_goTypes = []interface{}{
(*QueryUserMoneyCategoryReq)(nil), // 0: money_category.QueryUserMoneyCategoryReq
(*UserMoneyCategory)(nil), // 1: money_category.UserMoneyCategory
(*QueryUserMoneyCategoryResp)(nil), // 2: money_category.QueryUserMoneyCategoryResp
(*DeleteUserMoneyCategoryReq)(nil), // 3: money_category.DeleteUserMoneyCategoryReq
(*DeleteUserMoneyCategoryResp)(nil), // 4: money_category.DeleteUserMoneyCategoryResp
}
var file_money_category_proto_depIdxs = []int32{
1, // 0: money_category.QueryUserMoneyCategoryResp.categories:type_name -> money_category.UserMoneyCategory
0, // 1: money_category.MoneyCategoryService.QueryUserMoneyCategory:input_type -> money_category.QueryUserMoneyCategoryReq
3, // 2: money_category.MoneyCategoryService.DeleteUserMoneyCategory:input_type -> money_category.DeleteUserMoneyCategoryReq
2, // 3: money_category.MoneyCategoryService.QueryUserMoneyCategory:output_type -> money_category.QueryUserMoneyCategoryResp
4, // 4: money_category.MoneyCategoryService.DeleteUserMoneyCategory:output_type -> money_category.DeleteUserMoneyCategoryResp
3, // [3:5] is the sub-list for method output_type
1, // [1:3] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_money_category_proto_init() }
func file_money_category_proto_init() {
if File_money_category_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_money_category_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryUserMoneyCategoryReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserMoneyCategory); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryUserMoneyCategoryResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUserMoneyCategoryReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_money_category_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUserMoneyCategoryResp); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_money_category_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_money_category_proto_goTypes,
DependencyIndexes: file_money_category_proto_depIdxs,
MessageInfos: file_money_category_proto_msgTypes,
}.Build()
File_money_category_proto = out.File
file_money_category_proto_rawDesc = nil
file_money_category_proto_goTypes = nil
file_money_category_proto_depIdxs = nil
}
@@ -5,6 +5,7 @@ import (
"cn/oneao/base-go/utils/pathx"
"cn/oneao/base-go/utils/response"
"context"
"github.com/cloudwego/hertz/pkg/app"
)
@@ -31,6 +32,7 @@ func Auth() app.HandlerFunc {
// 获取 token
token := string(c.GetHeader("token"))
if token == "" {
response.Fail(c).Code(response.HttpCode.Unauthorized).Send()
c.Abort()
@@ -1,6 +1,6 @@
// Code generated by hertz generator.
package money_category
package money
import (
"github.com/cloudwego/hertz/pkg/app"
@@ -30,3 +30,13 @@ func _deleteusermoneycategoryMw() []app.HandlerFunc {
// your code...
return nil
}
func _updatemoneycategorysortMw() []app.HandlerFunc {
// your code...
return nil
}
func _querymoneyrecordMw() []app.HandlerFunc {
// your code...
return nil
}
@@ -1,9 +1,9 @@
// Code generated by hertz generator. DO NOT EDIT.
package money_category
package money
import (
money_category "cn/oneao/base-go/biz/handler/money_category"
money "cn/oneao/base-go/biz/handler/money"
"github.com/cloudwego/hertz/pkg/app/server"
)
@@ -19,8 +19,9 @@ func Register(r *server.Hertz) {
root := r.Group("/", rootMw()...)
{
_money := root.Group("/money", _moneyMw()...)
_money.GET("/category", append(_queryusermoneycategoryMw(), money_category.QueryUserMoneyCategory)...)
_money.GET("/category", append(_queryusermoneycategoryMw(), money.QueryUserMoneyCategory)...)
_category := _money.Group("/category", _categoryMw()...)
_category.GET("/delete", append(_deleteusermoneycategoryMw(), money_category.DeleteUserMoneyCategory)...)
_category.POST("/delete", append(_deleteusermoneycategoryMw(), money.DeleteUserMoneyCategory)...)
_category.POST("/updateSort", append(_updatemoneycategorysortMw(), money.UpdateMoneyCategorySort)...)
}
}
@@ -0,0 +1,24 @@
// Code generated by hertz generator. DO NOT EDIT.
package money
import (
money "cn/oneao/base-go/biz/handler/money"
"github.com/cloudwego/hertz/pkg/app/server"
)
/*
This file will register all the routes of the services in the master idl.
And it will update automatically when you use the "update" command for the idl.
So don't modify the contents of the file, or your code will be deleted when it is updated.
*/
// Register register routes based on the IDL 'api.${HTTP Method}' annotation.
func Register(r *server.Hertz) {
root := r.Group("/", rootMw()...)
{
_money := root.Group("/money", _moneyMw()...)
_money.POST("/record", append(_querymoneyrecordMw(), money.QueryMoneyRecord)...)
}
}
@@ -4,14 +4,17 @@ package router
import (
auth "cn/oneao/base-go/biz/router/auth"
money_category "cn/oneao/base-go/biz/router/money_category"
money "cn/oneao/base-go/biz/router/money"
record "cn/oneao/base-go/biz/router/record"
"github.com/cloudwego/hertz/pkg/app/server"
)
// GeneratedRegister registers routers generated by IDL.
func GeneratedRegister(r *server.Hertz) {
//INSERT_POINT: DO NOT DELETE THIS LINE!
money_category.Register(r)
record.Register(r)
money.Register(r)
auth.Register(r)
}
+61 -5
View File
@@ -1,20 +1,25 @@
// db/db.go
package db
import (
"cn/oneao/base-go/conf"
sqlcg "cn/oneao/base-go/db/sqlc"
"cn/oneao/base-go/db/repo"
"context"
"fmt"
"github.com/jackc/pgx/v5/pgxpool"
"time"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
)
var (
DB *pgxpool.Pool
Queries *sqlcg.Queries
Queries *repo.Queries
)
type SQLCBatch interface {
Exec(func(int, error))
}
func InitDB() {
cfg := conf.GetConf().Pgsql
@@ -63,5 +68,56 @@ func InitDB() {
}
DB = pool
Queries = sqlcg.New(DB)
Queries = repo.New(DB)
}
// WithTx 执行事务,支持 panic 和 error 自动回滚
// 默认使用全局 DB,调用更简洁
func WithTx(ctx context.Context, fn func(q *repo.Queries) error) (err error) {
return WithTxPool(ctx, DB, fn)
}
// WithTxPool 支持自定义连接池
func WithTxPool(ctx context.Context, pool *pgxpool.Pool, fn func(q *repo.Queries) error) (err error) {
tx, err := pool.BeginTx(ctx, pgx.TxOptions{})
if err != nil {
return err
}
defer func() {
if p := recover(); p != nil {
// panic 时回滚事务
if rbErr := tx.Rollback(ctx); rbErr != nil {
fmt.Printf("rollback failed during panic: %v\n", rbErr)
}
panic(p)
} else if err != nil {
// 回滚事务,并捕获 rollback 错误
if rbErr := tx.Rollback(ctx); rbErr != nil {
err = fmt.Errorf("rollback failed: %v, original error: %w", rbErr, err)
}
} else {
// 提交事务,并捕获 commit 错误
if commitErr := tx.Commit(ctx); commitErr != nil {
err = fmt.Errorf("commit failed: %w", commitErr)
}
}
}()
q := Queries.WithTx(tx)
err = fn(q)
return err
}
// RunBatch 通用批处理执行器(适配所有 sqlc Batch)
func RunBatch(ctx context.Context, batch SQLCBatch) error {
var firstErr error
batch.Exec(func(i int, err error) {
if err != nil && firstErr == nil {
firstErr = err
}
})
return firstErr
}
@@ -0,0 +1,11 @@
-- name: FindUserMoneyRecords :many
SELECT
mr.*,
muc.name AS category_name,
muc.icon AS category_icon,
muc.type AS category_type
FROM money_record mr
LEFT JOIN money_user_category muc ON mr.category_id = muc.id
WHERE mr.user_id = $1
AND mr.record_time BETWEEN $2 AND $3
ORDER BY mr.record_time DESC, mr.create_time DESC;
@@ -10,3 +10,8 @@ WHERE user_id = $1;
-- name: DeleteUserMoneyCategoryById :exec
DELETE FROM money_user_category
WHERE id = $1;
-- name: BatchUpdateMoneyCategorySort :batchexec
UPDATE money_user_category
SET sort_number = $2
WHERE id = $1;
@@ -0,0 +1,68 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: batch.go
package repo
import (
"context"
"errors"
"github.com/jackc/pgx/v5"
)
var (
ErrBatchAlreadyClosed = errors.New("batch already closed")
)
const batchUpdateMoneyCategorySort = `-- name: BatchUpdateMoneyCategorySort :batchexec
UPDATE money_user_category
SET sort_number = $2
WHERE id = $1
`
type BatchUpdateMoneyCategorySortBatchResults struct {
br pgx.BatchResults
tot int
closed bool
}
type BatchUpdateMoneyCategorySortParams struct {
ID int64
SortNumber int32
}
func (q *Queries) BatchUpdateMoneyCategorySort(ctx context.Context, arg []BatchUpdateMoneyCategorySortParams) *BatchUpdateMoneyCategorySortBatchResults {
batch := &pgx.Batch{}
for _, a := range arg {
vals := []interface{}{
a.ID,
a.SortNumber,
}
batch.Queue(batchUpdateMoneyCategorySort, vals...)
}
br := q.db.SendBatch(ctx, batch)
return &BatchUpdateMoneyCategorySortBatchResults{br, len(arg), false}
}
func (b *BatchUpdateMoneyCategorySortBatchResults) Exec(f func(int, error)) {
defer b.br.Close()
for t := 0; t < b.tot; t++ {
if b.closed {
if f != nil {
f(t, ErrBatchAlreadyClosed)
}
continue
}
_, err := b.br.Exec()
if f != nil {
f(t, err)
}
}
}
func (b *BatchUpdateMoneyCategorySortBatchResults) Close() error {
b.closed = true
return b.br.Close()
}
@@ -3,7 +3,7 @@
// sqlc v1.30.0
// source: copyfrom.go
package dbtype
package repo
import (
"context"
@@ -2,7 +2,7 @@
// versions:
// sqlc v1.30.0
package dbtype
package repo
import (
"context"
@@ -16,6 +16,7 @@ type DBTX interface {
Query(context.Context, string, ...interface{}) (pgx.Rows, error)
QueryRow(context.Context, string, ...interface{}) pgx.Row
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
SendBatch(context.Context, *pgx.Batch) pgx.BatchResults
}
func New(db DBTX) *Queries {
@@ -2,7 +2,7 @@
// versions:
// sqlc v1.30.0
package dbtype
package repo
import (
"github.com/jackc/pgx/v5/pgtype"
@@ -23,8 +23,8 @@ type MoneySysCategory struct {
ID int64
Name string
Icon string
Type pgtype.Int4
SortNumber pgtype.Int4
Type int32
SortNumber int32
CreateTime pgtype.Timestamp
}
@@ -33,8 +33,8 @@ type MoneyUserCategory struct {
UserID int64
Name string
Icon string
Type pgtype.Int4
SortNumber pgtype.Int4
Type int32
SortNumber int32
CreateTime pgtype.Timestamp
}
@@ -0,0 +1,77 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: money_record.sql
package repo
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const findUserMoneyRecords = `-- name: FindUserMoneyRecords :many
SELECT
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
muc.name AS category_name,
muc.icon AS category_icon,
muc.type AS category_type
FROM money_record mr
LEFT JOIN money_user_category muc ON mr.category_id = muc.id
WHERE mr.user_id = $1
AND mr.record_time BETWEEN $2 AND $3
ORDER BY mr.record_time DESC, mr.create_time DESC
`
type FindUserMoneyRecordsParams struct {
UserID int64
RecordTime pgtype.Timestamp
RecordTime_2 pgtype.Timestamp
}
type FindUserMoneyRecordsRow struct {
ID int64
CategoryID int64
UserID int64
Amount pgtype.Numeric
Remark pgtype.Text
RecordTime pgtype.Timestamp
CreateTime pgtype.Timestamp
UpdateTime pgtype.Timestamp
CategoryName pgtype.Text
CategoryIcon pgtype.Text
CategoryType pgtype.Int4
}
func (q *Queries) FindUserMoneyRecords(ctx context.Context, arg FindUserMoneyRecordsParams) ([]FindUserMoneyRecordsRow, error) {
rows, err := q.db.Query(ctx, findUserMoneyRecords, arg.UserID, arg.RecordTime, arg.RecordTime_2)
if err != nil {
return nil, err
}
defer rows.Close()
var items []FindUserMoneyRecordsRow
for rows.Next() {
var i FindUserMoneyRecordsRow
if err := rows.Scan(
&i.ID,
&i.CategoryID,
&i.UserID,
&i.Amount,
&i.Remark,
&i.RecordTime,
&i.CreateTime,
&i.UpdateTime,
&i.CategoryName,
&i.CategoryIcon,
&i.CategoryType,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
@@ -3,7 +3,7 @@
// sqlc v1.30.0
// source: money_sys_category.sql
package dbtype
package repo
import (
"context"
@@ -3,12 +3,10 @@
// sqlc v1.30.0
// source: money_user_category.sql
package dbtype
package repo
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
type BatchInsertMoneyUserCategoriesParams struct {
@@ -16,8 +14,8 @@ type BatchInsertMoneyUserCategoriesParams struct {
UserID int64
Name string
Icon string
Type pgtype.Int4
SortNumber pgtype.Int4
Type int32
SortNumber int32
}
const deleteUserMoneyCategoryById = `-- name: DeleteUserMoneyCategoryById :exec
@@ -3,7 +3,7 @@
// sqlc v1.30.0
// source: user_info.sql
package dbtype
package repo
import (
"context"
+5 -5
View File
@@ -26,17 +26,17 @@ CREATE TABLE money_sys_category(
id BIGINT PRIMARY KEY ,
name VARCHAR(255) NOT NULL ,
icon VARCHAR(255) NOT NULL,
type INT DEFAULT 0,
sort_number INT DEFAULT 0,
type INT NOT NULL DEFAULT 0 ,
sort_number INT NOT NULL DEFAULT 0,
create_time timestamp DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE money_user_category(
id BIGINT PRIMARY KEY ,
user_id BIGINT NOT NULL,
name VARCHAR(255) NOT NULL ,
name VARCHAR(255) NOT NULL,
icon VARCHAR(255) NOT NULL,
type INT DEFAULT 0,
sort_number INT DEFAULT 0,
type INT NOT NULL DEFAULT 0,
sort_number INT NOT NULL DEFAULT 0,
create_time timestamp DEFAULT CURRENT_TIMESTAMP
)
+7 -6
View File
@@ -3,12 +3,13 @@ module cn/oneao/base-go
go 1.25.3
require (
entgo.io/ent v0.14.5
github.com/cloudwego/hertz v0.10.3
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/hertz-contrib/jwt v1.0.4
github.com/hertz-contrib/requestid v1.1.0
github.com/lib/pq v1.10.9
github.com/jackc/pgx/v5 v5.7.6
github.com/pkg/errors v0.9.1
github.com/spf13/viper v1.21.0
go.uber.org/zap v1.27.1
google.golang.org/protobuf v1.36.10
gopkg.in/natefinch/lumberjack.v2 v2.2.1
@@ -16,6 +17,7 @@ require (
require (
ariga.io/atlas v0.38.0 // indirect
entgo.io/ent v0.14.5 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
@@ -40,20 +42,19 @@ require (
github.com/hertz-contrib/logger/zap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.6 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/nyaruka/phonenumbers v1.6.7 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
+4
View File
@@ -132,6 +132,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
@@ -1,15 +1,15 @@
syntax = "proto3";
package money_category;
package money;
option go_package = "money_category";
option go_package = "money";
import "api.proto";
message QueryUserMoneyCategoryReq{}
message UserMoneyCategory {
message QueryMoneyCategoryReq{}
message MoneyCategory {
int64 id = 1;
string name = 2;
string icon = 3;
@@ -17,23 +17,37 @@ message UserMoneyCategory {
int32 sort_number = 5;
}
message QueryUserMoneyCategoryResp {
repeated UserMoneyCategory categories = 1;
message QueryMoneyCategoryResp {
repeated MoneyCategory categories = 1;
}
message DeleteUserMoneyCategoryReq{
int64 Id = 1[(api.body)="id",(api.vd)="$!=''"];
message DeleteMoneyCategoryReq{
int64 Id = 1[(api.body)="id",(api.vd)="$ != 0"];
}
message DeleteUserMoneyCategoryResp {
message DeleteMoneyCategoryResp {
}
message MoneyCategorySortItem {
int64 id = 1;
int32 sort_number = 2;
}
message UpdateMoneyCategorySortReq {
repeated MoneyCategorySortItem data = 1;
}
message UpdateMoneyCategorySortResp {}
service MoneyCategoryService {
rpc QueryUserMoneyCategory(QueryUserMoneyCategoryReq) returns (QueryUserMoneyCategoryResp){
rpc QueryUserMoneyCategory(QueryMoneyCategoryReq) returns (QueryMoneyCategoryResp){
option (api.get) = '/money/category';
};
rpc DeleteUserMoneyCategory(DeleteUserMoneyCategoryReq) returns (DeleteUserMoneyCategoryResp){
option (api.get) = '/money/category/delete';
rpc DeleteUserMoneyCategory(DeleteMoneyCategoryReq) returns (DeleteMoneyCategoryResp){
option (api.post) = '/money/category/delete';
};
rpc UpdateMoneyCategorySort(UpdateMoneyCategorySortReq) returns (UpdateMoneyCategorySortResp){
option (api.post) = '/money/category/updateSort';
};
}
@@ -0,0 +1,53 @@
syntax = "proto3";
package money;
option go_package = "money";
import "api.proto";
import "google/protobuf/timestamp.proto";
message MoneyRecordBase {
int64 id = 1;
int64 category_id = 2;
int64 user_id = 3;
string amount = 4;
string remark = 5;
google.protobuf.Timestamp record_time = 6;
google.protobuf.Timestamp create_time = 7;
google.protobuf.Timestamp update_time = 8;
}
message MoneyRecordItem {
MoneyRecordBase base = 1;
string category_name = 2;
string category_icon = 3;
int32 category_type = 4;
}
message MoneyRecordGroup {
string record_time = 1;
string expense = 2;
string income = 3;
repeated MoneyRecordItem records = 4;
}
message QueryMoneyRecordsParams {
string record_time = 1;
}
message QueryMoneyRecordsResult {
repeated MoneyRecordGroup records = 1;
string total_income = 2;
string total_expense = 3;
}
service MoneyRecordService {
rpc QueryMoneyRecord(QueryMoneyRecordsParams) returns (QueryMoneyRecordsResult){
option (api.post) = '/money/record';
}
}
+1
View File
@@ -7,6 +7,7 @@ import (
"cn/oneao/base-go/logx"
"cn/oneao/base-go/utils/idgen"
"cn/oneao/base-go/utils/jwtx"
"github.com/cloudwego/hertz/pkg/app/server"
"github.com/hertz-contrib/requestid"
)
+2 -2
View File
@@ -5,6 +5,6 @@ sql:
schema: "db/schema.sql" # schema.sql文件的路径,该文件主要用于存储DDL
gen:
go:
package: "dbtype" # 模块的包名
out: "db/sqlc" # 代码生成路径
package: "repo" # 模块的包名
out: "db/repo" # 代码生成路径
sql_package: "pgx/v5"