Files
assets/service/stock/inventory_count_adjust_history_service.go

56 lines
1.7 KiB
Go
Raw Permalink Normal View History

2026-03-18 10:18:03 +08:00
package service
import (
dao "assets/dao/stock"
dto "assets/model/dto/stock"
"context"
"gitea.com/red-future/common/utils"
"go.mongodb.org/mongo-driver/v2/bson"
)
type inventoryCountAdjustHistory struct{}
var InventoryCountAdjustHistory = new(inventoryCountAdjustHistory)
// Create 创建盘点调整历史记录
func (s *inventoryCountAdjustHistory) Create(ctx context.Context, req *dto.CreateInventoryCountAdjustHistoryReq) (res *dto.CreateInventoryCountAdjustHistoryRes, err error) {
ids, err := dao.InventoryCountAdjustHistory.Insert(ctx, req)
if err != nil {
return
}
id := ids[0].(bson.ObjectID)
res = &dto.CreateInventoryCountAdjustHistoryRes{
Id: &id,
}
return
}
// Delete 删除盘点调整历史记录
func (s *inventoryCountAdjustHistory) Delete(ctx context.Context, req *dto.DeleteInventoryCountAdjustHistoryReq) error {
return dao.InventoryCountAdjustHistory.DeleteFake(ctx, req)
}
// GetOne 查询单条盘点调整历史记录详情
func (s *inventoryCountAdjustHistory) GetOne(ctx context.Context, req *dto.GetInventoryCountAdjustHistoryReq) (res *dto.GetInventoryCountAdjustHistoryRes, err error) {
one, err := dao.InventoryCountAdjustHistory.GetOne(ctx, req)
if err != nil {
return
}
err = utils.Struct(one, &res)
return
}
// List 分页查询盘点调整历史列表
func (s *inventoryCountAdjustHistory) List(ctx context.Context, req *dto.ListInventoryCountAdjustHistoryReq) (res *dto.ListInventoryCountAdjustHistoryRes, err error) {
list, total, err := dao.InventoryCountAdjustHistory.List(ctx, req)
if err != nil {
return
}
res = &dto.ListInventoryCountAdjustHistoryRes{
Total: total,
}
err = utils.Struct(list, &res.List)
return
}