Dockerfile
This commit is contained in:
55
service/stock/inventory_count_adjust_history_service.go
Normal file
55
service/stock/inventory_count_adjust_history_service.go
Normal file
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user