Servlet电子商城项目(入门级一)

一个电子商城分析(疯购)

数据库:crazybuy;

1

商品类别

crazybuy_ product_ category

2

商品

crazybuy_ product

3

用户

crazybuy_ user

4

订单

crazybuy_ order

5

订单详情

crazybuy_ order_detail

6

评论

crazybuy_comment

7

广告、新闻

crazybuy_news

购物车:

表字段:提供给你的,分析字段。

DROPTABLE IF EXISTS crazybuy_product_category;

createtable crazybuy_product_category(

       epc_id int primary key auto_increment,

       epc_name varchar(20) not null,

       epc_parent_id int,

       constraint fk_epc_parent_id foreign key(epc_parent_id) references crazybuy_product_category (epc_id)

);

 

DROP TABLE IF EXISTS crazybuy_product_category;

create table crazybuy_product_category(

       epc_id int primary key auto_increment,

       epc_name varchar(20) not null,

       epc_parent_id int,

       constraint fk_epc_parent_id foreign key (epc_parent_id) references crazybuy_product_category (epc_id)

);

 

insert into crazybuy_product_category values(-1,'ROOT',null);

insert into crazybuy_product_category values(null,'图书影像',-1);

insert into crazybuy_product_category values(null,'手机数码',-1);

insert into crazybuy_product_category values(null,'服饰/内衣',-1);

insert into crazybuy_product_category values(null,'珠宝/饰品',-1);

insert into crazybuy_product_category values(null,'小说',1);

insert into crazybuy_product_category values(null,'教材',1);

insert into crazybuy_product_category values(null,'其他书籍',1);

insert into crazybuy_product_category values(null,'音乐',1);

insert into crazybuy_product_category values(null,'手机',2);

insert into crazybuy_product_category values(null,'相机',2);

insert into crazybuy_product_category values(null,'数码配件',2);

insert into crazybuy_product_category values(null,'电脑',2);

insert into crazybuy_product_category values(null,'品牌女装',3);

insert into crazybuy_product_category values(null,'精品男装',3);

insert into crazybuy_product_category values(null,'内衣',3);

insert into crazybuy_product_category values(null,'时尚饰品',4);

insert into crazybuy_product_category values(null,'手表',4);

insert into crazybuy_product_category values(null,'太阳镜',4);

select * from crazybuy_product_category;

 

 

DROP TABLE IF EXISTS crazybuy_product;

create table crazybuy_product(

       ep_id  int primary key auto_increment,

       ep_name varchar(40) not null COMMENT '商品名称',

       ep_description varchar(200) COMMENT '商品描述',

       ep_price decimal(10,2) not null COMMENT '商品价格',

       ep_stock decimal(10,0) not null COMMENT '商品库存',

       ep_status decimal(6,0) default 1 COMMENT '商品状态,-1.禁用,1.普通,2.特价,3.热卖',

       epc_id int not null COMMENT '大类别 外键',

       epc_child_id int COMMENT '小类别 外键',

       ep_file_name varchar(200) not null COMMENT '图片',

       constraint fk_epc_id foreign key (epc_id) references crazybuy_product_category (epc_id),

       constraint fk_epc_child_id foreign key (epc_child_id) references crazybuy_product_category (epc_id)

);

 

insert into crazybuy_product values(null,'MIUI/小米 2A(MI2A)','小米 型号:2A(MI2A) 上市时间:2013年 13年上市月份:4月 网络类型:沃-联通',1547.00,990,2,2,9,'images/product/1.jpg');

insert into crazybuy_product values(null,'Samsung/三星 I9100G','I9100G 品牌:三星 上市时间:2011年 11年上市月份:12月 网络类型:沃-联通',1269.00,990,3,2,9,'images/product/3.jpg');

insert into crazybuy_product values(null,'Sony/索尼 LT26ii','LT26ii 品牌:索尼 上市时间:2012年 12年上市月份:8月 网络类型:沃-联通',1721.00,990,1,2,9,'images/product/4.jpg');

insert into crazybuy_product values(null,'Samsung/三星 I9100','i9100 galaxy s2 品牌:三星 上市时间:2011年 11年上市月份:7月',1684.00,990,1,2,9,'images/product/5.jpg');

insert into crazybuy_product values(null,'Huawei/华为 C8813D ','上市时间:2013年13年上市月份:2月',1028.00,990,1,2,9,'images/product/6.jpg');

insert into crazybuy_product values(null,'Samsung/三星 I9082','I9082 品牌:三星 上市时间:2012年 12年上市月份:12月 网络类型:沃-联通',889.00,990,2,2,9,'images/product/7.jpg');

insert into crazybuy_product values(null,'Sony/索尼 LT26w Xperia','LT26W 品牌:索尼 上市时间:2012年 12年上市月份:8月 网络类型:GSM/WCDMA',1769.00,990,1,2,9,'images/product/8.jpg');

insert into crazybuy_product values(null,'Sony Ericsson/索尼爱立信','LT18i/Xperia Arc S 品牌:索尼爱立信 上市时间:2011年 11年上市月份:8月',1317.00,990,1,2,9,'images/product/9.jpg');

insert into crazybuy_product values(null,'Lenovo/联想 S890','S890 品牌:联想 上市时间:2012年 12年上市月份:11月 网络类型:沃-联通',1049.00,990,1,2,9,'images/product/10.jpg');

insert into crazybuy_product values(null,'HTC T329D','品牌:HTC HTC型号:T329D 上市时间:2012年 12年上市月份:12月 网络类型:双模',1120.00,990,1,2,9,'images/product/11.jpg');

insert into crazybuy_product values(null,'LG F100','F100 品牌:LG 上市时间:2012年 12年上市月份:7月 网络类型:沃-联通 主屏尺',1091.00,990,1,2,9,'images/product/12.png');

insert into crazybuy_product values(null,'Huawei/华为 A199','A199 品牌:华为 上市时间:2013年 13年上市月份:4月 网络类型:双模',1838.00,990,3,2,9,'images/product/13.jpg');

insert into crazybuy_product values(null,'Motorola/摩托罗拉 XT788','xt788 品牌:摩托罗拉 上市时间:2012年 12年上市月份:10月 网络类型',1112.00,990,1,2,9,'images/product/14.jpg');

