zoukankan      html  css  js  c++  java
  • 002-demo业务说明

    一、demo基本业务功能介绍

      只是demo,无完整功能,不断重构系统,以搭建 高可扩展性、高性能、大数据、高并发、分布式的系统架构

      客户管理、商品管理、购物车、订单管理、库存管理

    二、基本数据字典

      说明:现在只构建一个最基本的数据字典,后面可以根据需要,进行调整

      客户管理:uuid、customerId、pwd、showName、trueName、registerTime

      商品管理:uuid、name、imgPath、description

      购物车:uuid、customerUuid、goodsUuid、buyNum

      订单管理——主订单:uuid、customerUuid、orderTime、totalMoney、saveMoney 、state

      订单管理——子订单:uuid、orderUuid、goodsUuid、orderNum、price、money、saveMoney

      库存管理: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;
    View Code

    三、开发环境搭建

    3.1、整体环境

    1:使用idea开发
    2:数据库用Mysql,为了开发测试方便,先部署在本地,开发好了再部署到Linux服务器上
    3:基本的技术:Maven+Spring mvc+spring+mybatis
    4:前端使用最基本的:jQuery+html+css
    5:版本管理:Github
    6:后面再加入ehcache来缓存mybatis的查询结果
    7:等一个模块开发好了过后,加入X-gen来进行代码生成,以生成其余模块的基础部分

    3.2、使用maven搭建项目

      搭建基本模块。将公共的包依赖放在父项目的 dependencies 中,properties 是本地变量

      子模块就不需要重复配置

      程序中,不推荐使用baseDAO,mysql使用xml是mybatis精华

    四、customermgr具体开发实现

    4.1、分页

    方式一、自己开发

    参看代码:com.github.bjlhx15.architecture.common.pageutil

      以及:resourcesMybatisConf.xml

      还需要代码配合后缀Page,查询模型增加Page类

    方式二、使用PageHelper【推荐】

    4.2、BaseDAO基本结构

    方式一、自己开发

      参看项目中:com.github.bjlhx15.architecture.common.dao.BaseDAO

      后续继承即可,扩展在继承的接口中增加

    方式二、使用mybatis逆向工程【推荐】

      使用逆向工程,生成至auto中,自定义写在外面定义成ext的

    4.3、BaseService结构

    代码地址:https://github.com/bjlhx15/java_architecture  dev02-baseproject分支

    其中com.github.bjlhx15.architecture.customermgr.Client2 、com.github.bjlhx15.architecture.customermgr.Client3是通过services测试dao的demo

    4.4、web基本结构 

    代码地址:https://github.com/bjlhx15/java_architecture  dev03-baseproject-web分支

    五、xgen使用

    5.1、xgen简介

      代码生成,通过模板方式生成dao,mapper,service,controller,web界面等代码

    pom地址

            <dependency>
                <groupId>com.github.bjlhx15.xgen</groupId>
                <artifactId>xgen</artifactId>
                <version>1.0.3</version>
            </dependency>

    github源码的地址:https://github.com/bjlhx15/xgen.git

    5.2、通过xgen生成其他模块代码【快捷方式为了便于后续的开发】

    代码地址:https://github.com/bjlhx15/java_architecture  dev04-xgen 分支

    根据customermgr 模块。

      1、编写模板:arch1xgen下的 com.github.bjlhx15.arch1xgen.themes.smvclhx 自定义

        内部的template 就是 要生成的类的模板

      2、Xgen 生成对应的Vistor

      3、Xgen 生成需要的Action

      4、ThemeConf.xml 要生成的action和模板绑定

  • 相关阅读:
    comet技术
    OCP-1Z0-052-V8.02-120题
    OCP-1Z0-052-V8.02-121题
    OCP-1Z0-052-V8.02-122题
    OCP-1Z0-052-V8.02-124题
    OCP-1Z0-052-V8.02-125题
    OCP-1Z0-052-V8.02-126题
    OCP-1Z0-052-V8.02-127题
    RMAN 备份脚本
    Oracle DB 性能视图和数据字典
  • 原文地址:https://www.cnblogs.com/bjlhx/p/10920413.html
Copyright © 2011-2022 走看看