feat:完善入驻信息管理

This commit is contained in:
henry
2021-12-07 16:10:12 +08:00
parent 3989befe92
commit 95e8fdb9bb
30 changed files with 397 additions and 89 deletions

View File

@ -1,9 +1,11 @@
package model
import (
"SciencesServer/app/basic/config"
"SciencesServer/serve/orm"
"SciencesServer/serve/orm/logic"
"SciencesServer/utils"
"fmt"
"gorm.io/gorm"
"strings"
"testing"
@ -77,6 +79,7 @@ func filter(src string) string {
}
func TestRecoveryPatent(t *testing.T) {
return
src := make([]*PPatent, 0)
sqlite := sqlite()
@ -142,3 +145,50 @@ func TestRecoveryPatent(t *testing.T) {
}
}
}
func TestA(t *testing.T) {
return
mysql := mysql()
file := "../../../file/sys_industry.json"
src := make([]*config.MemoryForIndustry, 0)
utils.LoadConfig(file, &src)
out := make([]*SysIndustry, 0)
var id uint64 = 1
for _, v := range src {
var parentID uint64 = 0
data := &SysIndustry{
Model: Model{
ID: id,
},
ParentID: parentID,
Name: v.Name,
}
out = append(out, data)
if v.Children != nil && len(v.Children) > 0 {
parentID = id
for _, val := range v.Children {
id++
data = &SysIndustry{
Model: Model{
ID: id,
},
ParentID: parentID,
Name: val.Name,
}
out = append(out, data)
}
}
id++
}
fmt.Println(utils.AnyToJSON(out))
err := mysql.Table(NewSysIndustry().TableName()).Create(out).Error
t.Log(err)
}