// 新增地址选项sql生成
let currrentIndex = 3537;
const adiministrativeCodeOfNew = {
"441900": {
"441900121000": "虎门镇",
"441900119000": "长安镇",
"441900118000": "大岭山镇",
"441900122000": "厚街镇",
"441900401000": "松山湖镇",
"441900111000": "寮步镇",
"441900101000": "石碣镇",
"441900102000": "石龙镇",
"441900104000": "石排镇",
"441900103000": "茶山镇",
"441900106000": "横沥镇",
"441900109000": "东坑镇",
"441900113000": "大朗镇",
"441900110000": "常平镇",
"441900114000": "黄江镇",
"441900112000": "樟木头镇",
"441900116000": "塘厦镇",
"441900115000": "清溪镇",
"441900117000": "凤岗镇",
"441900105000": "企石镇",
"441900107000": "桥头镇",
"441900108000": "谢岗镇",
"441900129000": "高埗镇",
"441900124000": "道滘镇",
"441900123000": "沙田镇",
"441900128000": "中堂镇",
"441900127000": "望牛墩镇",
"441900125000": "洪梅镇",
"441900126000": "麻涌镇"
},
"440400": {
"440402403000": "保税区",
"440402403001": "经济区",
"440402403002": "高新区",
"440402104000": "横琴新区",
"440402403003": "三乡镇",
"440402403004": "神湾镇",
"442000107000": "坦洲镇",
"440402100000": "唐家湾镇",
"440402106000": "万山区",
"440402105000": "桂山镇"
},
"442000": {
"442000115000": "板芙镇",
"442000116000": "大涌镇",
"442000103000": "东凤镇",
"442000002000": "市东区",
"442000104000": "东升镇",
"442000112000": "阜沙镇",
"442000108000": "港口镇",
"442000105000": "古镇镇",
"442000110000": "横栏镇",
"442000101000": "黄圃镇",
"442000003000": "开发区",
"442000102000": "民众镇",
"442000113000": "南朗镇",
"442000005000": "市南区",
"442000111000": "南头镇",
"442000109000": "三角镇",
"442000114000": "三乡镇",
"442000106000": "沙溪镇",
"442000117000": "神湾镇",
"442000001000": "石歧镇",
"442000107000": "坦洲镇",
"442000006000": "桂山镇",
"442000004000": "市西区",
"442000xxx000": "香洲镇",
"442000010000": "小榄镇"
}
};
const getId = () => ++currrentIndex;
const getSqlString = (adiministrativeCodeOfNew, key, sKey) => 'INSERT INTO "TB_REGION" ("ID", "REGION_ID", "REGION_NAME", "PARENT_ID") VALUES (\'' +
getId() + '\', \'' + sKey + '\', \'' + adiministrativeCodeOfNew[key][sKey] + '\', \'' + key + '\');';
const sql = Object.keys(adiministrativeCodeOfNew)
.map(key => Object.keys(adiministrativeCodeOfNew[key]).map(sKey => getSqlString(adiministrativeCodeOfNew, key, sKey)).join('\n'))
.join('\n');
/*
原型prototype
构造函数constructor
*/
// document.getElementById('root').innerHTML = sql.replace(/\n/g, "<br/>");
console.log(sql);
debugger
console