CREATE TABLE `d_radio_info` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '通讯扩展信息ID',
`sn` VARCHAR(20) NOT NULL COMMENT '设备SN',
`imei` CHAR(15) NOT NULL COMMENT '国际移动设备身份码',
PRIMARY KEY (`id`),
UNIQUE KEY `sn` (`sn`),
CONSTRAINT `t_radio_info_ibfk_1` FOREIGN KEY (`sn`) REFERENCES `t_device` (`sn`)
) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='RADIO信息表';
CREATE TABLE `t_site` (
`s_id` INT(11) NOT NULL AUTO_INCREMENT,
`site_name` VARCHAR(20) DEFAULT NULL,
`phonenumber` VARCHAR(20) DEFAULT NULL,
PRIMARY KEY (`s_id`)
) ENGINE=INNODB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8;
CREATE TABLE `t_device` (
`d_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '设备ID',
`sn` VARCHAR(20) NOT NULL COMMENT '设备序列号',
`model_id` BIGINT(20) NOT NULL COMMENT '型号ID',
`status` TINYINT(2) NOT NULL DEFAULT '0' COMMENT '设备状态 0:正常1:不正常',
`s_id` INT(11) NOT NULL ,
`remainder` VARCHAR(20) DEFAULT NULL ,
PRIMARY KEY (`d_id`),
UNIQUE KEY `sn` (`sn`),
CONSTRAINT `d_device_ibfk_2` FOREIGN KEY (`s_id`) REFERENCES `t_site` (`s_id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='设备表';
CREATE TABLE `sendata` (
`se_id` INT(11) NOT NULL AUTO_INCREMENT,
`suwd` VARCHAR(4) DEFAULT NULL,
`suyl` VARCHAR(4) DEFAULT NULL,
`jsll` VARCHAR(4) DEFAULT NULL,
`jstds` VARCHAR(4) DEFAULT NULL,
`cstds` VARCHAR(4) DEFAULT NULL,
`ph` VARCHAR(4) DEFAULT NULL,
`yl` VARCHAR(4) DEFAULT NULL,
`ylv` VARCHAR(4) DEFAULT NULL,
`ycy` VARCHAR(4) DEFAULT NULL,
`zd` VARCHAR(4) DEFAULT NULL,
`rjy` VARCHAR(4) DEFAULT NULL,
`d_id` BIGINT(20) NOT NULL,
`sentem` VARCHAR(20) DEFAULT NULL,
PRIMARY KEY (`se_id`),
CONSTRAINT `sendata_ibfk_2` FOREIGN KEY (`d_id`) REFERENCES `t_device` (`d_id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
数据库新手,不管是ER图还是代码都很挫,望大神指正~~
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…