zoukankan      html  css  js  c++  java
  • 图书网上商城实现(一)

    一、角色和功能

    • 用户:
      • 登录
      • 浏览图书信息
      • 添加商品到购物车
      • 下订单
      • 支付。
    • 管理员:
      • 登录
      • 管理用户信息
      • 管理商品。

    二、表设计

    实体(Entity):图书表(t_book)、用户表(t_user)、管理员表(t_admin)、图书类别表(t_category)

    关联(Relation):用户订单关联表(t_order)、订单图书关联表(t_order_item)

    三、搭建基于SpringBoot的Web开发框架

    1、新建maven项目

    2、引入spring boot的相关依赖包

    在pom.xml中加入

    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
        </parent>
        <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
            <dependency>
                <groupId>org.apache.shiro</groupId>
                <artifactId>shiro-spring</artifactId>
                <version>1.4.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.shiro</groupId>
                <artifactId>shiro-core</artifactId>
                <version>1.4.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.7</version>
            </dependency>
            <!-- Test -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
        
    
    

    3、加入配置文件

    在resource文件夹下新建application.properties文件,文件中加入

    
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver
    spring.datasource.url=jdbc:mysql://localhost:3306/shop?useUnicode=true&amp;characterEncoding=utf-8
    spring.datasource.username=root
    spring.datasource.password=root
    
    spring.jpa.properties.hibernate.hbm2ddl.auto=validate
    spring.h2.console.enabled=true
    spring.jpa.open-in-view=true
    logging.level.org.hibernate.SQL=debug
    spring.jpa.show-sql=true
    
    spring.thymeleaf.cache=false
    spring.thymeleaf.content-type=text/html
    
    

    4、新建包、实体类和Repository

  • 相关阅读:
    用jmeter通过ssl验证访问https
    github jekyll主题
    JMeter中返回Json数据的处理方法
    使用Nginx实现反向代理
    Antd 表格 -- 自定义合并行处理
    Go语言--第8章 包(package)
    GO语言 -- 第7章 接口(INTEFACE)
    GO语言--第6章 结构体
    PHP--相关扩展安装
    Go语言--第5章 函数
  • 原文地址:https://www.cnblogs.com/gloria-liu/p/8666698.html
Copyright © 2011-2022 走看看