76 lines
1.6 KiB
Go
76 lines
1.6 KiB
Go
|
package accounting
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.kumo.work/shama/service/client"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type remark struct {
|
||
|
}
|
||
|
|
||
|
type RemarkItem struct {
|
||
|
Id int64 `json:"id"`
|
||
|
FactoryId int64 `json:"factoryId"`
|
||
|
FactoryName string `json:"factoryName"`
|
||
|
FactoryShortName string `json:"factoryShortName"`
|
||
|
Remarks string `json:"remarks"`
|
||
|
CreatedAt *time.Time `json:"createdAt"`
|
||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||
|
}
|
||
|
|
||
|
// All @TITLE 获取备注
|
||
|
func (r *remark) All(ctx context.Context, accountingId int64) (reply []RemarkItem, err error) {
|
||
|
xClient, err := client.GetClient(r)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
err = xClient.Call(ctx, "All", accountingId, &reply)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
type ArgsRemarkAdd struct {
|
||
|
AccountingId int64 // 做账合同ID
|
||
|
RemarkAdd
|
||
|
}
|
||
|
|
||
|
type RemarkAdd struct {
|
||
|
FactoryId int64 // 工厂id
|
||
|
Remarks string // 备注信息
|
||
|
}
|
||
|
|
||
|
// Add @TITLE 添加备注
|
||
|
func (r *remark) Add(ctx context.Context, args ArgsRemarkAdd) (err error) {
|
||
|
xClient, err := client.GetClient(r)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||
|
}
|
||
|
|
||
|
type ArgsRemarkEdit struct {
|
||
|
RemarkId int64 // 备注ID
|
||
|
RemarkAdd
|
||
|
}
|
||
|
|
||
|
// Edit @TITLE 编辑备注
|
||
|
func (r *remark) Edit(ctx context.Context, args ArgsRemarkEdit) (err error) {
|
||
|
xClient, err := client.GetClient(r)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||
|
}
|
||
|
|
||
|
// Delete @TITLE 删除备注
|
||
|
func (r *remark) Delete(ctx context.Context, remarkIds []int64) (err error) {
|
||
|
xClient, err := client.GetClient(r)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Delete", remarkIds, &reply)
|
||
|
}
|