DUMP2 企业级电商项目

正常设计数据库表,按照数据流向。

~~闭环核心业务

【1用户】登录 =》浏览【2分类】+浏览【3商品】=》加入【4购物车】=》结算【5订单】+【6收货地址】=》【7支付】

 【购物车】+【商品】=> 订单子项  

【订单子项】+【支付信息】+【收货地址】=> 订单

 

 

===========================数据库

表结构

【可分布式唯一索引】【使用 mysql 确定 user_name 唯一性】UNIQUE KEY `user_name_unique` (`username`) USING BTREE

【支持递归的分类】`parent_id` int(11) DEFAULT NULL COMMENT '父类别id当id=0时说明是根节点,一级类别',

【可配置减少数据清洗 只存相对URL】`main_image` varchar(500) DEFAULT NULL COMMENT '产品主图,url相对地址',

【较长文本】`detail` text COMMENT '商品详情'         实际上这里  varchar (容纳65535 / 3 个字符),text 容纳是 65535个字符,空间能小则小。

【精度 总20位包含2位小数】`price` decimal(20,2) NOT NULL COMMENT '价格,单位-元保留两位小数',

【购物车序列化 关联到 session => user_id】`user_id` int(11) NOT NULL

  =>【加速查询】KEY `user_id_index` (`user_id`) USING BTREE

【业务相关 实际当时付款】`payment` decimal(20,2) DEFAULT NULL COMMENT '实际付款金额,单位是元,保留两位小数',

【以数字大小清晰的订单状态 状态机】`status` int(10) DEFAULT NULL COMMENT '订单状态:0-已取消-10-未付款,20-已付款,40-已发货,50-交易成功,60-交易关闭',

【利用冗余方便】`total_price` decimal(20,2) DEFAULT NULL COMMENT '商品总价,单位是元,保留两位小数',

【组合索引 根据user_id 和 order_no 去查询】KEY `order_no_user_id_index` (`user_id`,`order_no`) USING BTREE

 

表关系    数据流向 

【不用外键、触发器】1.数据清洗麻烦 2.分布式

 

【时光机字段】create_time update_time 【查业务问题 trouble shooting】 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

maven arctype webapp 

===================================【git 初始化】

【场景是  托管平台上有一个项目,本地有一个项目】【与其相对的是 直接 git clone 下来】

【先去托管平台创建项目】

【本地项目 git 化】

README.md

.gitignore 直接复制一份

 

【git status】

【1】git init

【2】git add .

【提交到本地仓库】git commit -am "first initial commit "

【添加远程】git remote  add origin url

git pull 

【推送到远端】git push -u -f origin master  

【查看远程分支】git branch -r 

【切换到薪的分支 没有则创建】git checkout -b v1.0 origin/master

【将薪的分支 Push到远程】git push origin HEAD -u 

===================================【git 初始化】

========================================= maven pom.xml

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>

注意 compilerArguments ,需要做支付宝集成 把 lib 发到服务器上的。

==================================================== Project Stucture

 

===================================【mybatis 三剑客工具 生成器、分页】

1.确定 数据库连接上服务器了么

 

  <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                </configuration>
  </plugin>

 

创建一个  datasource.properties

db.driverLocation=C:/Dev/mysql/mysql-connector-java-5.1.38.jar
db.driverClassName=com.mysql.jdbc.Driver
db.url=jdbc:mysql://192.168.1.112:3306/mmall?characterEncoding=utf-8
db.username=mmall
db.password=123456

第一部 满足了 generatorConfig.xml 后,我们可以使用 maven plugin 执行命令 => dao+pojo+mapper.xml

 

第二步 修改mapper.xml 把 update_time create_time 交给 mysql 内置函数 now() 处理,越让开发专注业务越好。

 

分页助手

        <!-- mybatis pager -->

        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>4.1.0</version>
        </dependency>

        <dependency>
            <groupId>com.github.miemiedev</groupId>
            <artifactId>mybatis-paginator</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>com.github.jsqlparser</groupId>
            <artifactId>jsqlparser</artifactId>
            <version>0.9.4</version>
        </dependency>

 

===================================【mybatis 生成器、分页】

===================================【Spring 初始化】

我们可以从官方项目摘取下配置

【宠物医院】https://github.com/spring-projects/spring-petclinic 

https://github.com/spring-projects/spring-mvc-showcase

https://github.com/spring-projects/greenhouse

 

 

web容器 web.xml

Spring容器 applicationContext.xml

C:\AllWs\idea\mmall\src\main\resources\applicationContext-datasource.xml

C:\AllWs\idea\mmall\src\main\resources\datasource.properties

C:\AllWs\idea\mmall\src\main\resources\mmall.properties

 

SpringMVC配置 dispatcher-servlet.xml

=> inspection     spring core   autowiring for bean class 降到warning

 

locback配置

ftp配置

===================================【Spring 初始化】

 

 

 

====================================【首次提交 】

 git add .

git commit -am '首次提交'

git push

 

git branch - r    

git status 

====================================【首次提交 】

 

RESTClient 

FE

 

posted @ 2018-06-04 21:11  chenhui7373  阅读(154)  评论(0编辑  收藏  举报