• 关于区域表system_district:省市县街道四级地址表


    需求:

    1、将其设计成一张表

    DROP TABLE IF EXISTS `system_district`;
    CREATE TABLE `system_district` (
      `district_id`      bigint(20) unsigned NOT NULL AUTO_INCREMENT   COMMENT '区域ID',
      `parent_id`        bigint(20) unsigned NOT NULL                  COMMENT '父ID',
      `district_name`    varchar(200) NOT NULL                         COMMENT '区域名称',
      `short_name`       varchar(200) NOT NULL                         COMMENT '简称',
      `longitude`        decimal(10,7) NOT NULL DEFAULT '0.0000000'    COMMENT '经度',
      `latitude`         decimal(10,7) NOT NULL DEFAULT '0.0000000'    COMMENT '维度',
      `level`            int(11) NOT NULL DEFAULT '1'                  COMMENT '等级(地区级别 1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县 4-街道办-乡)',
      `sort`             int(11) NOT NULL DEFAULT '0'                  COMMENT '排序',
      `is_deleted`       tinyint(1) NOT NULL DEFAULT '0'               COMMENT '删除标志: 0未删除,1已删除',
      `create_time`      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间',
      `update_time`      timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '修改时间',
      PRIMARY KEY (`district_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=659004503 DEFAULT CHARSET=utf8 COMMENT='区域表';
    
    
    

    2、将其设计成三张表

    省表:

    DROP TABLE IF EXISTS `province`;
    CREATE TABLE `province` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `code` varchar(6) NOT NULL,
    `name` varchar(20) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Records of province
    -- ----------------------------
    INSERT INTO `province` VALUES ('1', '110000', '北京市');
    INSERT INTO `province` VALUES ('2', '120000', '天津市');
    INSERT INTO `province` VALUES ('3', '130000', '河北省');
    INSERT INTO `province` VALUES ('4', '140000', '山西省');
    INSERT INTO `province` VALUES ('5', '150000', '内蒙古');

    市表:

    DROP TABLE IF EXISTS `city`;
    CREATE TABLE `city` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `code` varchar(6) NOT NULL,
      `name` varchar(20) NOT NULL,
      `provincecode` varchar(6) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=343 DEFAULT CHARSET=utf8;
     
    -- ----------------------------
    -- Records of city
    -- ----------------------------
    INSERT INTO `city` VALUES ('1', '110100', '北京市', '110000');
    INSERT INTO `city` VALUES ('2', '130100', '石家庄市', '130000');
    INSERT INTO `city` VALUES ('3', '130200', '唐山市', '130000');
    INSERT INTO `city` VALUES ('4', '130300', '秦皇岛市', '130000');
    INSERT INTO `city` VALUES ('5', '130400', '邯郸市', '130000');
    INSERT INTO `city` VALUES ('6', '130500', '邢台市', '130000');
    INSERT INTO `city` VALUES ('7', '130600', '保定市', '130000');
    INSERT INTO `city` VALUES ('8', '130700', '张家口市', '130000');

    县表:

    DROP TABLE IF EXISTS `area`;
    CREATE TABLE `area` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `code` varchar(6) NOT NULL,
      `name` varchar(20) NOT NULL,
      `citycode` varchar(6) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=3145 DEFAULT CHARSET=utf8;
     
    -- ----------------------------
    -- Records of area
    -- ----------------------------
    INSERT INTO `area` VALUES ('1', '110101', '东城区', '110100');
    INSERT INTO `area` VALUES ('2', '110102', '西城区', '110100');
    INSERT INTO `area` VALUES ('3', '110103', '崇文区', '110100');
    INSERT INTO `area` VALUES ('4', '110104', '宣武区', '110100');
    INSERT INTO `area` VALUES ('5', '110105', '朝阳区', '110100');
    INSERT INTO `area` VALUES ('6', '110106', '丰台区', '110100');
    INSERT INTO `area` VALUES ('7', '110107', '石景山区', '110100');
    INSERT INTO `area` VALUES ('8', '110108', '海淀区', '110100');
    INSERT INTO `area` VALUES ('9', '110109', '门头沟区', '110100');
    INSERT INTO `area` VALUES ('10', '110111', '房山区', '110100');
    INSERT INTO `area` VALUES ('11', '110112', '通州区', '110100');
    INSERT INTO `area` VALUES ('12', '110113', '顺义区', '110100');
    INSERT INTO `area` VALUES ('13', '110114', '昌平区', '110100');
     
  • 相关阅读:
    <2016-1-28>
    <页面里折合与打开>
    右上角鼠标滑过展开收缩动画效果js代码的演示页面
    30款css3实现的鼠标经过图片显示描述特效
    dede让channelartlist标签支持currentstyle属性 完美解决
    织梦导航 currentstyle 点击li添加class类 样式
    论坛首页显示板块,但没有权限点不进去
    医疗窗口右下角弹出抖动效果
    joomla搬家之后打不开 首页404错误
    Discuz X3游客看小图功能导致文字内容隐藏的【修复方法】
  • 原文地址:https://www.cnblogs.com/ZJOE80/p/11833075.html
Copyright © 2020-2023  润新知