A, demo introduces the basic business functions
Just a demo, no full functionality, continue to reconstruct the system to build a highly scalable, high-performance, large data, high concurrency, distributed system architecture
Customer management, product management, shopping cart, order management, inventory management
Second, the basic data dictionary
Description: Construction now only a basic dictionary data, can be followed if necessary, be adjusted
Customer Management: uuid, customerId, pwd, showName, trueName, registerTime
Commodity Management: uuid, name, imgPath, description
Shopping Cart: uuid, customerUuid, goodsUuid, buyNum
Order Management - main order: uuid, customerUuid, orderTime, totalMoney, saveMoney, state
Order Management - child order: uuid, orderUuid, goodsUuid, orderNum, price, money, saveMoney
Inventory Management: uuid, goodsUuid, storeNum
CREATE DATABASE arch1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; drop table if exists tbl_customer; create table tbl_customer ( uuid int not null auto_increment, customerId varchar(20), pwd varchar(20), showName varchar(100), trueName varchar(100), registerTime varchar(100), primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_goods; create table tbl_goods ( uuid int not null auto_increment, name varchar(200), imgPath varchar(500), description varchar(2000), primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_cart; create table tbl_cart ( uuid int not null auto_increment, customerUuid int, goodsUuid int, buyNum int, primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_order; create table tbl_order ( uuid int not null auto_increment, customerUuid int, orderTime varchar(100), totalMoney float, saveMoney float, state smallint, primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_orderDetail; create table tbl_orderDetail ( uuid int not null auto_increment, orderUuid int, goodsUuid int, orderNum int, price float, money float, saveMoney float, primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_store; create table tbl_store ( uuid int not null auto_increment, goodsUuid int, storeNum int, primary key (uuid) ) charset=utf8 ENGINE=InnoDB; drop table if exists tbl_file; create table tbl_file ( uuid int not null auto_increment, fileName varchar(1000), remotePaths varchar(1000), primary key (uuid) ) charset=utf8 ENGINE=InnoDB;
Third, the development environment to build
3.1, the overall environment
1: Use the idea to develop
2: database with Mysql, in order to facilitate the development test, deploy locally developed good and then deployed on Linux servers
3: basic techniques: Maven + + the mybatis the Spring the Spring MVC +
4: Use the most basic front-end of: the jQuery + HTML + CSS
. 5: versioning: Github
. 6: rear added ehcache to cache mybatis query result
7: like a module developed well after the addition of X-gen to the code generation, to generate the rest of the modules based section
3.2, using maven build project
The basic building block. The public relies on the package dependencies parent project, properties are local variables
Repeatedly arranged sub-module do not need
The program is not recommended baseDAO, mysql use xml is the essence of mybatis
Four, customermgr achieve specific development
4.1, page
A way, to develop their own
Referring Code: com.github.bjlhx15.architecture.common.pageutil
And: resources \ MybatisConf.xml
It requires code with the suffix Page, type query model to increase Page
Second way, using PageHelper [Recommended]
4.2, BaseDAO basic structure
A way, to develop their own
See Project: com.github.bjlhx15.architecture.common.dao.BaseDAO
Subsequent inheritance can expand increase in inherited interfaces
Second way, using mybatis reverse engineering [Recommended]
Reverse engineer, to generate the auto custom written ext defined on the outside of
4.3, BaseService structure
Code Address: https://github.com/bjlhx15/java_architecture dev02-baseproject branch
Which com.github.bjlhx15.architecture.customermgr.Client2, com.github.bjlhx15.architecture.customermgr.Client3 is by the dao test demo services
4.4, web basic structure
Code Address: https://github.com/bjlhx15/java_architecture dev03-baseproject -web branch
Five, xgen use
5.1, xgen Profile
Code generation, generation dao, mapper, service, controller, web interface template code such manner
pom address
<dependency> <groupId>com.github.bjlhx15.xgen</groupId> <artifactId>xgen</artifactId> <version>1.0.3</version> </dependency>
github source address: https://github.com/bjlhx15/xgen.git
5.2, by generating other code module xgen [shortcut] In order to facilitate the subsequent development
Code Address: https://github.com/bjlhx15/java_architecture Dev0 . 4-branch XGEN
According customermgr module.
1, writing template: com.github.bjlhx15.arch1xgen.themes.smvclhx arch1xgen under custom
Inside the template is to generate a class template
2, Xgen generates a corresponding Vistor
3, Xgen generate desired Action
4, ThemeConf.xml to generate action and template bindings