From 07e0edb712b81e8d3b38465f71d66206e81361db Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 17 十月 2023 14:31:40 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm

---
 model/saleStage.go |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/model/saleStage.go b/model/saleStage.go
index e4b5f8d..7bd1c53 100644
--- a/model/saleStage.go
+++ b/model/saleStage.go
@@ -3,6 +3,7 @@
 import (
 	"aps_crm/pkg/mysqlx"
 	"gorm.io/gorm"
+	"sync"
 )
 
 type (
@@ -84,3 +85,37 @@
 	var db = slf.build()
 	return db.Updates(data).Error
 }
+
+func (slf *SaleStageSearch) CreateBatch(records []*SaleStage) error {
+	var db = slf.build()
+	return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *SaleStageSearch) 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 {
+		errCh <- err
+		return
+	}
+	if total != 0 {
+		return
+	}
+	records := []*SaleStage{
+		{1, "鍒濇湡娌熼��"},
+		{2, "闇�姹傚垎鏋�"},
+		{3, "鍟嗗姟璋堝垽"},
+		{4, "鎴愬姛鍏抽棴"},
+		{4, "鎴愬姛缁撴"},
+	}
+	err := slf.CreateBatch(records)
+	if err != nil {
+		errCh <- err
+		return
+	}
+}

--
Gitblit v1.8.0