Files
assets/service/stock/inventory_warning_history_service.go

43 lines
1.3 KiB
Go
Raw Permalink Normal View History

2026-03-18 10:18:03 +08:00
// 库存预警历史服务
// 职责:预警历史查询、删除(无Create/Update由预警状态变更时自动归档)
// 紧密耦合dao.InventoryWarningHistory
// 注意:历史记录由系统自动归档,非用户手动创建
package service
import (
dao "assets/dao/stock"
dto "assets/model/dto/stock"
"context"
"gitea.com/red-future/common/utils"
)
type inventoryWarningHistory struct{}
var InventoryWarningHistory = new(inventoryWarningHistory)
func (s *inventoryWarningHistory) GetOne(ctx context.Context, req *dto.GetInventoryWarningHistoryReq) (res *dto.GetInventoryWarningHistoryRes, err error) {
one, err := dao.InventoryWarningHistory.GetOne(ctx, req)
if err != nil {
return
}
err = utils.Struct(one, &res)
return
}
func (s *inventoryWarningHistory) List(ctx context.Context, req *dto.ListInventoryWarningHistoryReq) (res *dto.ListInventoryWarningHistoryRes, err error) {
list, total, err := dao.InventoryWarningHistory.List(ctx, req)
if err != nil {
return
}
res = &dto.ListInventoryWarningHistoryRes{
Total: total,
}
err = utils.Struct(list, &res.List)
return
}
func (s *inventoryWarningHistory) Delete(ctx context.Context, req *dto.DeleteInventoryWarningHistoryReq) error {
return dao.InventoryWarningHistory.DeleteFake(ctx, req)
}