feat:兼容Sqlite3,去除Find_in_set函数,将数据拆分读取

This commit is contained in:
henry
2021-11-22 14:06:49 +08:00
parent 8147865ebb
commit 405213c376
10 changed files with 174 additions and 54 deletions

View File

@ -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
}
}},
)
}