insert into crazybuy_product values(null,'Samsung/三星 Galaxy S 2 LTE HD','品牌:三星 上市时间:2011年 11年上市月份:11月',1498.00,990,1,2,9,'images/product/15.jpg');

insert into crazybuy_product values(null,'OPPO U705T','品牌:OPPO OPPO型号:U705T 上市时间:2012年 12年上市月份:12月 网络类型:G3',1498.00,990,1,2,9,'images/product/16.jpg');

insert into crazybuy_product values(null,'Coolpad/酷派 8730','品牌:酷派 上市时间:2013年 网络类型:G3-移动 主屏尺寸:5.0英寸',1432.00,990,3,2,9,'images/product/17.jpg');

insert into crazybuy_product values(null,'Sony/索尼 LT26I Xperia S','品牌:索尼 上市时间:2012年 12年上市月份:3月 网络类型:沃-联通',1906.00,990,1,2,9,'images/product/18.jpg');

insert into crazybuy_product values(null,'Motorola/摩托罗拉 XT910','XT910 品牌:摩托罗拉 上市时间:2011年 11年上市月份:11月 网络类型',1660.00,990,1,2,9,'images/product/19.jpg');

insert into crazybuy_product values(null,'LG LU6200 ','P930/Optimus LTE 品牌:LG 上市时间:2011年 11年上市月份:10月 网络类型',1229.00,990,1,2,9,'images/product/20.jpg');

 

 

-- 21 - 30(饰品)

insert into crazybuy_product values(null,'JPF 925纯银项链','吊坠短款锁骨首饰 韩版银饰品时尚',58.01,850,2,4,16,'images/product/21.jpg');

insert into crazybuy_product values(null,'艾念正品 925纯银手链','女士时尚韩版银首饰品,名师设计,超显气质、品味的项链',69.62,850,1,4,16,'images/product/22.jpg');

insert into crazybuy_product values(null,'银千惠925纯银手链 韩版时尚','心形首饰 生日礼物 可刻字',99.00,850,1,4,16,'images/product/23.jpg');

insert into crazybuy_product values(null,'乐天韩国进口饰品','雪纺玫瑰花蕾丝发饰头饰韩版韩式发绳发圈',31.00,850,3,4,16,'images/product/24.jpg');

insert into crazybuy_product values(null,'小天鹅水晶项链 ','女 短款 韩国 首饰 生日礼物',58.01,850,2,4,16,'images/product/25.jpg');

insert into crazybuy_product values(null,'茗琳正品采用施华洛世奇水晶项链','女短款锁骨 韩版 时尚 韩国饰品',3109.01,850,1,4,16,'images/product/26.jpg');

insert into crazybuy_product values(null,'伊泰莲娜饰品批发','日韩 可爱 甜美 光板镜面爱心 项链 送女友',15.50,850,1,4,16,'images/product/27.jpg');

insert into crazybuy_product values(null,'欧美不规则几何装饰项链锁骨链','韩国衣服配饰短款女时尚颈链饰品',19.90,850,1,4,16,'images/product/28.jpg');

insert into crazybuy_product values(null,'饰品可爱满钻五角星无耳洞耳环','饰品',14.09,850,1,4,16,'images/product/29.jpg');

insert into crazybuy_product values(null,'珍珠软链韩式短发新娘头饰套装','结婚额饰品配婚纱',39.00,850,1,4,16,'images/product/30.jpg');

-- 31 - 40(精品男装)

insert into crazybuy_product values(null,'2件79包邮 凡兔男士短袖t恤','由于这款T恤采用的是吊染工艺,所以建议亲在洗涤过程中请用冷水洗涤,请勿用温水,或者彩漂洗涤!',55.00,750,1,3,14,'images/product/31.jpg');

insert into crazybuy_product values(null,'爱立登中老年男装短袖T恤衫','高端的设计,完美的穿着效果,充分展现中老年男性的魅力!夏天单穿,秋冬打底穿,一年四季都可穿着,商务百搭,100%实拍,保证您收到货比照片更好!',49.00,750,1,3,14,'images/product/32.jpg');

insert into crazybuy_product values(null,'梦特娇2013新款男装短袖T恤','锦标,常规袖丝含量95%以上',216.00,750,1,3,14,'images/product/33.jpg');

insert into crazybuy_product values(null,'2013夏装新款 韩国无头人图案男装','此款T恤布料采用高档棉加莱卡的组合是夏季T恤首选,加入莱卡后的棉固色和耐洗涤性都增强了不少,不变形,不褪色,不透,不缩水。',39.00,750,1,3,14,'images/product/34.jpg');

insert into crazybuy_product values(null,'男夏装潮男韩版修身男士短袖t恤','独特的撞色大V领,拥有永不落伍的时尚气场,展现出个性的潮流魅力。',55.30,750,2,3,14,'images/product/35.jpg');

insert into crazybuy_product values(null,'雁翎金甲中国风短袖T恤男士半袖','吊染,常规袖,棉质,凸显中国文化。',59.00,750,1,3,14,'images/product/36.jpg');

insert into crazybuy_product values(null,'jerryjack男装2013新款夏装半袖','天然纤维拥有良好的透气性和吸湿性,好比一件会呼吸的衣服',48.00,750,2,3,14,'images/product/37.jpg');

insert into crazybuy_product values(null,'韩黛薇 短袖t恤男韩版潮男装','采用双车缝制走线,平整车工紧密细致,牢固不变,整齐简洁',49.00,750,1,3,14,'images/product/38.jpg');

insert into crazybuy_product values(null,'夏装英伦兰博基尼纯棉男士短袖','穿在身上就仿佛是在午后,靠在藤椅,任阳光洋洋散散的打在身上。',58.00,750,1,3,14,'images/product/39.jpg');

insert into crazybuy_product values(null,'新款休闲夏装男短袖男士立领T恤','压花,劲拼,纯色,宽松型,含棉量50%-69%青少年地 最佳选择。',30.00,750,1,3,14,'images/product/40.jpg');

-- 41 - 60(图书)

