更新
This commit is contained in:
75
erp/purchase/clause.go
Normal file
75
erp/purchase/clause.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package purchase
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.kumo.work/shama/service/client"
|
||||
"time"
|
||||
)
|
||||
|
||||
type clause struct {
|
||||
}
|
||||
|
||||
type ClauseItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Sort int64 `json:"sort"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// All @TITLE 获取条款
|
||||
func (c *clause) All(ctx context.Context, purchaseId int64) (reply []ClauseItem, err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "All", purchaseId, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsClauseAdd struct {
|
||||
PurchaseId int64 // 采购合同ID
|
||||
ClauseAdd
|
||||
}
|
||||
|
||||
type ClauseAdd struct {
|
||||
Sort int64 // 排序
|
||||
Key string // 项目
|
||||
Value string // 内容
|
||||
}
|
||||
|
||||
// Add @TITLE 添加条款
|
||||
func (c *clause) Add(ctx context.Context, args ArgsClauseAdd) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
return xClient.Call(ctx, "Add", args, &reply)
|
||||
}
|
||||
|
||||
type ArgsClauseEdit struct {
|
||||
ClauseId int64 // 条款ID
|
||||
ClauseAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑条款
|
||||
func (c *clause) Edit(ctx context.Context, args ArgsClauseEdit) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
return xClient.Call(ctx, "Edit", args, &reply)
|
||||
}
|
||||
|
||||
// Delete @TITLE 删除条款
|
||||
func (c *clause) Delete(ctx context.Context, clauseIds []int64) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
return xClient.Call(ctx, "Delete", clauseIds, &reply)
|
||||
}
|
||||
Reference in New Issue
Block a user