feat:兼容Sqlite3,去除Find_in_set函数,将数据拆分读取
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"ArmedPolice/config"
|
||||
"ArmedPolice/lib"
|
||||
"ArmedPolice/serve/orm"
|
||||
"ArmedPolice/utils"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -72,7 +73,10 @@ func initModel() {
|
||||
}
|
||||
}
|
||||
function(
|
||||
&synchronized{iModel: model.NewSysTenant()},
|
||||
&synchronized{iModel: model.NewSysTenant(), iValues: func() interface{} {
|
||||
snowflake, _ := utils.NewSnowflake(1)
|
||||
return &model.SysTenant{Key: utils.IntToString(snowflake.GetID()), Name: "中国武警总队", Remark: "中国武警总队"}
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysConfig(), iValues: func() interface{} {
|
||||
values := make([]*structForSysConfig, 0)
|
||||
|
||||
@ -94,8 +98,8 @@ func initModel() {
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysMenu()}, &synchronized{iModel: model.NewSysAuth()},
|
||||
&synchronized{iModel: model.NewSysUser(), iValues: func() interface{} {
|
||||
return &model.SysUser{Account: "admin", Name: "超级管理员", Mobile: "13888888888", Password: "123456",
|
||||
IsAdmin: model.SysUserAdministratorForAdmin, Remark: "超级管理员"}
|
||||
return &model.SysUser{ModelTenant: model.ModelTenant{TenantID: 1}, Account: "admin", Name: "超级管理员",
|
||||
Mobile: "13888888888", Password: "123456", IsAdmin: model.SysUserAdministratorForAdmin, Remark: "超级管理员"}
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysRole(), iValues: func() interface{} {
|
||||
out := make([]*model.SysRole, 0)
|
||||
@ -154,6 +158,7 @@ func initModel() {
|
||||
&synchronized{iModel: model.NewWorkRepair()}, &synchronized{iModel: model.NewWorkRepairDetail()},
|
||||
)
|
||||
}
|
||||
|
||||
func initCacheMode() {
|
||||
db := orm.GetDB()
|
||||
|
||||
@ -179,6 +184,16 @@ func initCacheMode() {
|
||||
config.SystemConfig[v.Key] = v.Value
|
||||
}
|
||||
}},
|
||||
&caches{iModel: model.NewSysBreakdown(), iValues: func() interface{} {
|
||||
out := make([]*model.SysBreakdown, 0)
|
||||
_ = model.Find(model.NewSysBreakdown(), &out)
|
||||
return out
|
||||
}, toCache: func(values interface{}) {
|
||||
out := values.([]*model.SysBreakdown)
|
||||
for _, v := range out {
|
||||
config.SystemBreakdown[v.ID] = v.Title
|
||||
}
|
||||
}},
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user