insert into crazybuy_product values(null,'畅销读物小小孩影院早教书','采用最尖端的印刷工艺和材料,导致我们的产品成本比其他品牌更高!网上还有一些便宜劣质童书,那些和我们是完全没有可比性的!',33.80,970,1,1,7,'images/product/41.jpg');

insert into crazybuy_product values(null,'水木乐','幼儿学习看图书 宝宝最爱早教卡书0-3岁婴儿早教认知卡片早教卡早教书认知卡片8本包邮',3.50,970,1,1,7,'images/product/42.jpg');

insert into crazybuy_product values(null,'宝贝晚安故事','包邮儿童书籍故事书早教童话图书儿童正版宝宝早教书籍睡前故事',25.80,970,1,1,7,'images/product/43.jpg');

insert into crazybuy_product values(null,'365夜','儿童故事书 宝宝睡前故事书 幼儿图书0-3岁 童话故事书 早教书 ',39.80,970,1,1,7,'images/product/44.jpg');

insert into crazybuy_product values(null,'3D立体书','早教 立体书 0-3-6岁婴幼儿宝宝书籍儿童故事书睡前图书4册包邮',35.00,970,1,1,7,'images/product/45.jpg');

insert into crazybuy_product values(null,'左右脑','易读宝 点读笔 有声图书 左右脑开发 2、3.4.5.6.7岁单本价5.8折',12.00,970,1,1,7,'images/product/46.jpg');

insert into crazybuy_product values(null,'动物','满百包邮 0-3岁宝宝撕不烂 启蒙认知卡片 儿童图书籍 yp091 16册',1.00,970,0,1,7,'images/product/47.jpg');

insert into crazybuy_product values(null,'我3岁了','小红花幼儿潜能开发我3-4-5-6岁了 儿童宝宝早教书籍 智力图书',8.80,970,1,1,7,'images/product/48.jpg');

insert into crazybuy_product values(null,'人物','包邮 0-3岁宝宝看图识字 启蒙认知 婴儿幼儿童图书籍 早教书卡片',38.00,970,3,1,7,'images/product/49.jpg');

insert into crazybuy_product values(null,'狼来了','小小孩 经典故事① 2-3-4-5-6岁儿童幼儿宝宝早教睡前故事图书籍',9.00,970,1,1,7,'images/product/50.jpg');

insert into crazybuy_product values(null,'我不给你','包邮0-3-6岁婴幼儿童话故事图书小狐狸绘本我家宝贝第1套情商管理',45.00,970,1,1,7,'images/product/51.jpg');

insert into crazybuy_product values(null,'翻一番,变一变','小红花0-1-2-3岁宝宝图书认知翻翻书 翻一翻变一变婴幼儿童书籍',6.50,970,1,1,7,'images/product/52.jpg');

insert into crazybuy_product values(null,'看图找不同','快易典有声图书《看图找不同》幼儿早教有声书点读书',40.00,970,1,1,7,'images/product/53.jpg');

insert into crazybuy_product values(null,'我喜欢书','我喜欢书 幼儿园童小学生绘本经典批发宝宝读物图书012345-67岁',3.50,970,1,1,7,'images/product/54.jpg');

insert into crazybuy_product values(null,'启蒙大卡','启蒙大卡 撕不烂早教书 0-1岁婴儿图书 宝宝认知书籍正版礼盒装',45.00,970,1,1,7,'images/product/55.jpg');

insert into crazybuy_product values(null,'恐龙','儿童小百科_恐龙图书_幼儿书籍畅销童书儿童百科全书 特价图书',27.00,970,3,1,7,'images/product/56.jpg');

insert into crazybuy_product values(null,'安全','小婴孩童书 儿童图书幼儿大开眼界百科绘本 宝宝安全教育书读本',4.00,970,1,1,7,'images/product/57.jpg');

insert into crazybuy_product values(null,'十万个为什么','满4本包邮婴幼儿童十万个为什么全套注音版畅销百科全书图书3-6岁',6.95,970,1,1,7,'images/product/58.jpg');

insert into crazybuy_product values(null,'幼儿唐诗','幼儿唐诗 宝宝早教图书 婴儿早教具 宝宝认知卡片 宝宝书',3.00,970,1,1,7,'images/product/59.jpg');

insert into crazybuy_product values(null,'汉语拼音','亲子启蒙书 早教翻翻书 认知卡 识字卡 幼儿图书 早教书 汉语拼音',3.80,970,1,1,7,'images/product/60.jpg');

-- 70 - 92(品牌女装)

insert into crazybuy_product values(null,'贝蒂艾维2013夏季女装新品韩版大码打底衫','这是一款能创造奇迹的宝贝!!!每5个女人看到它,就会有1位带它回家!!!因为它超级漂亮,还超级显瘦!因为它超级正品,还超级便宜!每个女人都爱它!!!',49.90,1000,1,3,13,'images/product/71.jpg');

insert into crazybuy_product values(null,'2013夏季 新款韩版女装假两件拼色宽松大码','雅依梦品牌最新力作!韩国2013最新人气连衣裙韩国进口版型+大牌质量=平民价格!活动期内36.8元包邮!订单量大按付款顺序排单发货!早付款早发货!你懂的!仅亏活动期!活动后恢复原价78元',36.80,1000,1,3,13,'images/product/72.jpg');

insert into crazybuy_product values(null,'夏季女装新款韩版修身蕾丝雪纺连衣裙','热卖30000件,我们一直被别人模仿,但从未被超越过,仿版横行,请认准依然纯正品购买。正品保护,实拍已经通过云图片认证,并保护中,请勿盗图',99.00,1000,1,3,13,'images/product/73.jpg');

insert into crazybuy_product values(null,'女士t恤短袖2013初夏装新款上衣半袖衣服','女士t恤短袖2013初夏装新款上衣半袖衣服韩版纯棉女装修身白色t桖,闪耀亮片 夏装纯棉短袖女T恤',74.00,1000,1,3,13,'images/product/74.jpg');

insert into crazybuy_product values(null,'半袖女装新款夏装韩版初夏宽松短袖','掌柜“疯”了,只为冲量和人气,第一批3000件已抢光,第二批限量2000件,三天抢光,现最后一批亏本500件,卖完立刻涨价,数量有限,最后一批快抢完了,亲们抓紧时间抢购!',30.00,1000,1,3,13,'images/product/75.jpg');

