@ -12,6 +12,8 @@ var GBT2260 map[string]string
var XXBXLXM map [ string ] string
var PARENT_IDS [ ] string
/ * *
* @ Author zhangjun
* @ Description 组 织 机 构 树 缓 存 初 始 化 , 【 机 构 下 属 学 校 】 递 归 查 询 、 并 缓 存 Redis
@ -29,6 +31,8 @@ func OrgtreeCacheInit(){
list , count , _ := Page ( sql , 1000 , 0 )
PARENT_IDS = make ( [ ] string , 0 )
if count > 0 {
for no := 0 ; no < int ( count ) ; no ++ {
//TODO:目前只支持教育局下属学校的数据访问控制,暂不支持其他机构类型(如:大学区、主校分校...)
@ -40,6 +44,8 @@ func OrgtreeCacheInit(){
if count2 > 0 {
Orgtree2Redis ( list2 , "Dataex_Scope_" + list [ no ] [ "id" ] . ( string ) )
PARENT_IDS = append ( PARENT_IDS , list [ no ] [ "id" ] . ( string ) )
OrgCacheCreate ( list [ no ] [ "id" ] . ( string ) , list [ no ] [ "id" ] . ( string ) )
}
}
@ -115,6 +121,36 @@ func OrgtreeCacheInit(){
XXBXLXM [ "933" ] = "其他培训机构"
}
func RefreshOrgtree ( ) {
//删除Redis缓存
RedisUtil . RedisClient . FlushDB ( )
//机构树缓存
sql := "SELECT id from t_dataex_orgtree where delete_flag = -1 and enable_flag = 1 and parent_id = '-1'"
list , count , _ := Page ( sql , 1000 , 0 )
if count > 0 {
for no := 0 ; no < int ( count ) ; no ++ {
//TODO:目前只支持教育局下属学校的数据访问控制,暂不支持其他机构类型(如:大学区、主校分校...)
if list [ no ] [ "org_type" ] . ( string ) == "1" {
sql = "SELECT id from t_dataex_orgtree where delete_flag = -1 and enable_flag = 1 and parent_id = '" + list [ no ] [ "id" ] . ( string ) + "'"
list2 , count2 , _ := Page ( sql , 1000 , 0 )
if count2 > 0 {
Orgtree2Redis ( list2 , "Dataex_Scope_" + list [ no ] [ "id" ] . ( string ) )
PARENT_IDS = append ( PARENT_IDS , list [ no ] [ "id" ] . ( string ) )
OrgCacheCreate ( list [ no ] [ "id" ] . ( string ) , list [ no ] [ "id" ] . ( string ) )
}
}
}
}
}
/ * *
* @ Author zhangjun
* @ Description 刷 新 机 构 下 属 学 校 缓 存
@ -138,6 +174,8 @@ func OrgCacheCreate(orgID string,scope... string) {
if count2 > 0 {
Orgtree2Redis ( list2 , "Dataex_Scope_" + list [ no ] [ "id" ] . ( string ) )
PARENT_IDS = append ( PARENT_IDS , list [ no ] [ "id" ] . ( string ) )
var newscope = append ( scope , list [ no ] [ "id" ] . ( string ) )
for no := 0 ; no < len ( scope ) ; no ++ {