yangyuscript / appapidemo

springboot集合mybatis使用swagger2搭建api后台
114 stars 68 forks source link

请问数据库应该怎么建?项目才能跑起来,后台的东西不会很懂 #3

Open yanmuyuana opened 5 years ago

yangyuscript commented 5 years ago

执行指令:mvn clean spring-boot:run 或者IDE中运行你的application类

application.properties放在resource文件夹下(一下是application.propertites的内容)

spring.datasource.url=jdbc:mysql://localhost:3306/db_appapidemo spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.jdbc.Driver

实体类扫描包

mybatis.type-aliases-package=com.lin.appapidemo.model

Mapper.xml文件扫描目录

mybatis.mapper-locations=classpath:mapper/*.xml

驼峰命名

mybatis.configuration.map-underscore-to-camel-case=true

tkmapper工具类

mapper.mappers=com.lin.appapidemo.util.MyMapper mapper.not-empty=false mapper.identity=MYSQL

pagehelper.helperDialect=mysql

pagehelper.reasonable=true

pagehelper.support-methods-arguments=true

pagehelper.params=count=countSql

spring-boot连接单机版Redis的配置如下:

REDIS(RedisProperties)

Redis数据库索引(默认为0)

spring.redis.database=0

Redis服务器地址

spring.redis.host=your ip

Redis服务器连接端口

spring.redis.port=6379

Redis服务器连接密码(默认为空)

spring.redis.password=123456

连接池最大连接数(使用负值表示没有限制)

spring.redis.pool.max-active=8

连接池最大阻塞等待时间(使用负值表示没有限制)

spring.redis.pool.max-wait=-1

连接池中的最大空闲连接

spring.redis.pool.max-idle=8

连接池中的最小空闲连接

spring.redis.pool.min-idle=0

连接超时时间(毫秒)

spring.redis.timeout=0

页面热部署

spring.thymeleaf.cache=false

发送邮件配置

spring.mail.host=smtp.163.com spring.mail.username=your email spring.mail.password=you auth code spring.mail.default-encoding=UTF-8

yanmuyuana commented 5 years ago

建的数据库里的表应该注意什么吗?

yangyuscript commented 5 years ago

按照appapidemo/src/main/java/com/lin/appapidemo/model/shixun/这个路径下的domain建表即可

yanmuyuana commented 5 years ago

谢谢分享