图书网上商城实现(一)

一、角色和功能

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

二、表设计

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

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

1309710-20180328221514489-1479769056.png

1309710-20180328221525242-1625399922.png

1309710-20180328221535613-601179589.png

三、搭建基于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

1309710-20180328223835565-1145360366.png

转载于:https://www.cnblogs.com/gloria-liu/p/8666698.html

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值