uint/uint64全部改为uint32
This commit is contained in:
@@ -13,14 +13,14 @@ import (
|
||||
|
||||
// AreaControllerRepository 定义了对 AreaController 模型的数据库操作接口
|
||||
type AreaControllerRepository interface {
|
||||
FindByID(ctx context.Context, id uint) (*models.AreaController, error)
|
||||
FindByID(ctx context.Context, id uint32) (*models.AreaController, error)
|
||||
FindByNetworkID(ctx context.Context, networkID string) (*models.AreaController, error)
|
||||
Create(ctx context.Context, ac *models.AreaController) error
|
||||
ListAll(ctx context.Context) ([]*models.AreaController, error)
|
||||
Update(ctx context.Context, ac *models.AreaController) error
|
||||
Delete(ctx context.Context, id uint) error
|
||||
Delete(ctx context.Context, id uint32) error
|
||||
// IsAreaControllerUsedByTasks 检查区域主控是否被特定任务类型使用,可以忽略指定任务类型
|
||||
IsAreaControllerUsedByTasks(ctx context.Context, areaControllerID uint, ignoredTaskTypes []models.TaskType) (bool, error)
|
||||
IsAreaControllerUsedByTasks(ctx context.Context, areaControllerID uint32, ignoredTaskTypes []models.TaskType) (bool, error)
|
||||
}
|
||||
|
||||
// gormAreaControllerRepository 是 AreaControllerRepository 的 GORM 实现。
|
||||
@@ -60,7 +60,7 @@ func (r *gormAreaControllerRepository) Update(ctx context.Context, ac *models.Ar
|
||||
}
|
||||
|
||||
// Delete 删除一个 AreaController 记录。
|
||||
func (r *gormAreaControllerRepository) Delete(ctx context.Context, id uint) error {
|
||||
func (r *gormAreaControllerRepository) Delete(ctx context.Context, id uint32) error {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "Delete")
|
||||
if err := r.db.WithContext(repoCtx).Delete(&models.AreaController{}, id).Error; err != nil {
|
||||
return fmt.Errorf("删除区域主控失败: %w", err)
|
||||
@@ -69,7 +69,7 @@ func (r *gormAreaControllerRepository) Delete(ctx context.Context, id uint) erro
|
||||
}
|
||||
|
||||
// FindByID 通过 ID 查找一个 AreaController。
|
||||
func (r *gormAreaControllerRepository) FindByID(ctx context.Context, id uint) (*models.AreaController, error) {
|
||||
func (r *gormAreaControllerRepository) FindByID(ctx context.Context, id uint32) (*models.AreaController, error) {
|
||||
repoCtx := logs.AddFuncName(ctx, r.ctx, "FindByID")
|
||||
var areaController models.AreaController
|
||||
if err := r.db.WithContext(repoCtx).First(&areaController, id).Error; err != nil {
|
||||
@@ -89,7 +89,7 @@ func (r *gormAreaControllerRepository) FindByNetworkID(ctx context.Context, netw
|
||||
}
|
||||
|
||||
// IsAreaControllerUsedByTasks 检查区域主控是否被特定任务类型使用,可以忽略指定任务类型
|
||||
func (r *gormAreaControllerRepository) IsAreaControllerUsedByTasks(ctx context.Context, areaControllerID uint, ignoredTaskTypes []models.TaskType) (bool, error) {
|
||||
func (r *gormAreaControllerRepository) IsAreaControllerUsedByTasks(ctx context.Context, areaControllerID uint32, ignoredTaskTypes []models.TaskType) (bool, error) {
|
||||
repoCtx, logger := logs.Trace(ctx, r.ctx, "IsAreaControllerUsedByTasks")
|
||||
|
||||
// 将 ignoredTaskTypes 转换为 map,以便高效查找
|
||||
|
||||
Reference in New Issue
Block a user