insert into crazybuy_product values(null,'2013夏季新款牛奶丝印花短袖V领连衣裙','每个ID限购3件,超出一件加5元邮费,以此类推,亏本冲销量,喜欢还价的亲们请绕道,见谅!',49.00,1000,1,3,13,'images/product/76.jpg');

insert into crazybuy_product values(null,'春款夏装短袖新款雪纺袖公主连衣裙','包邮!2013春款夏装短袖新款雪纺袖公主连衣裙雪纺女装打底裙L935,一件包邮!只限申通快递!',129.00,1000,1,3,13,'images/product/77.jpg');

insert into crazybuy_product values(null,'撞糖果色休闲裤超短裤女裤子夏季韩版','2013夏装新款女装 撞糖果色休闲裤超短裤女裤子夏季韩版热裤裙裤',58.00,1000,1,3,13,'images/product/78.jpg');

insert into crazybuy_product values(null,'新款夏装新品女式韩版修身上衣显瘦','注意:价格都只是目前暂时的,后面由于要考虑推广成本等,会陆续随机性涨价,所以要买要提前。另外大的码数,特别是2XL及以上的码数用料成本是XL以下码数的2倍还不止,所以是有2个价格,还请大码客户体谅 ',44.90,1000,3,3,13,'images/product/79.jpg');

insert into crazybuy_product values(null,'2013春款女装韩版夏季新款t恤','销量猛增,为了更高效的发货,本店默认圆通,申通快递,请亲们留言备注快递,备注快递者优先发货!Bling女孩,店庆冲2皇冠',29.00,1000,2,3,13,'images/product/80.jpg');

insert into crazybuy_product values(null,'包邮女装2013夏装新款 短袖T恤','季大促推广期,虽然亏本出售,但依然为亲们提供7天无理由退换服务,更低销售价格,更高的服务水准,让亲买更放心。',30.00,1000,1,3,13,'images/product/81.jpg');

insert into crazybuy_product values(null,'2013夏装卡通打底衫韩版时尚宽松t恤','T恤系列均为均码为正常码M左右,根据图片上效果的修身和宽松不同的款式分别适合155-165身高,80-120体重的MM穿着 ',19.00,1000,3,3,13,'images/product/82.jpg');

insert into crazybuy_product values(null,'2013夏装新款韩版女装V领修身上衣','简洁大方款式,是经典不败的时尚理念。中长款松紧收腰设计,完美打造黄金身材比例,蕾丝飞飞袖,优雅点缀,和夏风谈一场永不说再见的恋爱。',89.00,1000,2,3,13,'images/product/83.jpg');

insert into crazybuy_product values(null,'2013夏季新款韩版修身女t恤','原价60元,吐血价9.9元3件包邮,限量秒杀5万件!现在随便发个快递都十几元,本款衣服只售价9.9元5万件卖完恢复29.9元不包邮,欲购从速!抓住机会我们用事实说话',9.90,1000,1,3,13,'images/product/84.jpg');

insert into crazybuy_product values(null,'2013夏季碎花吊带裙圆点连衣裙夏','马上购买,即送限量版,价值29.9元店铺全年包邮卡(非实物卡)!',39.00,1000,3,3,13,'images/product/85.jpg');

insert into crazybuy_product values(null,'夏款女装修身雪纺裙子连衣裙','数量有限、心动还需行动,按照亲们的付款顺序发货,涨价在即先拍先发货,限时再打折只需29.8元,送模特身上原装腰带还包邮!另送神秘小礼物····',29.80,1000,2,3,13,'images/product/86.jpg');

insert into crazybuy_product values(null,'韩版女装时尚半袖修身款无袖女款T恤 ','喜欢的MM先收藏好下宝贝,过期不候!原价:78元,今日抢拍价:28元,还包邮',28.00,1000,1,3,13,'images/product/87.jpg');

insert into crazybuy_product values(null,'新款连衣裙女吊带工字背心长裙背心裙','这款连衣裙采用的是莫代尔的面料,(*^__^*) 嘻嘻……给力吧,买了绝不后悔,不买才会后悔噢!亲们,注意了。别家110CM的都要卖到45元哦。',19.90,1000,3,3,13,'images/product/88.jpg');

insert into crazybuy_product values(null,'上衣打底衫女装韩版t恤雪纺衫短袖','朋友休闲聚会 婚宴 派对等,让你格外抢眼 压倒群芳!!同样也是女人衣橱里值得收藏的一件,质量有保证,超美的限量版··珍藏版·人手必备··',39.50,1000,3,3,13,'images/product/89.jpg');

insert into crazybuy_product values(null,'2013夏季新款韩版女装包臀短袖T恤 ','2013夏季新款韩版女装胖MM大码蝙蝠袖宽松休闲中长款包臀短袖T恤',33.00,1000,1,3,13,'images/product/90.jpg');

-- 90 - 92(太阳镜)

insert into crazybuy_product values(null,'威派男士太阳镜男','威派A690男士偏光太阳镜墨镜偏光男士铝美镜腿司机镜,新店开业,3折大促,此款现在仅45元秒杀,涨价是必然的,请亲尽早下手,涨价了可不再少价了的哦',45.00,800,2,4,18,'images/product/91.jpg');

insert into crazybuy_product values(null,'街拍欧美复古大圆形太阳眼镜女墨镜','2013年度亏本促销,市场价在:60-180元左右,包邮并配送:1、眼镜袋 2、眼镜布,亏本价 亏本赚吆喝!请勿再议价,谢谢您的理解!!',21.90,800,3,4,18,'images/product/92.jpg');

 

select * from crazybuy_product

DROP TABLE IF EXISTS crazybuy_user;

create table crazybuy_user(

       eu_user_name varchar(20) primary key COMMENT '用户名',

       eu_password varchar(20) not null COMMENT '密码',

       eu_actual_name varchar(20) not null COMMENT '真实姓名',

       eu_sex char(2) default '男' not null COMMENT '性别',

       eu_email varchar(20) not null COMMENT '电子邮件',

       eu_mobile varchar(11) not null COMMENT '电话',

       eu_address varchar(200) not null COMMENT '地址',

       eu_photo_url varchar(100) COMMENT '头像',

       eu_status decimal(6,0) default 1 COMMENT '1为普通用户,2为管理员'

);

 

