From 1d5cb2f03c706c4b1cc36f50fd431f98fdbe7101 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期三, 13 十二月 2023 15:23:33 +0800
Subject: [PATCH] 对number的验证及不重复
---
models/operation.go | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/models/operation.go b/models/operation.go
index d076b88..2009733 100644
--- a/models/operation.go
+++ b/models/operation.go
@@ -337,3 +337,15 @@
return records, nil
}
+
+func (slf *OperationSearch) MaxAutoIncr() (int, error) {
+ var (
+ db = slf.build()
+ total int64
+ )
+
+ if err := db.Count(&total).Error; err != nil {
+ return int(total), fmt.Errorf("max err: %v", err)
+ }
+ return int(total), nil
+}
--
Gitblit v1.8.0