fix 修改审批中画展包的逻辑
parent
aec05feaea
commit
d29b55b318
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@
|
||||
package collection
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCodetInfo(t *testing.T) {
|
||||
var first = []string{"a", "b", "c"}
|
||||
var second = []string{"a", "b", "c"}
|
||||
|
||||
result := DiffArrayString(first, second)
|
||||
result2 := IntersectArrayString(first, second)
|
||||
fmt.Println(result, result2)
|
||||
if len(result) != 0 {
|
||||
t.Errorf("验证错误 ")
|
||||
}
|
||||
|
||||
second = []string{}
|
||||
result = DiffArrayString(first, second)
|
||||
result2 = IntersectArrayString(first, second)
|
||||
fmt.Println(result, result2)
|
||||
if len(result) != 3 {
|
||||
t.Errorf("验证错误 ")
|
||||
}
|
||||
|
||||
second = []string{"a"}
|
||||
result = DiffArrayString(first, second)
|
||||
result2 = IntersectArrayString(first, second)
|
||||
fmt.Println(result, result2)
|
||||
if len(result) != 2 {
|
||||
t.Errorf("验证错误 ")
|
||||
}
|
||||
|
||||
first = []string{}
|
||||
result = DiffArrayString(first, second)
|
||||
result2 = IntersectArrayString(first, second)
|
||||
fmt.Println(result, result2)
|
||||
if len(result) != 0 {
|
||||
t.Errorf("验证错误 ")
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
//类型迁移
|
||||
func migration() {
|
||||
//自动迁移模式
|
||||
//增加字段
|
||||
addColumn(&ApprovalType{}, "is_normal")
|
||||
addColumn(&ApprovalType{}, "key_json")
|
||||
|
||||
addColumn(&Exhibition{}, "apply_id")
|
||||
addColumn(&ApprovalExhibition{}, "package_id")
|
||||
addColumn(&ApprovalExhibition{}, "show_date")
|
||||
|
||||
addColumn(&Approval{}, "value_json")
|
||||
}
|
||||
|
||||
//数据迁移
|
||||
func addColumn(dst interface{}, column string) {
|
||||
exist := DB.Migrator().HasColumn(dst, column)
|
||||
if !exist {
|
||||
err := DB.Migrator().AddColumn(dst, column)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue