From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 01 十一月 2023 19:20:21 +0800
Subject: [PATCH] 公海member_id使用0

---
 model/serviceOrderStatus.go |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/model/serviceOrderStatus.go b/model/serviceOrderStatus.go
index b4b4046..fdb01e9 100644
--- a/model/serviceOrderStatus.go
+++ b/model/serviceOrderStatus.go
@@ -6,24 +6,25 @@
 	"errors"
 	"fmt"
 	"gorm.io/gorm"
+	"sync"
 )
 
 type (
 	// ServiceOrderStatus 鏈嶅姟鍗曠姸鎬�
 	ServiceOrderStatus struct {
 		Id   int    `json:"id" gorm:"column:id;type:int;primary_key;AUTO_INCREMENT"`
-	    Name string `json:"name" gorm:"column:name;type:varchar(255);not null;default:'';comment:鍚嶇О"`
+		Name string `json:"name" gorm:"column:name;type:varchar(255);not null;default:'';comment:鍚嶇О"`
 	}
 
 	// ServiceOrderStatusSearch 鏈嶅姟鍗曠姸鎬佹悳绱㈡潯浠�
 	ServiceOrderStatusSearch struct {
 		ServiceOrderStatus
-		Orm *gorm.DB
-        QueryClass  constvar.ServiceOrderStatusQueryClass
-        KeywordType constvar.ServiceOrderStatusKeywordType
-        Keyword     string
-        PageNum  int
-        PageSize int
+		Orm         *gorm.DB
+		QueryClass  constvar.ServiceOrderStatusQueryClass
+		KeywordType constvar.ServiceOrderStatusKeywordType
+		Keyword     string
+		PageNum     int
+		PageSize    int
 	}
 )
 
@@ -129,17 +130,29 @@
 }
 
 // InitDefaultData 鍒濆鍖栨暟鎹�
-func (slf *ServiceOrderStatusSearch) InitDefaultData() error {
+func (slf *ServiceOrderStatusSearch) InitDefaultData(errCh chan<- error, wg *sync.WaitGroup) {
 	var (
 		db          = slf.Orm.Table(slf.TableName())
 		total int64 = 0
 	)
+	defer wg.Done()
+
 	if err := db.Count(&total).Error; err != nil {
-		return err
+		errCh <- err
+		return
 	}
 	if total != 0 {
-		return nil
+		return
 	}
-	records := []*ServiceOrderStatus{}
-	return slf.CreateBatch(records)
+	records := []*ServiceOrderStatus{
+		{1, "鏈鐞�"},
+		{2, "澶勭悊涓�"},
+		{3, "绛夊緟鍥炲簲"},
+		{4, "鎴愬姛鍏抽棴"},
+	}
+	err := slf.CreateBatch(records)
+	if err != nil {
+		errCh <- err
+		return
+	}
 }

--
Gitblit v1.8.0