u
This commit is contained in:
1 parent
d9c49b34db
commit
d33cef825a
36 files changed
+753
-1077
No files matched your search
@@ -69,7 +69,24 @@ func DeleteUserMoneyCategory(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
err = db.Queries.DeleteMoneyCategoryById(ctx, req.Id)
|
||||
userID := middleware.GetUserID(ctx)
|
||||
categoryId := req.Id
|
||||
|
||||
err = db.WithTx(ctx, func(q *repo.Queries) error {
|
||||
err2 := q.DeleteMoneyCategoryById(ctx, categoryId)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
err2 = q.DeleteMoneyRecordByCategoryId(ctx, repo.DeleteMoneyRecordByCategoryIdParams{
|
||||
UserID: userID,
|
||||
CategoryID: categoryId,
|
||||
})
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
errorx.AddError(c, err)
|
||||
|
||||
@@ -12,101 +12,66 @@ import (
|
||||
"allapp/utils/response"
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
money "allapp/biz/model/money"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
// QueryMoneyRecord .
|
||||
// @router /money/record/query [POST]
|
||||
func QueryMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
||||
var req money.QueryMoneyRecordsParams
|
||||
// ListMoneyRecords 账目列表
|
||||
// @router /money/record/list [POST]
|
||||
func ListMoneyRecords(ctx context.Context, c *app.RequestContext) {
|
||||
var req money.ListMoneyRecordsParams
|
||||
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 和 spaceID
|
||||
//userID := middleware.GetUserID(ctx)
|
||||
//spaceIspaceID := middleware.GetSpaceID(ctx)
|
||||
//
|
||||
//// 定义统一的 records 切片
|
||||
//var dbRecordsUser []repo.MoneyRecord
|
||||
//var dbRecordsSpace []repo.FindMoneyRecordsBySpaceRow
|
||||
//var errQuery error
|
||||
//
|
||||
//// 最终返回统一类型
|
||||
//var records []*money.MoneyRecord
|
||||
//
|
||||
//// 有空间ID,查询空间内所有用户
|
||||
//if ok {
|
||||
// params := repo.FindMoneyRecordsBySpaceParams{
|
||||
// SpaceID: spaceID,
|
||||
// RecordTime: pgtype.Date{Time: startTime, Valid: true},
|
||||
// RecordTime_2: pgtype.Date{Time: endTime, Valid: true},
|
||||
// }
|
||||
// dbRecordsSpace, errQuery = db.Queries.FindMoneyRecordsBySpace(ctx, params)
|
||||
// if errQuery != nil {
|
||||
// errorx.AddError(c, errQuery)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// for _, r := range dbRecordsSpace {
|
||||
// records = append(records, &money.MoneyRecord{
|
||||
// Id: r.ID,
|
||||
// CategoryId: r.CategoryID,
|
||||
// UserId: r.UserID,
|
||||
// Username: r.Username.String,
|
||||
// Amount: pgtypex.NumericToString(r.Amount),
|
||||
// Remark: r.Remark.String,
|
||||
// RecordTime: pgtypex.DateToString(r.RecordTime),
|
||||
// CreateTime: pgtypex.TimestampToMillis(r.CreateTime),
|
||||
// UpdateTime: pgtypex.TimestampToMillis(r.UpdateTime),
|
||||
// })
|
||||
// }
|
||||
//} else {
|
||||
// // 没有空间ID,只查询单用户
|
||||
// params := repo.FindUserMoneyRecordsParams{
|
||||
// UserID: userID,
|
||||
// RecordTime: pgtype.Date{Time: startTime, Valid: true},
|
||||
// RecordTime_2: pgtype.Date{Time: endTime, Valid: true},
|
||||
// }
|
||||
// dbRecordsUser, errQuery = db.Queries.FindUserMoneyRecords(ctx, params)
|
||||
// if errQuery != nil {
|
||||
// errorx.AddError(c, errQuery)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// for _, r := range dbRecordsUser {
|
||||
// records = append(records, &money.MoneyRecord{
|
||||
// Id: r.ID,
|
||||
// CategoryId: r.CategoryID,
|
||||
// UserId: r.UserID,
|
||||
// Username: "",
|
||||
// Amount: pgtypex.NumericToString(r.Amount),
|
||||
// Remark: r.Remark.String,
|
||||
// RecordTime: pgtypex.DateToString(r.RecordTime),
|
||||
// CreateTime: pgtypex.TimestampToMillis(r.CreateTime),
|
||||
// UpdateTime: pgtypex.TimestampToMillis(r.UpdateTime),
|
||||
// })
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//result := &money.QueryMoneyRecordsResult{
|
||||
// Records: records,
|
||||
//}
|
||||
// 解析年月(yyyy-MM)
|
||||
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)
|
||||
|
||||
response.Success(c).Send()
|
||||
userID := middleware.GetUserID(ctx)
|
||||
|
||||
// 查询账目列表(统一 SQL)
|
||||
dbRecords, err := db.Queries.ListMoneyRecords(
|
||||
ctx,
|
||||
repo.ListMoneyRecordsParams{
|
||||
UserID: userID,
|
||||
RecordTime: pgtype.Date{Time: startTime, Valid: true},
|
||||
RecordTime_2: pgtype.Date{Time: endTime, Valid: true},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
errorx.AddError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
records := make([]*money.MoneyRecord, 0, len(dbRecords))
|
||||
for _, r := range dbRecords {
|
||||
records = append(records, &money.MoneyRecord{
|
||||
Id: r.ID,
|
||||
CategoryId: r.CategoryID,
|
||||
UserId: r.UserID,
|
||||
Username: r.Username.String,
|
||||
Amount: pgtypex.NumericToString(r.Amount),
|
||||
Remark: r.Remark.String,
|
||||
RecordTime: pgtypex.DateToString(r.RecordTime),
|
||||
CreateTime: pgtypex.TimestampToMillis(r.CreateTime),
|
||||
UpdateTime: pgtypex.TimestampToMillis(r.UpdateTime),
|
||||
})
|
||||
}
|
||||
|
||||
response.Success(c).Data(&money.ListMoneyRecordsResult{
|
||||
Records: records,
|
||||
}).Send()
|
||||
}
|
||||
|
||||
// InsertMoneyRecord .
|
||||
@@ -122,8 +87,6 @@ func InsertMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := new(money.InsertMoneyRecordResult)
|
||||
|
||||
params := repo.InsertMoneyRecordParams{
|
||||
ID: idgen.NextId(),
|
||||
CategoryID: req.CategoryId,
|
||||
@@ -133,22 +96,14 @@ func InsertMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
||||
RecordTime: pgtypex.StringToDate(req.RecordTime),
|
||||
}
|
||||
|
||||
record, err := db.Queries.InsertMoneyRecord(ctx, params)
|
||||
err = db.Queries.InsertMoneyRecord(ctx, params)
|
||||
|
||||
if err != nil {
|
||||
errorx.AddError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp.Id = record.ID
|
||||
resp.CategoryId = record.CategoryID
|
||||
resp.UserId = record.UserID
|
||||
resp.Amount = pgtypex.NumericToString(record.Amount)
|
||||
resp.Remark = record.Remark.String
|
||||
resp.RecordTime = pgtypex.DateToString(record.RecordTime)
|
||||
resp.CreateTime = pgtypex.TimestampToDateTimeString(record.CreateTime)
|
||||
resp.UpdateTime = pgtypex.TimestampToDateTimeString(record.UpdateTime)
|
||||
response.Success(c).Data(resp).Message("新增成功").Send()
|
||||
response.Success(c).Message("新增成功").Send()
|
||||
}
|
||||
|
||||
// UpdateMoneyRecord .
|
||||
|
||||
@@ -34,7 +34,7 @@ func GetUserSpace(ctx context.Context, c *app.RequestContext) {
|
||||
|
||||
if err != nil {
|
||||
if errorx.IsNotFound(err) {
|
||||
response.Success(c).Data(resp).Send()
|
||||
response.Success(c).Data(nil).Send()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
_ "allapp/biz/model/api"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
_ "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
@@ -30,76 +29,74 @@ 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, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xcb,
|
||||
0x04, 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,
|
||||
0x6f, 0x32, 0xcb, 0x04, 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, 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, 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, 0x12, 0x70, 0x0a, 0x13, 0x55, 0x70,
|
||||
0x64, 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, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71,
|
||||
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, 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, 0x12, 0x70, 0x0a,
|
||||
0x13, 0x55, 0x70, 0x64, 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, 0x55, 0x70, 0x64,
|
||||
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, 0x55, 0x70, 0x64, 0x61,
|
||||
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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x32,
|
||||
0xc7, 0x03, 0x0a, 0x12, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f,
|
||||
0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x1d, 0x2e, 0x6d, 0x6f, 0x6e,
|
||||
0x65, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
|
||||
0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x6d, 0x6f, 0x6e, 0x65,
|
||||
0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x12, 0xd2, 0xc1, 0x18, 0x0e, 0x2f, 0x6d,
|
||||
0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 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, 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, 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, 0x75, 0x70, 0x64, 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,
|
||||
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, 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,
|
||||
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{}{
|
||||
@@ -108,7 +105,7 @@ var file_money_proto_goTypes = []interface{}{
|
||||
(*UpdateMoneyCategorySortReq)(nil), // 2: money.UpdateMoneyCategorySortReq
|
||||
(*CreateMoneyCategoryReq)(nil), // 3: money.CreateMoneyCategoryReq
|
||||
(*UpdateMoneyCategoryReq)(nil), // 4: money.UpdateMoneyCategoryReq
|
||||
(*QueryMoneyRecordsParams)(nil), // 5: money.QueryMoneyRecordsParams
|
||||
(*ListMoneyRecordsParams)(nil), // 5: money.ListMoneyRecordsParams
|
||||
(*InsertMoneyRecordParams)(nil), // 6: money.InsertMoneyRecordParams
|
||||
(*UpdateMoneyRecordParams)(nil), // 7: money.UpdateMoneyRecordParams
|
||||
(*DeleteMoneyRecordParams)(nil), // 8: money.DeleteMoneyRecordParams
|
||||
@@ -117,7 +114,7 @@ var file_money_proto_goTypes = []interface{}{
|
||||
(*UpdateMoneyCategorySortResp)(nil), // 11: money.UpdateMoneyCategorySortResp
|
||||
(*CreateMoneyCategoryResp)(nil), // 12: money.CreateMoneyCategoryResp
|
||||
(*UpdateMoneyCategoryResp)(nil), // 13: money.UpdateMoneyCategoryResp
|
||||
(*QueryMoneyRecordsResult)(nil), // 14: money.QueryMoneyRecordsResult
|
||||
(*ListMoneyRecordsResult)(nil), // 14: money.ListMoneyRecordsResult
|
||||
(*InsertMoneyRecordResult)(nil), // 15: money.InsertMoneyRecordResult
|
||||
(*UpdateMoneyRecordResult)(nil), // 16: money.UpdateMoneyRecordResult
|
||||
(*DeleteMoneyRecordResult)(nil), // 17: money.DeleteMoneyRecordResult
|
||||
@@ -128,7 +125,7 @@ var file_money_proto_depIdxs = []int32{
|
||||
2, // 2: money.MoneyCategoryService.UpdateMoneyCategorySort:input_type -> money.UpdateMoneyCategorySortReq
|
||||
3, // 3: money.MoneyCategoryService.CreateMoneyCategory:input_type -> money.CreateMoneyCategoryReq
|
||||
4, // 4: money.MoneyCategoryService.UpdateMoneyCategory:input_type -> money.UpdateMoneyCategoryReq
|
||||
5, // 5: money.MoneyRecordService.QueryMoneyRecord:input_type -> money.QueryMoneyRecordsParams
|
||||
5, // 5: money.MoneyRecordService.ListMoneyRecords:input_type -> money.ListMoneyRecordsParams
|
||||
6, // 6: money.MoneyRecordService.InsertMoneyRecord:input_type -> money.InsertMoneyRecordParams
|
||||
7, // 7: money.MoneyRecordService.UpdateMoneyRecord:input_type -> money.UpdateMoneyRecordParams
|
||||
8, // 8: money.MoneyRecordService.DeleteMoneyRecord:input_type -> money.DeleteMoneyRecordParams
|
||||
@@ -137,7 +134,7 @@ var file_money_proto_depIdxs = []int32{
|
||||
11, // 11: money.MoneyCategoryService.UpdateMoneyCategorySort:output_type -> money.UpdateMoneyCategorySortResp
|
||||
12, // 12: money.MoneyCategoryService.CreateMoneyCategory:output_type -> money.CreateMoneyCategoryResp
|
||||
13, // 13: money.MoneyCategoryService.UpdateMoneyCategory:output_type -> money.UpdateMoneyCategoryResp
|
||||
14, // 14: money.MoneyRecordService.QueryMoneyRecord:output_type -> money.QueryMoneyRecordsResult
|
||||
14, // 14: money.MoneyRecordService.ListMoneyRecords:output_type -> money.ListMoneyRecordsResult
|
||||
15, // 15: money.MoneyRecordService.InsertMoneyRecord:output_type -> money.InsertMoneyRecordResult
|
||||
16, // 16: money.MoneyRecordService.UpdateMoneyRecord:output_type -> money.UpdateMoneyRecordResult
|
||||
17, // 17: money.MoneyRecordService.DeleteMoneyRecord:output_type -> money.DeleteMoneyRecordResult
|
||||
|
||||
@@ -134,7 +134,7 @@ func (x *MoneyRecord) GetUsername() string {
|
||||
}
|
||||
|
||||
// 查询记账记录请求参数
|
||||
type QueryMoneyRecordsParams struct {
|
||||
type ListMoneyRecordsParams struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@@ -142,8 +142,8 @@ type QueryMoneyRecordsParams struct {
|
||||
RecordTime string `protobuf:"bytes,1,opt,name=RecordTime,proto3" form:"record_time" json:"record_time"`
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsParams) Reset() {
|
||||
*x = QueryMoneyRecordsParams{}
|
||||
func (x *ListMoneyRecordsParams) Reset() {
|
||||
*x = ListMoneyRecordsParams{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_money_money_record_types_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -151,13 +151,13 @@ func (x *QueryMoneyRecordsParams) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsParams) String() string {
|
||||
func (x *ListMoneyRecordsParams) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryMoneyRecordsParams) ProtoMessage() {}
|
||||
func (*ListMoneyRecordsParams) ProtoMessage() {}
|
||||
|
||||
func (x *QueryMoneyRecordsParams) ProtoReflect() protoreflect.Message {
|
||||
func (x *ListMoneyRecordsParams) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_money_money_record_types_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -169,12 +169,12 @@ func (x *QueryMoneyRecordsParams) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryMoneyRecordsParams.ProtoReflect.Descriptor instead.
|
||||
func (*QueryMoneyRecordsParams) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ListMoneyRecordsParams.ProtoReflect.Descriptor instead.
|
||||
func (*ListMoneyRecordsParams) Descriptor() ([]byte, []int) {
|
||||
return file_money_money_record_types_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsParams) GetRecordTime() string {
|
||||
func (x *ListMoneyRecordsParams) GetRecordTime() string {
|
||||
if x != nil {
|
||||
return x.RecordTime
|
||||
}
|
||||
@@ -182,7 +182,7 @@ func (x *QueryMoneyRecordsParams) GetRecordTime() string {
|
||||
}
|
||||
|
||||
// 查询记账记录结果
|
||||
type QueryMoneyRecordsResult struct {
|
||||
type ListMoneyRecordsResult struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@@ -190,8 +190,8 @@ type QueryMoneyRecordsResult struct {
|
||||
Records []*MoneyRecord `protobuf:"bytes,1,rep,name=Records,proto3" form:"records" json:"records"`
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsResult) Reset() {
|
||||
*x = QueryMoneyRecordsResult{}
|
||||
func (x *ListMoneyRecordsResult) Reset() {
|
||||
*x = ListMoneyRecordsResult{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_money_money_record_types_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -199,13 +199,13 @@ func (x *QueryMoneyRecordsResult) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsResult) String() string {
|
||||
func (x *ListMoneyRecordsResult) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryMoneyRecordsResult) ProtoMessage() {}
|
||||
func (*ListMoneyRecordsResult) ProtoMessage() {}
|
||||
|
||||
func (x *QueryMoneyRecordsResult) ProtoReflect() protoreflect.Message {
|
||||
func (x *ListMoneyRecordsResult) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_money_money_record_types_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -217,12 +217,12 @@ func (x *QueryMoneyRecordsResult) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryMoneyRecordsResult.ProtoReflect.Descriptor instead.
|
||||
func (*QueryMoneyRecordsResult) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ListMoneyRecordsResult.ProtoReflect.Descriptor instead.
|
||||
func (*ListMoneyRecordsResult) Descriptor() ([]byte, []int) {
|
||||
return file_money_money_record_types_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *QueryMoneyRecordsResult) GetRecords() []*MoneyRecord {
|
||||
func (x *ListMoneyRecordsResult) GetRecords() []*MoneyRecord {
|
||||
if x != nil {
|
||||
return x.Records
|
||||
}
|
||||
@@ -306,15 +306,6 @@ type InsertMoneyRecordResult struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
|
||||
CategoryId int64 `protobuf:"varint,2,opt,name=CategoryId,proto3" form:"category_id" json:"category_id"`
|
||||
UserId int64 `protobuf:"varint,3,opt,name=UserId,proto3" form:"user_id" json:"user_id"`
|
||||
Amount string `protobuf:"bytes,4,opt,name=Amount,proto3" form:"amount" json:"amount"`
|
||||
Remark string `protobuf:"bytes,5,opt,name=Remark,proto3" form:"remark" json:"remark"`
|
||||
RecordTime string `protobuf:"bytes,6,opt,name=RecordTime,proto3" form:"record_time" json:"record_time"`
|
||||
CreateTime string `protobuf:"bytes,7,opt,name=CreateTime,proto3" form:"create_time" json:"create_time"`
|
||||
UpdateTime string `protobuf:"bytes,8,opt,name=UpdateTime,proto3" form:"update_time" json:"update_time"`
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) Reset() {
|
||||
@@ -349,62 +340,6 @@ func (*InsertMoneyRecordResult) Descriptor() ([]byte, []int) {
|
||||
return file_money_money_record_types_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetCategoryId() int64 {
|
||||
if x != nil {
|
||||
return x.CategoryId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetAmount() string {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetRemark() string {
|
||||
if x != nil {
|
||||
return x.Remark
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetRecordTime() string {
|
||||
if x != nil {
|
||||
return x.RecordTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetCreateTime() string {
|
||||
if x != nil {
|
||||
return x.CreateTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *InsertMoneyRecordResult) GetUpdateTime() string {
|
||||
if x != nil {
|
||||
return x.UpdateTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 更新记账记录
|
||||
type UpdateMoneyRecordParams struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -639,81 +574,60 @@ var file_money_money_record_types_proto_rawDesc = []byte{
|
||||
0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x08, 0x55,
|
||||
0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xca,
|
||||
0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55, 0x73, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4a, 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, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x22, 0x54, 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, 0x39, 0x0a, 0x07,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||
0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x65,
|
||||
0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 0x12, 0x38, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x18, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74,
|
||||
0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x05, 0x24, 0x21, 0x3d, 0x27,
|
||||
0x27, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x4d, 0x0a,
|
||||
0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0xca,
|
||||
0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0xda, 0xbb, 0x18, 0x27, 0x24, 0x21, 0x3d,
|
||||
0x27, 0x27, 0x20, 0x26, 0x26, 0x20, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c,
|
||||
0x64, 0x2b, 0x28, 0x5c, 0x2e, 0x5c, 0x64, 0x7b, 0x31, 0x2c, 0x32, 0x7d, 0x29, 0x3f, 0x24, 0x27,
|
||||
0x2c, 0x20, 0x24, 0x29, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06,
|
||||
0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb,
|
||||
0x18, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b,
|
||||
0x12, 0x5c, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x3c, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0xda, 0xbb, 0x18, 0x29, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26,
|
||||
0x26, 0x20, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x7b, 0x34, 0x7d,
|
||||
0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d, 0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d, 0x24, 0x27, 0x2c, 0x20,
|
||||
0x24, 0x29, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe2,
|
||||
0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65,
|
||||
0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
||||
0x79, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
|
||||
0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06,
|
||||
0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb,
|
||||
0x18, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b,
|
||||
0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x75, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x22, 0xe3, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f,
|
||||
0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 0x12,
|
||||
0x2f, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
||||
0x79, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64,
|
||||
0x12, 0x22, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x06, 0x41, 0x6d,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b,
|
||||
0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f,
|
||||
0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb,
|
||||
0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52,
|
||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
|
||||
0x73, 0x75, 0x6c, 0x74, 0x22, 0x39, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f,
|
||||
0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 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,
|
||||
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x49, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e,
|
||||
0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12,
|
||||
0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x22, 0x53, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63,
|
||||
0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6f,
|
||||
0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42,
|
||||
0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74,
|
||||
0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x73, 0x12, 0x38, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x18, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67,
|
||||
0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x05, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x52,
|
||||
0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x4d, 0x0a, 0x06, 0x41,
|
||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0xca, 0xbb, 0x18,
|
||||
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0xda, 0xbb, 0x18, 0x27, 0x24, 0x21, 0x3d, 0x27, 0x27,
|
||||
0x20, 0x26, 0x26, 0x20, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x2b,
|
||||
0x28, 0x5c, 0x2e, 0x5c, 0x64, 0x7b, 0x31, 0x2c, 0x32, 0x7d, 0x29, 0x3f, 0x24, 0x27, 0x2c, 0x20,
|
||||
0x24, 0x29, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65,
|
||||
0x6d, 0x61, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06,
|
||||
0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x5c,
|
||||
0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x42, 0x3c, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74,
|
||||
0x69, 0x6d, 0x65, 0xda, 0xbb, 0x18, 0x29, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26, 0x26, 0x20,
|
||||
0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x7b, 0x34, 0x7d, 0x2d, 0x5c,
|
||||
0x64, 0x7b, 0x32, 0x7d, 0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d, 0x24, 0x27, 0x2c, 0x20, 0x24, 0x29,
|
||||
0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a, 0x17,
|
||||
0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xe3, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 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, 0x12, 0x2f, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74,
|
||||
0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||
0x72, 0x79, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61,
|
||||
0x72, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65,
|
||||
0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a,
|
||||
0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
|
||||
0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x39, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 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, 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 (
|
||||
@@ -731,8 +645,8 @@ func file_money_money_record_types_proto_rawDescGZIP() []byte {
|
||||
var file_money_money_record_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_money_money_record_types_proto_goTypes = []interface{}{
|
||||
(*MoneyRecord)(nil), // 0: money.MoneyRecord
|
||||
(*QueryMoneyRecordsParams)(nil), // 1: money.QueryMoneyRecordsParams
|
||||
(*QueryMoneyRecordsResult)(nil), // 2: money.QueryMoneyRecordsResult
|
||||
(*ListMoneyRecordsParams)(nil), // 1: money.ListMoneyRecordsParams
|
||||
(*ListMoneyRecordsResult)(nil), // 2: money.ListMoneyRecordsResult
|
||||
(*InsertMoneyRecordParams)(nil), // 3: money.InsertMoneyRecordParams
|
||||
(*InsertMoneyRecordResult)(nil), // 4: money.InsertMoneyRecordResult
|
||||
(*UpdateMoneyRecordParams)(nil), // 5: money.UpdateMoneyRecordParams
|
||||
@@ -741,7 +655,7 @@ var file_money_money_record_types_proto_goTypes = []interface{}{
|
||||
(*DeleteMoneyRecordResult)(nil), // 8: money.DeleteMoneyRecordResult
|
||||
}
|
||||
var file_money_money_record_types_proto_depIdxs = []int32{
|
||||
0, // 0: money.QueryMoneyRecordsResult.Records:type_name -> money.MoneyRecord
|
||||
0, // 0: money.ListMoneyRecordsResult.Records:type_name -> money.MoneyRecord
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
@@ -768,7 +682,7 @@ func file_money_money_record_types_proto_init() {
|
||||
}
|
||||
}
|
||||
file_money_money_record_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QueryMoneyRecordsParams); i {
|
||||
switch v := v.(*ListMoneyRecordsParams); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -780,7 +694,7 @@ func file_money_money_record_types_proto_init() {
|
||||
}
|
||||
}
|
||||
file_money_money_record_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QueryMoneyRecordsResult); i {
|
||||
switch v := v.(*ListMoneyRecordsResult); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"allapp/db"
|
||||
"allapp/logx"
|
||||
"context"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
)
|
||||
|
||||
@@ -18,10 +19,12 @@ func RefreshActive() app.HandlerFunc {
|
||||
}
|
||||
|
||||
// 异步刷新活跃时间
|
||||
go func() {
|
||||
if err := db.Queries.UpdateUserActiveTime(c, userID); err != nil {
|
||||
logx.CtxError(c, "刷新用户活跃时间失败, userID=%d, err=%v", userID, err)
|
||||
go func(userID int64) {
|
||||
ctx := context.Background()
|
||||
|
||||
if err := db.Queries.UpdateUserLastLoginTime(ctx, userID); err != nil {
|
||||
logx.CtxError(ctx, "刷新用户活跃时间失败, userID=%d, err=%v", userID, err)
|
||||
}
|
||||
}()
|
||||
}(userID)
|
||||
}
|
||||
}
|
||||
@@ -75,3 +75,8 @@ func _updatemoneycategoryMw() []app.HandlerFunc {
|
||||
// your code...
|
||||
return nil
|
||||
}
|
||||
|
||||
func _listmoneyrecordsMw() []app.HandlerFunc {
|
||||
// your code...
|
||||
return nil
|
||||
}
|
||||
@@ -25,11 +25,11 @@ func Register(r *server.Hertz) {
|
||||
_category.POST("/delete", append(_deleteusermoneycategoryMw(), money.DeleteUserMoneyCategory)...)
|
||||
_category.POST("/update", append(_updatemoneycategoryMw(), money.UpdateMoneyCategory)...)
|
||||
_category.POST("/updateSort", append(_updatemoneycategorysortMw(), money.UpdateMoneyCategorySort)...)
|
||||
_money.POST("/records", append(_listmoneyrecordsMw(), money.ListMoneyRecords)...)
|
||||
{
|
||||
_record := _money.Group("/record", _recordMw()...)
|
||||
_record.POST("/delete", append(_deletemoneyrecordMw(), money.DeleteMoneyRecord)...)
|
||||
_record.POST("/insert", append(_insertmoneyrecordMw(), money.InsertMoneyRecord)...)
|
||||
_record.POST("/query", append(_querymoneyrecordMw(), money.QueryMoneyRecord)...)
|
||||
_record.POST("/update", append(_updatemoneyrecordMw(), money.UpdateMoneyRecord)...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
-- name: FindUserMoneyRecords :many
|
||||
SELECT mr.*
|
||||
FROM money_record mr
|
||||
WHERE mr.user_id = $1
|
||||
AND mr.record_time BETWEEN $2 AND $3
|
||||
ORDER BY mr.record_time DESC, mr.create_time DESC;
|
||||
|
||||
-- name: FindMoneyRecordsBySpace :many
|
||||
-- name: ListMoneyRecords :many
|
||||
SELECT
|
||||
mr.*,
|
||||
u.username AS username
|
||||
FROM money_record mr
|
||||
INNER JOIN space_user su
|
||||
ON mr.user_id = su.user_id
|
||||
AND su.space_id = $1
|
||||
LEFT JOIN user_info u
|
||||
ON mr.user_id = u.id
|
||||
WHERE mr.record_time BETWEEN $2 AND $3
|
||||
ORDER BY mr.record_time DESC, mr.create_time DESC;
|
||||
LEFT JOIN space_user su
|
||||
ON su.user_id = mr.user_id
|
||||
LEFT JOIN "user" u
|
||||
ON u.id = mr.user_id
|
||||
WHERE
|
||||
mr.record_time BETWEEN $2 AND $3
|
||||
AND (
|
||||
-- 空间账本:属于当前空间的用户
|
||||
su.user_id IS NOT NULL
|
||||
-- 个人账本:当前用户
|
||||
OR mr.user_id = $1
|
||||
)
|
||||
ORDER BY
|
||||
mr.record_time DESC,
|
||||
mr.create_time DESC;
|
||||
|
||||
|
||||
-- name: InsertMoneyRecord :one
|
||||
-- name: InsertMoneyRecord :exec
|
||||
INSERT INTO money_record (
|
||||
id,
|
||||
category_id,
|
||||
@@ -31,8 +32,7 @@ INSERT INTO money_record (
|
||||
update_time
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5,$6,NOW(),NOW()
|
||||
)
|
||||
RETURNING *;
|
||||
);
|
||||
|
||||
-- name: GetMoneyRecordById :one
|
||||
SELECT * FROM money_record WHERE id = $1;
|
||||
@@ -49,4 +49,7 @@ WHERE id = $1
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteMoneyRecord :exec
|
||||
DELETE FROM money_record WHERE id = $1;
|
||||
DELETE FROM money_record WHERE id = $1;
|
||||
|
||||
-- name: DeleteMoneyRecordByCategoryId :exec
|
||||
DELETE FROM money_record WHERE user_id = $1 AND category_id = $2;
|
||||
@@ -1,30 +0,0 @@
|
||||
-- 根据 ID 查询单条用户记录
|
||||
-- name: GetUserById :one
|
||||
SELECT *
|
||||
FROM user_info
|
||||
WHERE id = $1;
|
||||
|
||||
-- 根据账号查询单条用户记录
|
||||
-- name: GetUserByAccount :one
|
||||
SELECT *
|
||||
FROM user_info
|
||||
WHERE account = $1;
|
||||
|
||||
-- 根据账号和密码查询单条用户记录(登录用)
|
||||
-- name: GetUserForLogin :one
|
||||
SELECT *
|
||||
FROM user_info
|
||||
WHERE account = $1
|
||||
AND password = $2;
|
||||
|
||||
-- 更新用户最后登录时间,并返回更新后的记录
|
||||
-- name: UpdateUserLoginLastTime :exec
|
||||
UPDATE user_info
|
||||
SET last_login_time = now()
|
||||
WHERE id = $1;
|
||||
|
||||
-- 更新用户活跃时间
|
||||
-- name: UpdateUserActiveTime :exec
|
||||
UPDATE user_info
|
||||
SET active_time = now()
|
||||
WHERE id = $1;
|
||||
@@ -20,109 +20,18 @@ func (q *Queries) DeleteMoneyRecord(ctx context.Context, id int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const findMoneyRecordsBySpace = `-- name: FindMoneyRecordsBySpace :many
|
||||
SELECT
|
||||
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
|
||||
u.username AS username
|
||||
FROM money_record mr
|
||||
INNER JOIN space_user su
|
||||
ON mr.user_id = su.user_id
|
||||
AND su.space_id = $1
|
||||
LEFT JOIN user_info u
|
||||
ON mr.user_id = u.id
|
||||
WHERE mr.record_time BETWEEN $2 AND $3
|
||||
ORDER BY mr.record_time DESC, mr.create_time DESC
|
||||
const deleteMoneyRecordByCategoryId = `-- name: DeleteMoneyRecordByCategoryId :exec
|
||||
DELETE FROM money_record WHERE user_id = $1 AND category_id = $2
|
||||
`
|
||||
|
||||
type FindMoneyRecordsBySpaceParams struct {
|
||||
SpaceID int64
|
||||
RecordTime pgtype.Date
|
||||
RecordTime_2 pgtype.Date
|
||||
}
|
||||
|
||||
type FindMoneyRecordsBySpaceRow struct {
|
||||
ID int64
|
||||
CategoryID int64
|
||||
type DeleteMoneyRecordByCategoryIdParams struct {
|
||||
UserID int64
|
||||
Amount pgtype.Numeric
|
||||
Remark pgtype.Text
|
||||
RecordTime pgtype.Date
|
||||
CreateTime pgtype.Timestamp
|
||||
UpdateTime pgtype.Timestamp
|
||||
Username pgtype.Text
|
||||
CategoryID int64
|
||||
}
|
||||
|
||||
func (q *Queries) FindMoneyRecordsBySpace(ctx context.Context, arg FindMoneyRecordsBySpaceParams) ([]FindMoneyRecordsBySpaceRow, error) {
|
||||
rows, err := q.db.Query(ctx, findMoneyRecordsBySpace, arg.SpaceID, arg.RecordTime, arg.RecordTime_2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []FindMoneyRecordsBySpaceRow
|
||||
for rows.Next() {
|
||||
var i FindMoneyRecordsBySpaceRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.CategoryID,
|
||||
&i.UserID,
|
||||
&i.Amount,
|
||||
&i.Remark,
|
||||
&i.RecordTime,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
&i.Username,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
FROM money_record mr
|
||||
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.Date
|
||||
RecordTime_2 pgtype.Date
|
||||
}
|
||||
|
||||
func (q *Queries) FindUserMoneyRecords(ctx context.Context, arg FindUserMoneyRecordsParams) ([]MoneyRecord, 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 []MoneyRecord
|
||||
for rows.Next() {
|
||||
var i MoneyRecord
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.CategoryID,
|
||||
&i.UserID,
|
||||
&i.Amount,
|
||||
&i.Remark,
|
||||
&i.RecordTime,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
func (q *Queries) DeleteMoneyRecordByCategoryId(ctx context.Context, arg DeleteMoneyRecordByCategoryIdParams) error {
|
||||
_, err := q.db.Exec(ctx, deleteMoneyRecordByCategoryId, arg.UserID, arg.CategoryID)
|
||||
return err
|
||||
}
|
||||
|
||||
const getMoneyRecordById = `-- name: GetMoneyRecordById :one
|
||||
@@ -145,7 +54,7 @@ func (q *Queries) GetMoneyRecordById(ctx context.Context, id int64) (MoneyRecord
|
||||
return i, err
|
||||
}
|
||||
|
||||
const insertMoneyRecord = `-- name: InsertMoneyRecord :one
|
||||
const insertMoneyRecord = `-- name: InsertMoneyRecord :exec
|
||||
INSERT INTO money_record (
|
||||
id,
|
||||
category_id,
|
||||
@@ -158,7 +67,6 @@ INSERT INTO money_record (
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5,$6,NOW(),NOW()
|
||||
)
|
||||
RETURNING id, category_id, user_id, amount, remark, record_time, create_time, update_time
|
||||
`
|
||||
|
||||
type InsertMoneyRecordParams struct {
|
||||
@@ -170,8 +78,8 @@ type InsertMoneyRecordParams struct {
|
||||
RecordTime pgtype.Date
|
||||
}
|
||||
|
||||
func (q *Queries) InsertMoneyRecord(ctx context.Context, arg InsertMoneyRecordParams) (MoneyRecord, error) {
|
||||
row := q.db.QueryRow(ctx, insertMoneyRecord,
|
||||
func (q *Queries) InsertMoneyRecord(ctx context.Context, arg InsertMoneyRecordParams) error {
|
||||
_, err := q.db.Exec(ctx, insertMoneyRecord,
|
||||
arg.ID,
|
||||
arg.CategoryID,
|
||||
arg.UserID,
|
||||
@@ -179,18 +87,77 @@ func (q *Queries) InsertMoneyRecord(ctx context.Context, arg InsertMoneyRecordPa
|
||||
arg.Remark,
|
||||
arg.RecordTime,
|
||||
)
|
||||
var i MoneyRecord
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.CategoryID,
|
||||
&i.UserID,
|
||||
&i.Amount,
|
||||
&i.Remark,
|
||||
&i.RecordTime,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
)
|
||||
return i, err
|
||||
return err
|
||||
}
|
||||
|
||||
const listMoneyRecords = `-- name: ListMoneyRecords :many
|
||||
SELECT
|
||||
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
|
||||
u.username AS username
|
||||
FROM money_record mr
|
||||
LEFT JOIN space_user su
|
||||
ON su.user_id = mr.user_id
|
||||
LEFT JOIN "user" u
|
||||
ON u.id = mr.user_id
|
||||
WHERE
|
||||
mr.record_time BETWEEN $2 AND $3
|
||||
AND (
|
||||
-- 空间账本:属于当前空间的用户
|
||||
su.user_id IS NOT NULL
|
||||
-- 个人账本:当前用户
|
||||
OR mr.user_id = $1
|
||||
)
|
||||
ORDER BY
|
||||
mr.record_time DESC,
|
||||
mr.create_time DESC
|
||||
`
|
||||
|
||||
type ListMoneyRecordsParams struct {
|
||||
UserID int64
|
||||
RecordTime pgtype.Date
|
||||
RecordTime_2 pgtype.Date
|
||||
}
|
||||
|
||||
type ListMoneyRecordsRow struct {
|
||||
ID int64
|
||||
CategoryID int64
|
||||
UserID int64
|
||||
Amount pgtype.Numeric
|
||||
Remark pgtype.Text
|
||||
RecordTime pgtype.Date
|
||||
CreateTime pgtype.Timestamp
|
||||
UpdateTime pgtype.Timestamp
|
||||
Username pgtype.Text
|
||||
}
|
||||
|
||||
func (q *Queries) ListMoneyRecords(ctx context.Context, arg ListMoneyRecordsParams) ([]ListMoneyRecordsRow, error) {
|
||||
rows, err := q.db.Query(ctx, listMoneyRecords, arg.UserID, arg.RecordTime, arg.RecordTime_2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListMoneyRecordsRow
|
||||
for rows.Next() {
|
||||
var i ListMoneyRecordsRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.CategoryID,
|
||||
&i.UserID,
|
||||
&i.Amount,
|
||||
&i.Remark,
|
||||
&i.RecordTime,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
&i.Username,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const updateMoneyRecord = `-- name: UpdateMoneyRecord :exec
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// source: user_info.sql
|
||||
|
||||
package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const getUserByAccount = `-- name: GetUserByAccount :one
|
||||
SELECT id, seq_no, account, password, email, username, gender, create_time, update_time, active_time, last_login_time
|
||||
FROM user_info
|
||||
WHERE account = $1
|
||||
`
|
||||
|
||||
// 根据账号查询单条用户记录
|
||||
func (q *Queries) GetUserByAccount(ctx context.Context, account string) (UserInfo, error) {
|
||||
row := q.db.QueryRow(ctx, getUserByAccount, account)
|
||||
var i UserInfo
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SeqNo,
|
||||
&i.Account,
|
||||
&i.Password,
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.Gender,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
&i.ActiveTime,
|
||||
&i.LastLoginTime,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserById = `-- name: GetUserById :one
|
||||
SELECT id, seq_no, account, password, email, username, gender, create_time, update_time, active_time, last_login_time
|
||||
FROM user_info
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
// 根据 ID 查询单条用户记录
|
||||
func (q *Queries) GetUserById(ctx context.Context, id int64) (UserInfo, error) {
|
||||
row := q.db.QueryRow(ctx, getUserById, id)
|
||||
var i UserInfo
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SeqNo,
|
||||
&i.Account,
|
||||
&i.Password,
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.Gender,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
&i.ActiveTime,
|
||||
&i.LastLoginTime,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserForLogin = `-- name: GetUserForLogin :one
|
||||
SELECT id, seq_no, account, password, email, username, gender, create_time, update_time, active_time, last_login_time
|
||||
FROM user_info
|
||||
WHERE account = $1
|
||||
AND password = $2
|
||||
`
|
||||
|
||||
type GetUserForLoginParams struct {
|
||||
Account string
|
||||
Password string
|
||||
}
|
||||
|
||||
// 根据账号和密码查询单条用户记录(登录用)
|
||||
func (q *Queries) GetUserForLogin(ctx context.Context, arg GetUserForLoginParams) (UserInfo, error) {
|
||||
row := q.db.QueryRow(ctx, getUserForLogin, arg.Account, arg.Password)
|
||||
var i UserInfo
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SeqNo,
|
||||
&i.Account,
|
||||
&i.Password,
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.Gender,
|
||||
&i.CreateTime,
|
||||
&i.UpdateTime,
|
||||
&i.ActiveTime,
|
||||
&i.LastLoginTime,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateUserActiveTime = `-- name: UpdateUserActiveTime :exec
|
||||
UPDATE user_info
|
||||
SET active_time = now()
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
// 更新用户活跃时间
|
||||
func (q *Queries) UpdateUserActiveTime(ctx context.Context, id int64) error {
|
||||
_, err := q.db.Exec(ctx, updateUserActiveTime, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateUserLoginLastTime = `-- name: UpdateUserLoginLastTime :exec
|
||||
UPDATE user_info
|
||||
SET last_login_time = now()
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
// 更新用户最后登录时间,并返回更新后的记录
|
||||
func (q *Queries) UpdateUserLoginLastTime(ctx context.Context, id int64) error {
|
||||
_, err := q.db.Exec(ctx, updateUserLoginLastTime, id)
|
||||
return err
|
||||
}
|
||||
@@ -7,7 +7,6 @@ option go_package = "money";
|
||||
import "api.proto";
|
||||
import "money/money_category_types.proto";
|
||||
import "money/money_record_types.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
service MoneyCategoryService {
|
||||
rpc List(ListMoneyCategoryReq) returns (ListMoneyCategoryResp){
|
||||
@@ -28,8 +27,8 @@ service MoneyCategoryService {
|
||||
}
|
||||
|
||||
service MoneyRecordService {
|
||||
rpc QueryMoneyRecord(QueryMoneyRecordsParams) returns (QueryMoneyRecordsResult){
|
||||
option (api.post) = '/money/record/query';
|
||||
rpc ListMoneyRecords(ListMoneyRecordsParams) returns (ListMoneyRecordsResult){
|
||||
option (api.post) = '/money/records';
|
||||
}
|
||||
rpc InsertMoneyRecord(InsertMoneyRecordParams) returns (InsertMoneyRecordResult){
|
||||
option (api.post) = '/money/record/insert';
|
||||
|
||||
@@ -64,15 +64,15 @@ message CreateMoneyCategoryResp {
|
||||
message UpdateMoneyCategoryReq {
|
||||
int64 Id = 1[
|
||||
(api.body)="id"
|
||||
];;
|
||||
];
|
||||
string Name = 2 [
|
||||
(api.body)="name",
|
||||
(api.vd) = "$ != ''"
|
||||
];;
|
||||
];
|
||||
string Icon = 3 [
|
||||
(api.body)="icon",
|
||||
(api.vd) = "$ != ''"
|
||||
];;
|
||||
];
|
||||
}
|
||||
|
||||
message UpdateMoneyCategoryResp {}
|
||||
@@ -19,14 +19,13 @@ message MoneyRecord {
|
||||
string Username = 9 [(api.body)="username"];
|
||||
}
|
||||
|
||||
|
||||
// 查询记账记录请求参数
|
||||
message QueryMoneyRecordsParams {
|
||||
message ListMoneyRecordsParams {
|
||||
string RecordTime = 1 [(api.body)="record_time"];
|
||||
}
|
||||
|
||||
// 查询记账记录结果
|
||||
message QueryMoneyRecordsResult {
|
||||
message ListMoneyRecordsResult {
|
||||
repeated MoneyRecord Records = 1 [(api.body)="records"];
|
||||
}
|
||||
|
||||
@@ -46,14 +45,7 @@ message InsertMoneyRecordParams {
|
||||
|
||||
// 新增记账记录结果
|
||||
message InsertMoneyRecordResult {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
int64 CategoryId = 2 [(api.body)="category_id"];
|
||||
int64 UserId = 3 [(api.body)="user_id"];
|
||||
string Amount = 4 [(api.body)="amount"];
|
||||
string Remark = 5 [(api.body)="remark"];
|
||||
string RecordTime = 6 [(api.body)="record_time"];
|
||||
string CreateTime = 7 [(api.body)="create_time"];
|
||||
string UpdateTime = 8 [(api.body)="update_time"];
|
||||
|
||||
}
|
||||
|
||||
// 更新记账记录
|
||||
|
||||
Reference in new issue
Block a user