From 104db2ea4e4c76ed83e04b5ea7f9d427d16474a0 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 18 八月 2023 11:05:28 +0800
Subject: [PATCH] Merge branch 'master' into fly
---
model/timelyRate.go | 34 ++++++++
model/satisfaction.go | 32 ++++++++
model/serviceContractStatus.go | 27 ++++++
model/faultType.go | 23 +++--
api/v1/serviceCollectionPlan.go | 1
model/index.go | 8 ++
model/isVisit.go | 26 ++++++
model/serviceOrderStatus.go | 7 +
model/solveRate.go | 34 ++++++++
model/serviceContractType.go | 32 +++++++
model/serviceType.go | 2
11 files changed, 209 insertions(+), 17 deletions(-)
diff --git a/api/v1/serviceCollectionPlan.go b/api/v1/serviceCollectionPlan.go
index 2a7b060..46525a4 100644
--- a/api/v1/serviceCollectionPlan.go
+++ b/api/v1/serviceCollectionPlan.go
@@ -38,6 +38,7 @@
ctx.Fail(ecode.ParamsErr)
return
}
+ plan.AmountTotal = plan.AmountReceivable
plan.Status = constvar.CollectionStatusUnCollected
}
diff --git a/model/faultType.go b/model/faultType.go
index 260cc2f..82e9a65 100644
--- a/model/faultType.go
+++ b/model/faultType.go
@@ -12,18 +12,18 @@
// FaultType 鏁呴殰绫诲埆
FaultType struct {
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
- Name string `json:"name" gorm:"column:name"`
+ Name string `json:"name" gorm:"column:name"`
}
// FaultTypeSearch 鏁呴殰绫诲埆鎼滅储鏉′欢
FaultTypeSearch struct {
FaultType
- Orm *gorm.DB
- QueryClass constvar.FaultTypeQueryClass
- KeywordType constvar.FaultTypeKeywordType
- Keyword string
- PageNum int
- PageSize int
+ Orm *gorm.DB
+ QueryClass constvar.FaultTypeQueryClass
+ KeywordType constvar.FaultTypeKeywordType
+ Keyword string
+ PageNum int
+ PageSize int
}
)
@@ -130,6 +130,13 @@
if total != 0 {
return nil
}
- records := []*FaultType{}
+ records := []*FaultType{
+ {1, "璁惧瀹夎"},
+ {2, "璁惧璋冩暀"},
+ {3, "璁惧鍗囩骇"},
+ {4, "鐢垫皵鏁呴殰"},
+ {5, "璁惧鏁呴殰"},
+ {6, "璁惧鑹搧鐜囦綆"},
+ }
return slf.CreateBatch(records)
}
diff --git a/model/index.go b/model/index.go
index abb5a56..7bd2e13 100644
--- a/model/index.go
+++ b/model/index.go
@@ -106,6 +106,14 @@
NewInvoiceTypeSearch(),
NewInvoiceStatusSearch(),
NewCourierCompanySearch(),
+ NewServiceContractStatusSearch(),
+ NewServiceContractTypeSearch(),
+ NewServiceOrderStatusSearch(),
+ NewSatisfactionSearch(),
+ NewSolveRateSearch(),
+ NewIsVisitSearch(),
+ NewTimelyRateSearch(),
+ NewFaultTypeSearch(),
}
for _, model := range models {
if id, ok := model.(InitDefaultData); ok {
diff --git a/model/isVisit.go b/model/isVisit.go
index f6c4af9..ec04ee3 100644
--- a/model/isVisit.go
+++ b/model/isVisit.go
@@ -11,7 +11,7 @@
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
}
-
+
IsVisitSearch struct {
IsVisit
Orm *gorm.DB
@@ -83,3 +83,27 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *IsVisitSearch) CreateBatch(records []*IsVisit) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *IsVisitSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*IsVisit{
+ {1, "鏄�"},
+ {2, "鍚�"},
+ }
+ return slf.CreateBatch(records)
+}
diff --git a/model/satisfaction.go b/model/satisfaction.go
index 11690e6..e8c3e14 100644
--- a/model/satisfaction.go
+++ b/model/satisfaction.go
@@ -77,3 +77,35 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *SatisfactionSearch) CreateBatch(records []*Satisfaction) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *SatisfactionSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*Satisfaction{
+ {1, "100%"},
+ {2, "90%"},
+ {3, "80%"},
+ {4, "70%"},
+ {5, "60%"},
+ {6, "50%"},
+ {7, "40%"},
+ {8, "30%"},
+ {9, "20%"},
+ {10, "10%"},
+ }
+ return slf.CreateBatch(records)
+}
diff --git a/model/serviceContractStatus.go b/model/serviceContractStatus.go
index f3631c4..6b4d6e3 100644
--- a/model/serviceContractStatus.go
+++ b/model/serviceContractStatus.go
@@ -11,7 +11,7 @@
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
}
-
+
ServiceContractStatusSearch struct {
ServiceContractStatus
Orm *gorm.DB
@@ -83,3 +83,28 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *ServiceContractStatusSearch) CreateBatch(records []*ServiceContractStatus) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *ServiceContractStatusSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*ServiceContractStatus{
+ {1, "宸插垱寤�"},
+ {2, "宸插鎵�"},
+ {3, "宸蹭綔搴�"},
+ }
+ return slf.CreateBatch(records)
+}
diff --git a/model/serviceContractType.go b/model/serviceContractType.go
index 086ca06..3524737 100644
--- a/model/serviceContractType.go
+++ b/model/serviceContractType.go
@@ -6,12 +6,12 @@
)
type (
- // ServiceContractType 鍟嗘満闃舵
+ // ServiceContractType 鏈嶅姟鍚堝悓绫诲瀷
ServiceContractType struct {
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
- Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
+ Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鏈嶅姟鍚堝悓绫诲瀷鍚嶇О"`
}
-
+
ServiceContractTypeSearch struct {
ServiceContractType
Orm *gorm.DB
@@ -83,3 +83,29 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *ServiceContractTypeSearch) CreateBatch(records []*ServiceContractType) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *ServiceContractTypeSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*ServiceContractType{
+ {1, "鎸夊勾"},
+ {2, "鎸夋"},
+ {3, "鍏朵粬"},
+ {4, "铏氭嫙鍚堝悓"},
+ }
+ return slf.CreateBatch(records)
+}
diff --git a/model/serviceOrderStatus.go b/model/serviceOrderStatus.go
index 4697fe2..44ff749 100644
--- a/model/serviceOrderStatus.go
+++ b/model/serviceOrderStatus.go
@@ -140,6 +140,11 @@
if total != 0 {
return nil
}
- records := []*ServiceOrderStatus{}
+ records := []*ServiceOrderStatus{
+ {1, "鏈鐞�"},
+ {2, "澶勭悊涓�"},
+ {3, "绛夊緟鍥炲簲"},
+ {4, "鎴愬姛鍏抽棴"},
+ }
return slf.CreateBatch(records)
}
diff --git a/model/serviceType.go b/model/serviceType.go
index 4602418..9938c03 100644
--- a/model/serviceType.go
+++ b/model/serviceType.go
@@ -12,7 +12,7 @@
// ServiceType 鏈嶅姟鏂瑰紡
ServiceType struct {
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
- Name string `json:"name" gorm:"column:name"`
+ Name string `json:"name" gorm:"column:name;type:varchar(255);not null;default:''"`
}
// ServiceTypeSearch 鏈嶅姟鏂瑰紡鎼滅储鏉′欢
diff --git a/model/solveRate.go b/model/solveRate.go
index 97f6be1..6f3e24e 100644
--- a/model/solveRate.go
+++ b/model/solveRate.go
@@ -11,7 +11,7 @@
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
}
-
+
SolveRateSearch struct {
SolveRate
Orm *gorm.DB
@@ -83,3 +83,35 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *SolveRateSearch) CreateBatch(records []*SolveRate) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *SolveRateSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*SolveRate{
+ {1, "100%"},
+ {2, "90%"},
+ {3, "80%"},
+ {4, "70%"},
+ {5, "60%"},
+ {6, "50%"},
+ {7, "40%"},
+ {8, "30%"},
+ {9, "20%"},
+ {10, "10%"},
+ }
+ return slf.CreateBatch(records)
+}
diff --git a/model/timelyRate.go b/model/timelyRate.go
index b98e414..143e456 100644
--- a/model/timelyRate.go
+++ b/model/timelyRate.go
@@ -11,7 +11,7 @@
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
}
-
+
TimelyRateSearch struct {
TimelyRate
Orm *gorm.DB
@@ -83,3 +83,35 @@
var db = slf.build()
return db.Updates(data).Error
}
+
+func (slf *TimelyRateSearch) CreateBatch(records []*TimelyRate) error {
+ var db = slf.build()
+ return db.Create(records).Error
+}
+
+// InitDefaultData 鍒濆鍖栨暟鎹�
+func (slf *TimelyRateSearch) InitDefaultData() error {
+ var (
+ db = slf.Orm.Table(slf.TableName())
+ total int64 = 0
+ )
+ if err := db.Count(&total).Error; err != nil {
+ return err
+ }
+ if total != 0 {
+ return nil
+ }
+ records := []*TimelyRate{
+ {1, "100%"},
+ {2, "90%"},
+ {3, "80%"},
+ {4, "70%"},
+ {5, "60%"},
+ {6, "50%"},
+ {7, "40%"},
+ {8, "30%"},
+ {9, "20%"},
+ {10, "10%"},
+ }
+ return slf.CreateBatch(records)
+}
--
Gitblit v1.8.0