Files
service/erp/request/cost.go
kanade 57d6339bee feat(cost): 修改成本添加接口返回结构
- 添加 ReplyCostAdd 结构体定义,包含 CostId 字段
- 修改 Add 方法返回值,从无返回改为返回 ReplyCostAdd 结构
- 更新方法实现以正确处理新返回结构
- 保持原有的客户端调用逻辑不变
2026-03-04 14:47:49 +08:00

100 lines
2.3 KiB
Go

package request
import (
"context"
"time"
"git.kumo.work/shama/service/client"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
)
type cost struct {
}
type ArgsCostList struct {
Page bean.Page
Search CostSearch
}
type CostSearch struct {
RequestId int64 // 报销单ID
}
type ReplyCostList struct {
List []CostItem `json:"list"`
Total int64 `json:"total"`
}
type CostItem struct {
Id int64 `json:"id"`
RequestId int64 `json:"requestId"`
TypeNumber string `json:"typeNumber"`
TypeName string `json:"typeName"`
Amount decimal.Decimal `json:"amount"`
DepartmentId int64 `json:"departmentId"`
InvoiceSerial string `json:"invoiceSerial"`
Remarks string `json:"remarks"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (c *cost) List(ctx context.Context, args ArgsCostList) (reply ReplyCostList, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsCostAdd struct {
RequestId int64 // 报销单ID
TypeNumber string // 费用类型
TypeName string // 费用类型名称
Amount decimal.Decimal // 金额
DepartmentId int64 // 部门
Remarks string // 备注
InvoiceSerial string // 发票号
}
type ReplyCostAdd struct {
CostId int64 `json:"costId"`
}
// Add @TITLE 添加
func (c *cost) Add(ctx context.Context, args ArgsCostAdd) (reply ReplyCostAdd, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsCostEdit struct {
CostId int64
ArgsCostAdd
}
// Edit @TITLE 编辑
func (c *cost) Edit(ctx context.Context, args ArgsCostEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsCostDelete struct {
RequestId int64 // 报销单ID
CostIds []int64
}
// Delete @TITLE 删除
func (c *cost) Delete(ctx context.Context, args ArgsCostDelete) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", args, &reply)
}