-- table crazybuy_user

insert into crazybuy_user values('admin','admin','李明','男','admin@163.com','15939923063','河南郑州金水区','',2);

insert into crazybuy_user values('zs12345','zs12345','张三','男','zhangsan@163.com','15938750383','河南郑州金水区','',1);

insert into crazybuy_user values('lucy','lucy12345','路西','女','lucy111@163.com','13523451532','北京朝阳区','',1);

insert into crazybuy_user values('tom','tom12345','汤姆','男','tom111@163.com','15138006548','河南郑州二七区','',1);

insert into crazybuy_user values('jack','jack12345','杰克','男','jack111@163.com','15939980758','上海市丰庆路','',1);

select * from crazybuy_user;

 

 

--create table crazybuy_order(订单表)

DROP TABLE IF EXISTS crazybuy_order;

create table crazybuy_order(

       eo_id int primary key auto_increment,

       eo_user_name varchar(20) not null,

       eo_user_address varchar(200) not null,

       eo_create_time datetime not null,

       eo_status decimal(6,0) not null  COMMENT '1下单,2审核通过,3配货,4送货中,5收货并确认',

       eo_type decimal(6,0) not null   COMMENT '1货到付款,2网上支付',

       constraint fk_eo_user_name foreign key (eo_user_name) references crazybuy_user (eu_user_name)

);

-- create table crazybuy_order_detail(订单详情表)

DROP TABLE IF EXISTS crazybuy_order_detail;

create table crazybuy_order_detail(

       eod_id int primary key auto_increment,

       eo_id int not null COMMENT '订单id',

       ep_id int not null COMMENT '商品id',

       eod_decimal decimal(6,0) not null COMMENT '数量',

       constraint fk_eo_id foreign key (eo_id) references crazybuy_order (eo_id),

           constraint fk_ep_id foreign key (ep_id) references crazybuy_product (ep_id)

);

-- create table crazybuy_news(新闻表)

DROP TABLE IF EXISTS crazybuy_news;

create table crazybuy_news(

       en_id int primary key auto_increment,

       en_title varchar(40) unique not null COMMENT '标题',

       en_content varchar(1000) not null COMMENT '内容',

       en_create_time datetime default now() COMMENT '创建时间'

);

--create table crazybuy_comment(留言表)

DROP TABLE IF EXISTS crazybuy_comment;

create table crazybuy_comment(

       ec_id int primary key auto_increment,

       ec_reply varchar(200)  COMMENT '回复',

       ec_content varchar(200) not null  COMMENT '回复内容',

       ec_create_time datetime not null  COMMENT '创建时间',

       ec_reply_time datetime  COMMENT '回复时间',

       ec_user_name varchar(20) not null  COMMENT '用户名',

       constraint fk_ec_user_name foreign key (ec_user_name) references crazybuy_user (eu_user_name)

);

 

 

 

表与表之间的关联关系

 

前期准备工作:搭建后台

导入模板文件:

ctrl+s能自动格式化代码,导包,去掉多余的包。



1.    建实体(表与实体的对应)

1.1表名:crazybuy_ product_ category

实体名:ProductCategory

        /**编号*/
private int id; 
/**分类名称*/
private String name; 
/**父分类编号*/
private int parentId; 

1.2表名:crazybuy_ product

实体名:Product

        /**编号*/
private int id;
/**商品名*/
private String name;
/**商品描述*/
private String description; 
/**单价*/
private double price; 
/**库存*/
private int stock; 
/**商品状态,-1禁用,1表示普通,2表示特价,3表示热卖*/
private int status; 
/**所属分类id*/
private int epcId;  
/**说书子分类id*/
private int epcChildId; 
/**商品图片路径*/
private String fileName; 
/**购买数量,用于购物车显示数量*/
private int buyCount; 

1.3表名:crazybuy_ user

实体名:User

/**用户名*/
private String userName;
/** 密码*/
private String password;
/**真实姓名*/
private String actualName;
/**性别*/
private String sex; 
/**Email*/
private String email; 
/**手机号*/
private String mobile;
/**住址*/
private String address; 
/**头像路径*/
private String photoUrl; 
/**状态 1为普通用户 2为管理员*/
private int status; 

1.4表名:crazybuy_ order

实体名:Order

1.5表名:crazybuy_ order_detail

实体名:OrderDetail

1.6表名:crazybuy_comment

实体名:Comment

1.7表名:crazybuy_news

实体名:News

2.    写DbUtil

3.    写Dao


项目结构

各个接口中的方法

UserDao

package com.crazybuy.dao;

 

import java.util.List;

 

import com.crazybuy.entity.User;

 

/**

 * 用户数据访问层接口

 *

 * @author 汤Emily

 * @version 2017-4-16

 */

public interface UserDao {

         /**

          * 登陆

          *

          * @param user

          *            用户对象

          * @return 用户对象

          */

         public User login(User user) throws Exception;

 

         /**

          * 查找用户

          *

          * @param user

          *            用户

          * @return 用户集合对,为null则表示未找到

          */

         public List<User> findUser(User user) throws Exception;

 

         /**

          * 添加用户

          *

          * @param user

          *            用户对象

          * @return 受影响的行数

          */

         public int insert(User user) throws Exception;

 

         /**

          * 验证用户名是否存在

          *

          * @param userName

          *            用户名

          * @return

          */

         public boolean checkUserNameIsExist(String userName) throws Exception;

 

         /**

          * 获取所有用户

          *

          * @return 用户集合

          */

         public List<User> getUsers() throws Exception;

 

         /**

          * 通过用户名获取用户信息

          *

          * @param userName

          *            用户名

          * @return 用户对象

          */

         public User getUserByUserName(String userName) throws Exception;

 

         /**

          * 更新用户信息

          *

          * @param user

          *            用户对象

          * @return true成功 false失败

          */

         public boolean update(User user) throws Exception;

 

         /**

          * 删除一个用户

          *

          * @param userName

          *            用户名

          * @return true成功 false失败

          */

         public boolean delete(String userName) throws Exception;

}

 

ProductCategoryDao

package com.crazybuy.dao;

 

