web后端
本周我进行了springboot框架的搭建,并辅助参与了数据库的设计
代码以及sql语句等已上传至github
概念模型
物理模型
根据mysql语句生成的数据库表
所用环境
idea2020.2.1, jdk1.8, mysql5.5, navicat11.0.10, maven3.6.3
springboot框架整体结构如下
对目前功能进行简单的测试
pom文件配置如下
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.2.5.RELEASE
com.takeaway
meal
0.0.1-SNAPSHOT
meal
meal project for Spring Boot
1.8
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.junit.vintage
junit-vintage-engine
com.alibaba
druid
1.0.29
com.baomidou
mybatis-plus-boot-starter
3.2.0
com.baomidou
mybatis-plus-generator
3.4.1
mysql
mysql-connector-java
io.springfox
springfox-swagger2
2.9.2
org.apache.velocity
velocity-engine-core
2.0
com.github.xiaoymin
swagger-bootstrap-ui
1.9.1
com.alibaba
fastjson
1.2.47
io.springfox
springfox-swagger-ui
2.9.2
io.springfox
springfox-bean-validators
2.9.2
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.6
src/main/resources/GeneratorMapper.xml
true
true
Generate MyBatis Artifacts
generate
pom文件中添加的mybatis-generator-maven-plugin插件可以自动生成代码,感觉挺好用的,需要配置GeneratorMapper.xml文件如下
/p>
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
connectionURL="jdbc:mysql://127.0.0.1:3306/meal?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"
userId="root"
password="123456">
其余代码可在github查看
另外还发现了一个比较好用的插件,叫MyBatisX,功能描述如下
mapper and xml can jump back and forth
mybatis.xml,mapper.xml prompt
mapper and xml support auto prompt like jpa (reference MybatisCodeHelperPro)
integrate mybatis generator Gui (copy from free mybatis plugin)