// 库存预警历史服务 // 职责:预警历史查询、删除(无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) }