import java.util.List;

 

import com.crazybuy.entity.ProductCategory;

 

/**

 * 商品类别数据访问层接口

 *

 * @author 汤Emily

 * @version 2017-4-16

 */

public interface ProductCategoryDao {

         /**

          * 获取所有商品类别

          *

          * @return 商品类别集合

          */

         public List<ProductCategory> getAll() throws Exception;

 

         /**

          * 通过ID获取一个类别

          *

          * @param id

          *            编号

          * @return 商品类别对象

          */

         public ProductCategory getProductCategoryById(int id) throws Exception;

 

         /**

          * 添加商品类别

          *

          * @param pc

          *            商品类别对象

          * @return true成功 false失败

          */

         public boolean insert(ProductCategory pc) throws Exception;

 

         /**

          * 更新商品类别

          *

          * @param pc

          *            商品类别对象

          * @return true成功 false失败

          */

         public boolean update(ProductCategory pc) throws Exception;

 

         /**

          * 通过ID删除商品类别

          *

          * @param id

          *            编号

          * @return true成功 false失败

          */

         public boolean deleteById(int id) throws Exception;

 

         /**

          * 通过父分类ID删除商品类别

          *

          * @param id

          *            父分类编号

          * @return true成功 false失败

          */

         public boolean deleteByParentId(int id) throws Exception;

}

 

ProductDao

package com.crazybuy.dao;

 

import java.util.List;

 

import com.crazybuy.entity.Product;

 

/**

 * 商品数据访问层接口

 *

 * @author 汤Emily

 * @version 2017-4-16

 */

public interface ProductDao {

         /**

          * 通过商品状态获取部分商品

          *

          * @param Status

          *            商品状态

          * @param number

          *            商品条数

          * @return 商品集合

          */

         public List<Product> getProductsByStatus(int status, int number)

                            throws Exception;

 

         /**

          * 通过类别获取商品,并限制数据范围

          *

          * @param id

          *            商品类别ID

          * @param level

          *            类别级别 * 1.类别级别 id不是-1,level不是-1,查大类 2.level为2就查子类数量

          *            3.id=-1,level为-1(代表根) ep_status状态没禁用 查所有的商品

          * @param pageSize

          *            每页显示数量

          * @param pageIndex

          *            页码

          * @return 商品集合

          */

         public List<Product> getProductsByCategory(int id, int level, int pageSize,

                            int pageIndex) throws Exception;

 

         /**

          * 获取指定商品类别ID的商品数量,level就是控制调哪一条 sql语

          *

          * @param id

          *            商品类别ID

          * @param level

          *            类别级别 * 1.类别级别 id不是-1,level不是-1,查大类 2.level为2就查子类数量

          *            3.id=-1,level为-1(代表根) ep_status状态没禁用 查所有的商品

          * @return 商品数量

          */

         public int getCountByCategory(int id, int level) throws Exception;

 

         /**

          * 获取可以显示的总页数

          *

          * @param count

          *            商品数量

          * @param pageSize

          *            每页显示数量

          * @return 总页数 10条数据,每页显示3条,求多少页4 10%3==0?10/3 : 10/3+1

          */

         public int getTotalPages(int count, int pageSize) throws Exception;

 

         /**

          * 通过ID获取商品信息

          *

          * @param id

          *            商品ID

          * @return 商品对象

          */

         public Product getProductById(int id) throws Exception;

 

         /**

          * 通过ID删除商品

          *

          * @param id

          *            编号

          * @param columnType

          *            列类型。 1:商品ID 2:分类ID 3:子分类ID

          * @return true成功 false失败

          */

         public boolean deleteById(int id, int columnType) throws Exception;

 

         /**

          * 添加一条商品

          *

          * @param product

          *            商品对象

          * @return true成功 false失败

          */

         public boolean insert(Product product) throws Exception;

 

         /**

          * 更新一条商品

          *

          * @param product

          *            商品对象

          * @return true成功 false失败

          */

         public boolean update(Product product) throws Exception;

 

         /**

          * 禁用一个商品

          *

          * @param id

          *            商品ID

          * @return true成功 false失败

          */

         public boolean setDisable(int id) throws Exception;

}

上面三个dao要求当天完成。

三个dao接口实现类中sql语句参考:

UserDaoImpl

package com.crazybuy.dao.impl;

 

import java.util.List;

 

import com.crazybuy.dao.UserDao;

import com.crazybuy.entity.User;

 

public class UserDaoImpl implements UserDao {

 

         @Override

         public boolean checkUserNameIsExist(String userName) throws Exception {

                   String sql = "select 1 from crazybuy_user where eu_user_name=?";

                   return false;

         }

 

         @Override

         public boolean delete(String userName) throws Exception {

                   String sql = "delete from crazybuy_user where eu_user_name = ?";

                   return false;

         }

 

         @Override

         public List<User> findUser(User user) throws Exception {

                   String sql = "select * from crazybuy_user where eu_user_name=? and eu_password=?";

                   return null;

         }

 

         @Override

         public User getUserByUserName(String userName) throws Exception {

                   String sql = "select * from crazybuy_user where eu_user_name = ?";

                   return null;

         }

 

         @Override

         public List<User> getUsers() throws Exception {

                   String sql = "select * from crazybuy_user";

                   return null;

         }

 

         @Override

         public int insert(User user) throws Exception {

                   String sql = "insert into crazybuy_user values(?,?,?,?,?,?,?,?,default)";

                   return 0;

         }

 

         @Override

         public User login(User user) throws Exception {

                   String sql = "select * from crazybuy_user where eu_user_name=? and eu_password=?";

                   return null;

         }

 

         @Override

         public boolean update(User user) throws Exception {

                   String sql = "update crazybuy_user set eu_password=?,eu_actual_name=?,eu_sex=?,eu_email=?,eu_mobile=?,eu_address=? where eu_user_name=?";

                   return false;

         }

 

}

ProductCategoryDaoImpl

package com.crazybuy.dao.impl;

 

import java.util.List;

 

import com.crazybuy.entity.ProductCategory;

 

