|
|
@@ -35,12 +35,6 @@ func main() {
|
|
|
fmt.Scanln(&jsonFile)
|
|
|
fmt.Println("正在处理,请稍等……")
|
|
|
|
|
|
- //jsonFile = "D:\\pc_menu_pingan.json"
|
|
|
- // jsonFile = "D:\\pc_menu_ermcp.json"
|
|
|
-
|
|
|
- // clientType = "1"
|
|
|
- // jsonFile = "D:\\mobile_menu.json"
|
|
|
-
|
|
|
// 读取Json文件
|
|
|
filePtr, err := os.Open(jsonFile)
|
|
|
if err != nil {
|
|
|
@@ -60,16 +54,6 @@ func main() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- // 构建菜单数组
|
|
|
- // clientMenus := buildMenu(datas)
|
|
|
-
|
|
|
- // 创建导出目录
|
|
|
- // err = os.MkdirAll("", os.ModePerm)
|
|
|
- // if err != nil {
|
|
|
- // fmt.Printf("创建目录失败,错误:%s", err.Error())
|
|
|
- // return
|
|
|
- // }
|
|
|
-
|
|
|
s := "-- 企业风管权限控制\n"
|
|
|
if clientType == "1" {
|
|
|
s += "-- 说明:MENUTYPE = 5 为企业风管PC WEB专用的终端权限\n"
|
|
|
@@ -116,11 +100,11 @@ func buildSQL(datas []interface{}, parentCode string, level int) string {
|
|
|
for i, v := range datas {
|
|
|
data := v.(map[string]interface{})
|
|
|
var (
|
|
|
- remark string
|
|
|
- rulekey string
|
|
|
+ remark string
|
|
|
)
|
|
|
|
|
|
- if data["rulekey"] != nil {
|
|
|
+ rulekey, hasRuleKey := data["rulekey"]
|
|
|
+ if hasRuleKey && rulekey != "" {
|
|
|
rulekey = data["rulekey"].(string)
|
|
|
|
|
|
if data["remark"] != nil {
|
|
|
@@ -156,11 +140,11 @@ func buildPCWEBSQL(datas []interface{}, parentCode string, level int) string {
|
|
|
for i, v := range datas {
|
|
|
data := v.(map[string]interface{})
|
|
|
var (
|
|
|
- remark string
|
|
|
- rulekey string
|
|
|
+ remark string
|
|
|
)
|
|
|
|
|
|
- if data["rulekey"] != nil {
|
|
|
+ rulekey, hasRuleKey := data["rulekey"]
|
|
|
+ if hasRuleKey && rulekey != "" {
|
|
|
rulekey = data["rulekey"].(string)
|
|
|
|
|
|
if data["remark"] != nil {
|
|
|
@@ -193,7 +177,6 @@ func buildPCWEBSQL(datas []interface{}, parentCode string, level int) string {
|
|
|
sql += "\n"
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return sql
|