package main import ( "fmt" "verification-platform-backend/internal/database" "verification-platform-backend/internal/model" ) func main() { database.Init() models := []struct { name string query interface{} }{ {"User", &[]model.User{}}, {"AppUser", &[]model.AppUser{}}, {"DynamicCode", &[]model.DynamicCode{}}, {"Application", &[]model.Application{}}, {"Card", &[]model.Card{}}, {"Order", &[]model.Order{}}, {"RechargeRecord", &[]model.RechargeRecord{}}, {"ConsumptionRecord", &[]model.ConsumptionRecord{}}, {"DocCategory", &[]model.DocCategory{}}, {"Doc", &[]model.Doc{}}, {"Setting", &[]model.Setting{}}, } for _, m := range models { var allCount int64 var activeCount int64 database.DB.Unscoped().Model(m.query).Count(&allCount) database.DB.Model(m.query).Count(&activeCount) deletedCount := allCount - activeCount if deletedCount > 0 { fmt.Printf("%s: 总数=%d, 活跃=%d, 已删除=%d\n", m.name, allCount, activeCount, deletedCount) } } }