public class ProductCategoryDaoImpl implements

                   com.crazybuy.dao.ProductCategoryDao {

 

         @Override

         public boolean deleteById(int id) throws Exception {

                   String sql = "delete from crazybuy_product_category where epc_id = ?";

                   return false;

         }

 

         @Override

         public boolean deleteByParentId(int id) throws Exception {

                   String sql = "delete from crazybuy_product_category where epc_parent_id = ?";

                   return false;

         }

 

         @Override

         public List<ProductCategory> getAll() throws Exception {

                   String sql = "select * from crazybuy_product_category";

                   return null;

         }

 

         @Override

         public ProductCategory getProductCategoryById(int id) throws Exception {

                   String sql = "select * from crazybuy_product_category where epc_id = ?";

                   return null;

         }

 

         @Override

         public boolean insert(ProductCategory pc) throws Exception {

                   String sql = "insert into crazybuy_product_category(epc_name,epc_parent_id) values(?,?)";

                   return false;

         }

 

         @Override

         public boolean update(ProductCategory pc) throws Exception {

                   String sql = "update crazybuy_product_category set epc_name=?,epc_parent_id=? where epc_id=?";

                   return false;

         }

 

}

ProductDaoImpl

package com.crazybuy.dao.impl;

 

import java.util.List;

 

import com.crazybuy.dao.ProductDao;

import com.crazybuy.entity.Product;

 

public class ProductDaoImpl implements ProductDao {

 

         @Override

         public boolean deleteById(int id, int columnType) throws Exception {

                   String sql = "delete from crazybuy_product where";

                   if (columnType == 1) {

                            sql += " ep_id = ?";

                   } else if (columnType == 2) {

                            sql += " epc_id = ?";

                   } else if (columnType == 3) {

                            sql += " epc_child_id = ?";

                   } else {

                            return false;

                   }

                   return false;

         }

 

         @Override

         // 1 2

         public int getCountByCategory(int id, int level) throws Exception {

                   String sql = "select count(*) from crazybuy_product where epc_id = ? and ep_status != -1";

                   if (level == 2) {

                            sql = "select count(*) from crazybuy_product where epc_child_id = ? and ep_status != -1";

                   }

                   if (id == -1 && level == -1) {

                            sql = "select count(*) from crazybuy_product where ep_status != -1";

                   }

                   //

                   return 0;

         }

 

         @Override

         public Product getProductById(int id) throws Exception {

                   String sql = "select * from crazybuy_product where ep_id = ?";

                   return null;

         }

 

         @Override

         public List<Product> getProductsByCategory(int id, int level, int pageSize,

                            int pageIndex) throws Exception {

                   String sql = "select * from crazybuy_product where epc_id = ? and ep_status != -1 limit ?,?";

                   if (level == 2) {

                            sql = "select * from crazybuy_product where epc_child_id = ? and ep_status != -1 limit ?,?";

                   }

                   if (id == -1 && level == -1) {

                            sql = "select * from crazybuy_product where ep_status != -1 limit ?,?";

                   }

                   return null;

         }

 

         @Override

         public List<Product> getProductsByStatus(int status, int number)

                            throws Exception {

                   String sql = "select * from crazybuy_product where ep_status = ?  limit 0,?";

                   return null;

         }

 

         @Override

         public int getTotalPages(int count, int pageSize) throws Exception {

                   return count % pageSize == 0 ? count / pageSize : count / pageSize + 1;

         }

 

         @Override

         public boolean insert(Product product) throws Exception {

                   String sql = "insert into crazybuy_product values(null,?,?,?,?,?,?,?,?)";

                   return false;

         }

 

         @Override

         public boolean setDisable(int id) throws Exception {

                   String sql = "update crazybuy_product set ep_status=-1 where ep_id=?";

                   return false;

         }

 

         @Override

         public boolean update(Product product) throws Exception {

                   String sql = "update crazybuy_product set ep_name=?,ep_description=?,ep_price=?,ep_stock=?,ep_status=?,epc_id=?,epc_child_id=?,ep_file_name=? where ep_id=?";

                   return false;

         }

 

}

 请大家完成实现类。


