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

---
 conf/aps-crm.json        |    2 
 model/clientStatus.go    |   35 +++++++++++++++++
 model/saleStage.go       |    2 
 model/request/receipt.go |    2 
 model/index.go           |    2 +
 model/salesSources.go    |   34 +++++++++++++++++
 6 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/conf/aps-crm.json b/conf/aps-crm.json
index d8f9bfe..9774105 100644
--- a/conf/aps-crm.json
+++ b/conf/aps-crm.json
@@ -14,7 +14,7 @@
     "encoder": "console"
   },
   "mysql": {
-    "dsn": "root:c++java123@tcp(192.168.20.119:3306)/aps_crm?charset=utf8&parseTime=True&loc=Local",
+    "dsn": "root:c++java123@tcp(192.168.20.119:3306)/crm?charset=utf8&parseTime=True&loc=Local",
     "host": "%",
     "logMode": true,
     "maxIdleCon": 50,
diff --git a/model/clientStatus.go b/model/clientStatus.go
index 6d51a64..c2fa2b1 100644
--- a/model/clientStatus.go
+++ b/model/clientStatus.go
@@ -3,6 +3,7 @@
 import (
 	"aps_crm/pkg/mysqlx"
 	"gorm.io/gorm"
+	"sync"
 )
 
 type (
@@ -91,3 +92,37 @@
 	var db = slf.build()
 	return db.Updates(values).Error
 }
+
+func (slf *ClientStatusSearch) CreateBatch(records []*ClientStatus) error {
+	var db = slf.build()
+	return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *ClientStatusSearch) 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 := []*ClientStatus{
+		{1, "鍒濇湡娌熼��"},
+		{2, "闇�姹傚垎鏋�"},
+		{3, "鏂规鎶ヤ环"},
+		{4, "鍟嗗姟璋堝垽"},
+		{5, "鎴愬姛缁撴"},
+	}
+
+	err := slf.CreateBatch(records)
+	if err != nil {
+		errCh <- err
+		return
+	}
+}
diff --git a/model/index.go b/model/index.go
index 39997a5..854464c 100644
--- a/model/index.go
+++ b/model/index.go
@@ -125,6 +125,8 @@
 		NewRepositorySearch(),
 		NewSaleStageSearch(),
 		NewQuotationStatusSearch(),
+		NewSalesSourcesSearch(),
+		NewClientStatusSearch(),
 	}
 
 	for _, model := range models {
diff --git a/model/request/receipt.go b/model/request/receipt.go
index 52acffc..2285ea3 100644
--- a/model/request/receipt.go
+++ b/model/request/receipt.go
@@ -18,5 +18,5 @@
 	PageInfo
 	SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` //鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
 	SourceId   int                        `json:"sourceId" form:"sourceId"`
-	ClientId   int                        `json:"clientId"` //瀹㈡埛id
+	ClientId   int                        `json:"clientId"  form:"clientId"` //瀹㈡埛id
 }
diff --git a/model/saleStage.go b/model/saleStage.go
index 7bd1c53..0572c0b 100644
--- a/model/saleStage.go
+++ b/model/saleStage.go
@@ -111,7 +111,7 @@
 		{2, "闇�姹傚垎鏋�"},
 		{3, "鍟嗗姟璋堝垽"},
 		{4, "鎴愬姛鍏抽棴"},
-		{4, "鎴愬姛缁撴"},
+		{5, "鎴愬姛缁撴"},
 	}
 	err := slf.CreateBatch(records)
 	if err != nil {
diff --git a/model/salesSources.go b/model/salesSources.go
index 9c7f05f..3472066 100644
--- a/model/salesSources.go
+++ b/model/salesSources.go
@@ -3,6 +3,7 @@
 import (
 	"aps_crm/pkg/mysqlx"
 	"gorm.io/gorm"
+	"sync"
 )
 
 type (
@@ -84,3 +85,36 @@
 	var db = slf.build()
 	return db.Updates(data).Error
 }
+
+func (slf *SalesSourcesSearch) CreateBatch(records []*SalesSources) error {
+	var db = slf.build()
+	return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *SalesSourcesSearch) 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 := []*SalesSources{
+		{1, "鐢佃瘽鏉ヨ"},
+		{2, "鍏徃鍒嗛厤"},
+		{3, "瀹㈡埛浠嬬粛"},
+		{4, "鐙珛寮�鍙�"},
+	}
+
+	err := slf.CreateBatch(records)
+	if err != nil {
+		errCh <- err
+		return
+	}
+}

--
Gitblit v1.8.0