uint/uint64全部改为uint32
This commit is contained in:
@@ -14,13 +14,13 @@ import (
|
||||
type PigBatchRepository interface {
|
||||
CreatePigBatch(ctx context.Context, batch *models.PigBatch) (*models.PigBatch, error)
|
||||
CreatePigBatchTx(ctx context.Context, tx *gorm.DB, batch *models.PigBatch) (*models.PigBatch, error)
|
||||
GetPigBatchByID(ctx context.Context, id uint) (*models.PigBatch, error)
|
||||
GetPigBatchByIDTx(ctx context.Context, tx *gorm.DB, id uint) (*models.PigBatch, error)
|
||||
GetPigBatchByID(ctx context.Context, id uint32) (*models.PigBatch, error)
|
||||
GetPigBatchByIDTx(ctx context.Context, tx *gorm.DB, id uint32) (*models.PigBatch, error)
|
||||
// UpdatePigBatch 更新一个猪批次,返回更新后的批次、受影响的行数和错误
|
||||
UpdatePigBatch(ctx context.Context, batch *models.PigBatch) (*models.PigBatch, int64, error)
|
||||
// DeletePigBatch 根据ID删除一个猪批次,返回受影响的行数和错误
|
||||
DeletePigBatch(ctx context.Context, id uint) (int64, error)
|
||||
DeletePigBatchTx(ctx context.Context, tx *gorm.DB, id uint) (int64, error)
|
||||
DeletePigBatch(ctx context.Context, id uint32) (int64, error)
|
||||
DeletePigBatchTx(ctx context.Context, tx *gorm.DB, id uint32) (int64, error)
|
||||
ListPigBatches(ctx context.Context, isActive *bool) ([]*models.PigBatch, error)
|
||||
|
||||
// ListWeighingBatches 支持分页和过滤的批次称重列表查询
|
||||
@@ -32,7 +32,7 @@ type PigBatchRepository interface {
|
||||
|
||||
// WeighingBatchListOptions 定义了查询批次称重记录时的可选参数
|
||||
type WeighingBatchListOptions struct {
|
||||
PigBatchID *uint
|
||||
PigBatchID *uint32
|
||||
StartTime *time.Time // 基于 weighing_time 字段
|
||||
EndTime *time.Time // 基于 weighing_time 字段
|
||||
OrderBy string // 例如 "weighing_time asc"
|
||||
@@ -40,9 +40,9 @@ type WeighingBatchListOptions struct {
|
||||
|
||||
// WeighingRecordListOptions 定义了查询单次称重记录时的可选参数
|
||||
type WeighingRecordListOptions struct {
|
||||
WeighingBatchID *uint
|
||||
PenID *uint
|
||||
OperatorID *uint
|
||||
WeighingBatchID *uint32
|
||||
PenID *uint32
|
||||
OperatorID *uint32
|
||||
StartTime *time.Time // 基于 weighing_time 字段
|
||||
EndTime *time.Time // 基于 weighing_time 字段
|
||||
OrderBy string // 例如 "weighing_time asc"
|
||||
@@ -75,7 +75,7 @@ func (r *gormPigBatchRepository) CreatePigBatchTx(ctx context.Context, tx *gorm.
|
||||
}
|
||||
|
||||
// GetPigBatchByID 根据ID获取单个猪批次
|
||||
func (r *gormPigBatchRepository) GetPigBatchByID(ctx context.Context, id uint) (*models.PigBatch, error) {
|
||||
func (r *gormPigBatchRepository) GetPigBatchByID(ctx context.Context, id uint32) (*models.PigBatch, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "GetPigBatchByID")
|
||||
return r.GetPigBatchByIDTx(repoCtx, r.db, id)
|
||||
}
|
||||
@@ -92,12 +92,12 @@ func (r *gormPigBatchRepository) UpdatePigBatch(ctx context.Context, batch *mode
|
||||
}
|
||||
|
||||
// DeletePigBatch 根据ID删除一个猪批次 (GORM 会执行软删除)
|
||||
func (r *gormPigBatchRepository) DeletePigBatch(ctx context.Context, id uint) (int64, error) {
|
||||
func (r *gormPigBatchRepository) DeletePigBatch(ctx context.Context, id uint32) (int64, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "DeletePigBatch")
|
||||
return r.DeletePigBatchTx(repoCtx, r.db, id)
|
||||
}
|
||||
|
||||
func (r *gormPigBatchRepository) DeletePigBatchTx(ctx context.Context, tx *gorm.DB, id uint) (int64, error) {
|
||||
func (r *gormPigBatchRepository) DeletePigBatchTx(ctx context.Context, tx *gorm.DB, id uint32) (int64, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "DeletePigBatchTx")
|
||||
result := tx.WithContext(repoCtx).Delete(&models.PigBatch{}, id)
|
||||
if result.Error != nil {
|
||||
@@ -130,7 +130,7 @@ func (r *gormPigBatchRepository) ListPigBatches(ctx context.Context, isActive *b
|
||||
}
|
||||
|
||||
// GetPigBatchByIDTx 在指定的事务中,通过ID获取单个猪批次
|
||||
func (r *gormPigBatchRepository) GetPigBatchByIDTx(ctx context.Context, tx *gorm.DB, id uint) (*models.PigBatch, error) {
|
||||
func (r *gormPigBatchRepository) GetPigBatchByIDTx(ctx context.Context, tx *gorm.DB, id uint32) (*models.PigBatch, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "GetPigBatchByIDTx")
|
||||
var batch models.PigBatch
|
||||
if err := tx.WithContext(repoCtx).First(&batch, id).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user