Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learning-deploy
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王健
learning-deploy
Commits
7c05fc7a
提交
7c05fc7a
authored
9月 23, 2019
作者:
王健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
集成MySQL以及MyBatis Plus并在单元测试中查询数据通过
上级
9fd24f63
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
97 行增加
和
3 行删除
+97
-3
init.sql
db/init.sql
+12
-0
pom.xml
pom.xml
+17
-0
LearningDeployApplication.java
.../framework/learning/deploy/LearningDeployApplication.java
+3
-1
UserMapper.java
...a/cloud/epx/framework/learning/deploy/dao/UserMapper.java
+12
-0
User.java
...java/cloud/epx/framework/learning/deploy/entity/User.java
+24
-0
application.properties
src/main/resources/application.properties
+0
-1
application.yaml
src/main/resources/application.yaml
+14
-0
LearningDeployApplicationTests.java
...ework/learning/deploy/LearningDeployApplicationTests.java
+15
-1
没有找到文件。
db/init.sql
0 → 100644
浏览文件 @
7c05fc7a
#
创建用户表
CREATE
TABLE
user
(
id
BIGINT
(
20
)
PRIMARY
KEY
NOT
NULL
COMMENT
'主键'
,
name
VARCHAR
(
30
)
DEFAULT
NULL
COMMENT
'姓名'
,
age
INT
(
11
)
DEFAULT
NULL
COMMENT
'年龄'
,
email
VARCHAR
(
50
)
DEFAULT
NULL
COMMENT
'邮箱'
,
manager_id
BIGINT
(
20
)
DEFAULT
NULL
COMMENT
'直属上级id'
,
create_time
DATETIME
DEFAULT
NULL
COMMENT
'创建时间'
)
ENGINE
=
INNODB
CHARSET
=
UTF8
;
#
初始化数据
INSERT
INTO
user
(
id
,
name
,
age
,
email
,
manager_id
,
create_time
)
VALUES
(
1087982257332887553
,
'大boss'
,
40
,
'boss@baomidou.com'
,
NULL
,
'2019-01-11 14:20:20'
),(
1088248166370832385
,
'王天风'
,
25
,
'wtf@baomidou.com'
,
1087982257332887553
,
'2019-02-05 11:12:22'
),(
1088250446457389058
,
'李艺伟'
,
28
,
'lyw@baomidou.com'
,
1088248166370832385
,
'2019-02-14 08:31:16'
),(
1094590409767661570
,
'张雨琪'
,
31
,
'zjq@baomidou.com'
,
1088248166370832385
,
'2019-01-14 09:15:15'
),(
1094592041087729666
,
'刘红雨'
,
32
,
'lhm@baomidou.com'
,
1088248166370832385
,
'2019-01-14 09:48:16'
);
pom.xml
浏览文件 @
7c05fc7a
...
...
@@ -24,6 +24,23 @@
<artifactId>
spring-boot-starter-hateoas
</artifactId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.2.0
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
src/main/java/cloud/epx/framework/learningdeploy/LearningDeployApplication.java
→
src/main/java/cloud/epx/framework/learning
/
deploy/LearningDeployApplication.java
浏览文件 @
7c05fc7a
package
cloud
.
epx
.
framework
.
learningdeploy
;
package
cloud
.
epx
.
framework
.
learning
.
deploy
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
@MapperScan
(
"cloud.epx.framework.learning.deploy.dao"
)
public
class
LearningDeployApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/cloud/epx/framework/learning/deploy/dao/UserMapper.java
0 → 100644
浏览文件 @
7c05fc7a
package
cloud
.
epx
.
framework
.
learning
.
deploy
.
dao
;
import
cloud.epx.framework.learning.deploy.entity.User
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* @Description UserMapper
* @Author wangjian
* @Date 2019/9/23 6:45 下午
*/
public
interface
UserMapper
extends
BaseMapper
<
User
>
{
}
src/main/java/cloud/epx/framework/learning/deploy/entity/User.java
0 → 100644
浏览文件 @
7c05fc7a
package
cloud
.
epx
.
framework
.
learning
.
deploy
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.time.LocalDateTime
;
/**
* @Description 用户表实体类
* @Author wangjian
* @Date 2019/9/23 6:42 下午
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
User
{
private
Long
id
;
private
String
name
;
private
Integer
age
;
private
String
email
;
private
Long
managerId
;
private
LocalDateTime
createTime
;
}
src/main/resources/application.properties
deleted
100644 → 0
浏览文件 @
9fd24f63
src/main/resources/application.yaml
0 → 100644
浏览文件 @
7c05fc7a
server
:
port
:
8081
spring
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
123456
url
:
jdbc:mysql://${MYSQL-HOST:127.0.0.1}:${MYSQL-PORT:3306}/${MYSQL-DB:learning}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
logging
:
level
:
root
:
warn
cloud.epx.framework.learning.deploy.dao
:
trace
pattern
:
console
:
'
%p%m%n'
src/test/java/cloud/epx/framework/learningdeploy/LearningDeployApplicationTests.java
→
src/test/java/cloud/epx/framework/learning
/
deploy/LearningDeployApplicationTests.java
浏览文件 @
7c05fc7a
package
cloud
.
epx
.
framework
.
learningdeploy
;
package
cloud
.
epx
.
framework
.
learning
.
deploy
;
import
cloud.epx.framework.learning.deploy.dao.UserMapper
;
import
cloud.epx.framework.learning.deploy.entity.User
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
LearningDeployApplicationTests
{
@Resource
UserMapper
userMapper
;
@Test
public
void
contextLoads
()
{
List
<
User
>
users
=
userMapper
.
selectList
(
null
);
Assert
.
assertEquals
(
5
,
users
.
size
());
users
.
forEach
(
System
.
out
::
println
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论