`/*
Navicat MySQL Data Transfer
Source Server : hwsql
Source Server Version : 50518
Source Host : localhost:3306
Source Database : simonshop
Target Server Type : MYSQL
Target Server Version : 50518
File Encoding : 65001
Date: 2017-02-16 09:21:41
*/
SET FOREIGN_KEY_CHECKS=0;
– Table structure for t_category
DROP TABLE IF EXISTS t_category
;
CREATE TABLE t_category
(
id
int(11) NOT NULL AUTO_INCREMENT COMMENT ‘商品类别标识符’,
name
varchar(100) NOT NULL COMMENT ‘商品类别名称’,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
– Records of t_category
INSERT INTO t_category
VALUES (‘1’, ‘家用电器’);
INSERT INTO t_category
VALUES (‘2’, ‘床上用品’);
INSERT INTO t_category
VALUES (‘3’, ‘文具用品’);
INSERT INTO t_category
VALUES (‘4’, ‘休闲食品’);
– Table structure for t_order
DROP TABLE IF EXISTS t_order
;
CREATE TABLE t_order
(
id
int(11) NOT NULL AUTO_INCREMENT COMMENT ‘订单标识符’,
username
varchar(20) DEFAULT NULL COMMENT ‘用户名’,
telephone
varchar(11) DEFAULT NULL COMMENT ‘电话号码’,
total_price
double DEFAULT NULL COMMENT ‘总金额’,
delivery_address
varchar(50) DEFAULT NULL COMMENT ‘送货地址’,
order_time
timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT ‘下单时间’,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
– Records of t_order
INSERT INTO t_order
VALUES (‘1’, ‘郑晓红’, ‘13956567889’, ‘2000’, ‘泸职院信息工程系’, ‘2016-12-25 17:12:36’);
INSERT INTO t_order
VALUES (‘2’, ‘温志军’, ‘13956678907’, ‘1000’, ‘泸职院机械工程系’, ‘2016-12-02 17:12:17’);
– Table structure for t_product
DROP TABLE IF EXISTS t_product
;
CREATE TABLE t_product
(
id
int(11) NOT NULL AUTO_INCREMENT COMMENT ‘商品标识符’,
name
varchar(200) NOT NULL COMMENT ‘商品名称’,
price
double DEFAULT NULL COMMENT ‘商品单价’,
add_time
timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
category_id
int(11) DEFAULT NULL COMMENT ‘商品类别标识符’,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
– Records of t_product
INSERT INTO t_product
VALUES (‘1’, ‘容声电冰箱’, ‘2000’, ‘2016-12-20 09:54:41’, ‘1’);
INSERT INTO t_product
VALUES (‘2’, ‘松下电视’, ‘5000’, ‘2016-12-20 09:54:35’, ‘1’);
INSERT INTO t_product
VALUES (‘3’, ‘红岩墨水’, ‘3’, ‘2016-12-20 09:56:05’, ‘3’);
INSERT INTO t_product
VALUES (‘4’, ‘海尔洗衣机’, ‘1000’, ‘2016-11-30 08:58:09’, ‘1’);
INSERT INTO t_product
VALUES (‘5’, ‘新宇电饭煲’, ‘1200’, ‘2016-12-20 09:55:11’, ‘1’);
INSERT INTO t_product
VALUES (‘6’, ‘英雄微波炉’, ‘600’, ‘2016-12-20 09:55:39’, ‘1’);
INSERT INTO t_product
VALUES (‘7’, ‘红双喜席梦思’, ‘700’, ‘2016-11-28 08:59:38’, ‘2’);
INSERT INTO t_product
VALUES (‘8’, ‘旺仔牛奶糖’, ‘24.4’, ‘2016-12-20 10:00:11’, ‘4’);
INSERT INTO t_product
VALUES (‘9’, ‘西蒙枕头’, ‘100’, ‘2016-12-20 09:56:57’, ‘2’);
INSERT INTO t_product
VALUES (‘10’, ‘甜甜毛毯’, ‘400’, ‘2016-12-20 09:57:26’, ‘2’);
INSERT INTO t_product
VALUES (‘11’, ‘永久钢笔’, ‘50’, ‘2016-12-20 09:57:30’, ‘3’);
INSERT INTO t_product
VALUES (‘12’, ‘硬面抄笔记本’, ‘5’, ‘2016-12-20 09:57:53’, ‘3’);
INSERT INTO t_product
VALUES (‘13’, ‘晨光橡皮擦’, ‘0.5’, ‘2016-11-30 09:02:40’, ‘3’);
INSERT INTO t_product
VALUES (‘14’, ‘美的空调’, ‘3000’, ‘2016-11-03 09:03:02’, ‘1’);
INSERT INTO t_product
VALUES (‘15’, ‘迷你深海鱼肠’, ‘14.4’, ‘2016-12-02 10:01:14’, ‘4’);
– Table structure for t_user
DROP TABLE IF EXISTS t_user
;
CREATE TABLE t_user
(
id
int(11) NOT NULL AUTO_INCREMENT,
username
varchar(20) NOT NULL,
password
varchar(20) DEFAULT NULL,
telephone
varchar(11) DEFAULT NULL,
register_time
timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
popedom
int(11) DEFAULT NULL COMMENT ‘0:管理员;1:普通用户’,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
– Records of t_user
INSERT INTO t_user
VALUES (‘1’, ‘admin’, ‘12345’, ‘15734345678’, ‘2016-12-02 08:40:35’, ‘0’);
INSERT INTO t_user
VALUES (‘2’, ‘郑晓红’, ‘11111’, ‘13956567889’, ‘2016-12-20 09:51:43’, ‘1’);
INSERT INTO t_user
VALUES (‘3’, ‘温志军’, ‘22222’, ‘13956678907’, ‘2016-12-20 09:52:36’, ‘1’);
INSERT INTO t_user
VALUES (‘4’, ‘涂文艳’, ‘33333’, ‘15890905678’, ‘2016-12-05 09:52:56’, ‘1’);`
单元测试类:
删除:插入:
查找全部:
按名字查找:
按ID查找:
登录:
CategoryDaoImpl的按类型查找:
cateDaoImpl的查找
Category插入数据:
Category更新数据:
Category按ID查找:Product按ID删除:
Product插入:
Product更新:
Product按ID查找:
Product查找全部:
Order按ID删除:Order插入数据:
Order更新数据:
Order按ID查找: