uint/uint64全部改为uint32
This commit is contained in:
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
// PigBatchLogListOptions 定义了查询猪批次日志时的可选参数
|
||||
type PigBatchLogListOptions struct {
|
||||
PigBatchID *uint
|
||||
PigBatchID *uint32
|
||||
ChangeType *models.LogChangeType
|
||||
OperatorID *uint
|
||||
OperatorID *uint32
|
||||
StartTime *time.Time // 基于 happened_at 字段
|
||||
EndTime *time.Time // 基于 happened_at 字段
|
||||
OrderBy string // 例如 "happened_at asc"
|
||||
@@ -26,10 +26,10 @@ type PigBatchLogRepository interface {
|
||||
CreateTx(ctx context.Context, tx *gorm.DB, log *models.PigBatchLog) error
|
||||
|
||||
// GetLogsByBatchIDAndDateRangeTx 在指定的事务中,获取指定批次在特定时间范围内的所有日志记录。
|
||||
GetLogsByBatchIDAndDateRangeTx(ctx context.Context, tx *gorm.DB, batchID uint, startDate, endDate time.Time) ([]*models.PigBatchLog, error)
|
||||
GetLogsByBatchIDAndDateRangeTx(ctx context.Context, tx *gorm.DB, batchID uint32, startDate, endDate time.Time) ([]*models.PigBatchLog, error)
|
||||
|
||||
// GetLastLogByBatchIDTx 在指定的事务中,获取某批次的最后一条日志记录。
|
||||
GetLastLogByBatchIDTx(ctx context.Context, tx *gorm.DB, batchID uint) (*models.PigBatchLog, error)
|
||||
GetLastLogByBatchIDTx(ctx context.Context, tx *gorm.DB, batchID uint32) (*models.PigBatchLog, error)
|
||||
|
||||
// List 支持分页和过滤的列表查询
|
||||
List(ctx context.Context, opts PigBatchLogListOptions, page, pageSize int) ([]models.PigBatchLog, int64, error)
|
||||
@@ -53,7 +53,7 @@ func (r *gormPigBatchLogRepository) CreateTx(ctx context.Context, tx *gorm.DB, l
|
||||
}
|
||||
|
||||
// GetLogsByBatchIDAndDateRangeTx 实现了在指定的事务中,获取指定批次在特定时间范围内的所有日志记录的逻辑。
|
||||
func (r *gormPigBatchLogRepository) GetLogsByBatchIDAndDateRangeTx(ctx context.Context, tx *gorm.DB, batchID uint, startDate, endDate time.Time) ([]*models.PigBatchLog, error) {
|
||||
func (r *gormPigBatchLogRepository) GetLogsByBatchIDAndDateRangeTx(ctx context.Context, tx *gorm.DB, batchID uint32, startDate, endDate time.Time) ([]*models.PigBatchLog, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "GetLogsByBatchIDAndDateRangeTx")
|
||||
var logs []*models.PigBatchLog
|
||||
err := tx.WithContext(repoCtx).Where("pig_batch_id = ? AND created_at >= ? AND created_at <= ?", batchID, startDate, endDate).Find(&logs).Error
|
||||
@@ -64,7 +64,7 @@ func (r *gormPigBatchLogRepository) GetLogsByBatchIDAndDateRangeTx(ctx context.C
|
||||
}
|
||||
|
||||
// GetLastLogByBatchIDTx 实现了在指定的事务中,获取某批次的最后一条日志记录的逻辑。
|
||||
func (r *gormPigBatchLogRepository) GetLastLogByBatchIDTx(ctx context.Context, tx *gorm.DB, batchID uint) (*models.PigBatchLog, error) {
|
||||
func (r *gormPigBatchLogRepository) GetLastLogByBatchIDTx(ctx context.Context, tx *gorm.DB, batchID uint32) (*models.PigBatchLog, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "GetLastLogByBatchIDTx")
|
||||
var log models.PigBatchLog
|
||||
err := tx.WithContext(repoCtx).Where("pig_batch_id = ?", batchID).Order("id DESC").First(&log).Error
|
||||
|
||||
Reference in New Issue
Block a user