电子商城使用说明书 配置源程序 附加数据库SQL Server 2005 (1)将TM\03\ Database文件夹中的扩展名为db_shopping_Data.MDF和db_shopping_Log.LDF的两个文件拷贝到SQL Server安装路径下的Data文件夹中。 (2)打开SQL Server 2005中的“SQL Server Management Studio”,然后展开本地服务器,在“数据库”数据项上单击鼠标右键,在弹出的快捷菜单中选择“所有任务”/“附加数据库”菜单项。 (3)将弹出“附加数据库”对话框,在该对话框中单击【】按钮,选择所要附加数据库的db_shopping_Data.MDF文件,单击【确定】按钮,即可完成数据库的附加操作。 将程序发布到Tomcat下 (1)将“TM\03”文件夹拷贝到Tomcat安装路径下的webapps文件夹中。 (2)选择开始菜单中的“所有程序\Apache Tomcat 6.0\Monitor Tomcat”命令,这时在windows的系统托盘中会显示标识Tomcat服务器启动状态的图标,如果显示为,则说明Tomcat服务器没有启动,这时可以在该图标上单击鼠标右键在弹出的快捷菜单中选择“Start Service”菜单项启动Tomcat服务器,启动后将显示为。 (3)打开IE浏览器,在地址栏中输入http://localhost:8080/,进入“Tomcat软件管理”页面。 注意:8080为安装Tomcat时设置的端口号。 (4)单击Tomcat Manager超链接,弹出“连接到 localhost”对话框。 (5)在用户名及密码处输入登录Tomcat的用户名和密码,单击【确定】按钮。 (6)进入“Tomcat应用程序管理”页面,在此页面中单击“03”,进入本程序主页面,完成Tomcat配置。 导入所应用的包 在运行本程序时,需要将Struts 1.2、jspSmartUpload和SQL Server 2005数据库驱动包拷贝到Tomcat安装路径下的webapps文件夹中的03\WEB-INF\lib文件夹中。 使用说明 系统介绍 如今是网络化的电子信息时代,在广阔的Internet网络中有各种各样的电子商城,它们可以使客户通过网络购物、浏览商品、查询订单和销售排行。通过对电子商务网站订购环境以及购物过程的调查研究,要求系统具有以下功能: 展示网站最新的商品信息。 展示网站特价的商品信息。 为用户提供修改个人资料和查看在网站操作情况的平台。 提供用户在网站上购物的平台。 展示网站发布的公告信息。 展示商品的销量排行。 展示网站的友情链接信息。 对商品详细信息以及分类信息进行管理。 对用户基本资料、交易制度、消费情况及留言信息进行管理。 对用户提交的订单进行管理。 对管理员信息、网站公告信息、商业资讯信息及友情链接信息进行管理。 系统运行稳定,具有强大的数据处理能力。 操作注意事项 (1)本系统的用户名为:tsoft,密码为:111 (2)tsoft管理员的信息不能删除。 (3)用户注册登录后,可进行商品购买、商品信息查看以及订单查询操作。 (4)单击网站首页左侧底部将会出现“进入后台”按钮,输入用户名和密码即可进入后台管理页面,如图1.1所示。 操作流程 1.前台 (1)用户注册登录后,对销售排行、新品上架及特价商品的详细信息进行查看、购买操作。 注意:如果你忘记注册的密码,本程序提供了找回密码的功能,根据提示操作可找回密码。 (2)单击“订单查询”导航按钮,可对已下的订单信息查询操作。 (3)单击“购物车”导航按钮,对购物车中的商品进行查询操作。 (4)单击“会员修改”导航按钮,对会员信息进行修改操作。 2.后台 所有前台的信息都在后台进行、添加、修改及删除等管理 (1)单击“商品设置”按钮,可对商品的大类别信息、商品小类别信息以及商品信息的添加、修改、删除及查询操作。 例如添加商品大类: 单击“大类别查询”按钮,如图1.2所示,进入大类别信息页面。 图1.2 选择“大类别查询” ②在该页面中单击“添加大类”按钮,如图1.3所示。进入大别类添加页面。 图1.3 选择“添加大类别” ③在“大类别名称”文本框中输入需要添加的类别信息,然后单击“确定”按钮,大类别信息添加完成。如图1.4所示。 图1.4 添加大类别名称 (2)单击“会员设置”按钮,对所有注册的会员信息进行查看以及删除操作。 (3)单击“后台管理员设置”按钮,可对管理员信息的添加、修改以删除操作。 (4)单击“订单设置”按钮,查询订单是否出货及删除操作。 (5)单击“公告设置”按钮,对公告信息的添加、修改、查询以及删除操作。 (6)单击“友情设置”按钮,对网站名称、网址等信息进行添加和删除操作。 (7)单击“安全退出”按钮,退出后台管理页面。
摘要信息: 电子商城系统主要功能包括:用户注册、用户登录、用户查看商城商品、用户购买商品、用户查看购物车并且清空购物车、用户找回账户以及密码、管理员登录、管理员注册、管理员查看用户信息、管理员删除用户信息、管理员删除商品信息、管理员添加商品信息、管理员修改商品信息、退出登录等。 图形可视化界面运行下能够显示系统启动进度条,删除、添加、注册等相关操作时能够弹出窗口加以提示,退出登录或系统时能够做到单击确认退出按钮才退出登录或系统,能够对用户加以提示。 注册用户或是管理员、添加商品信息、购买商品、删除商品或是用户信息、修改商品信息等相关操作时能够判断有无该用户或是商品。 用户在购买商品的时候同时更新商品的库存数量,管理员删除管理员时可以做到同时删除用户的购买信息。 主要内容: 项目名称   基于JAVASE的电子商城系统 二、功能要求 1、用户注册 2、用户登录 3、用户查看商品列表 4、用户购买商品 5、用户查看购买商品列表 6、用户清空购物车 7、用户找回账户和密码 8、管理员登录 9、管理员注册 10、查看用户信息 11、查看商品信息 12、删除用户信息 13、删除商品信息 14、添加商品信息 15、修改商品信息 16、退出用户登录 17、退出管理员登录 18、退出商城 三、需求分析 该系统的用户是商城消费者和商城管理者,根据客户的要求,可以注册、登录、购物、查看购物车信息、找回账户和密码,管理员可以对商品信息进行增加、修改、删除操作,可以对用户进行查看和删除。 四、设计思想 1、在控制台与图形可视化界面下运行 2、使用Mysql数据库存取用户登录信息和商品信息 3、使用List存取商品购买信息 4、把程序分为多个类,多个类之间的互相调用。 5、用户或是管理员进行注册、登录时能够提供校验码。 6、用户或是管理员获取数据库信息时能够与数据库进行交互。 7、用户购物要做到简洁明了。 8、用户只需要身份证号码和邮箱地址就能找回账户和密码。 9、注册、删除、修改等操作要有信息提示。 10、用户、管理员进行操作时能够做到操作提示与用户名提示。 11、退出登录或是退出系统时能够做到让用户有所考虑。 五、具体实现   1、技术思路: 界面:基于控制台与图形可视化界面(Swing)实现用户的输入和输出。 程序流程:在函数中利用循环与递归 ,读取用户输入,调用模块实现各个子功能。 2、功能子模块划分: ① 注册模块 ② 登录模块 ③ 查看商品模块(查看商品列表,购买商品) ④ 查看购买商品信息 ⑤ 管理员登录(添加管理员信息,对商品信息进行查看、增加、 修改、删除,对用户信息进行查看、删除,删除用户信息 时能够做到同时删除消费记录) ⑥ 退出系统 六、运行截图 1、商城系统启动进度条(进度条能够做到动态加载): 2、商城主界面: 3、用户注册界面(填写注册信息不符合要求时能够弹窗提示、并 且判断用户名是否重复等): 4、用户登录界面(账户、密码不致时能弹窗提示): 5、用户服务选择界面(能够提示用户名): 6、购买商品界面(能够判断输入的商品序号是否正确): 7、查看购物车界面(能够键清空购物车): 8、查看商城商品信息界面: 9、管理员登录界面: 10、找回账户与密码界面: 11、管理员服务选择界面: 12、添加管理员界面: 13、查看用户信息界面: 14、删除用户信息界面: 15、删除商品信息界面: 16、添加商品信息界面: 17、修改商品信息界面: 18、退出账号、管理员登录、商城系统时要有提示:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤永红

一分也是爱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值