Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
Mybatis Jpa Extra
提交
a4a15ca2
M
Mybatis Jpa Extra
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
Mybatis Jpa Extra
8 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Mybatis Jpa Extra
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a4a15ca2
编写于
5月 26, 2019
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm
上级
79ef4b5c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
49 deletion
+14
-49
README.md
README.md
+14
-49
未找到文件。
README.md
浏览文件 @
a4a15ca2
...
...
@@ -212,12 +212,11 @@ public class MyBatisTestRunner {
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
MyBatisTestRunner
.
class
);
public
static
ApplicationContext
context
;
public
static
StudentsService
service
;
@Test
public
void
insert
()
throws
Exception
{
_logger
.
info
(
"insert..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
Students
student
=
new
Students
();
student
.
setStdNo
(
"10024"
);
student
.
setStdGender
(
"M"
);
...
...
@@ -225,17 +224,15 @@ public class MyBatisTestRunner {
student
.
setStdAge
(
20
);
student
.
setStdMajor
(
"政治"
);
student
.
setStdClass
(
"4"
);
s
s
.
insert
(
student
);
s
ervice
.
insert
(
student
);
Thread
.
sleep
(
1000
);
s
s
.
remove
(
student
.
getId
());
s
ervice
.
remove
(
student
.
getId
());
}
@Test
public
void
get
()
throws
Exception
{
_logger
.
info
(
"get..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
Students
student
=
ss
.
get
(
"921d3377-937a-4578-b1e2-92fb23b5e512"
);
Students
student
=
service
.
get
(
"921d3377-937a-4578-b1e2-92fb23b5e512"
);
_logger
.
info
(
"Students "
+
student
);
}
...
...
@@ -243,33 +240,27 @@ public class MyBatisTestRunner {
@Test
public
void
remove
()
throws
Exception
{
_logger
.
info
(
"remove..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
Students
student
=
new
Students
();
student
.
setId
(
"921d3377-937a-4578-b1e2-92fb23b5e512"
);
s
s
.
remove
(
student
.
getId
());
s
ervice
.
remove
(
student
.
getId
());
}
@Test
public
void
batchDelete
()
throws
Exception
{
_logger
.
info
(
"batchDelete..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
List
<
String
>
idList
=
new
ArrayList
<
String
>();
idList
.
add
(
"8584804d-b5ac-45d2-9f91-4dd8e7a090a7"
);
idList
.
add
(
"ab7422e9-a91a-4840-9e59-9d911257c918"
);
idList
.
add
(
"12b6ceb8-573b-4f01-ad85-cfb24cfa007c"
);
idList
.
add
(
"dafd5ba4-d2e3-4656-bd42-178841e610fe"
);
s
s
.
batchDelete
(
idList
);
s
ervice
.
batchDelete
(
idList
);
}
@Test
public
void
findAll
()
throws
Exception
{
_logger
.
info
(
"findAll..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
_logger
.
info
(
"findAll "
+
ss
.
findAll
());
_logger
.
info
(
"findAll "
+
service
.
findAll
());
}
@Before
...
...
@@ -293,21 +284,11 @@ public class MyBatisTestRunner {
//Initialization ApplicationContext for Project
public
void
init
(){
_logger
.
info
(
"init ..."
);
String
path_str
=
MyBatisTestRunner
.
class
.
getResource
(
"ApplicationRunner.properties"
).
getFile
().
toString
();
String
appRunnerClassPath
=
path_str
.
substring
(
0
,
path_str
.
indexOf
(
"org"
));
_logger
.
info
(
"Application class "
+
appRunnerClassPath
);
System
.
setProperty
(
"APPRUNNER_CLASSPATH"
,
appRunnerClassPath
);
String
appRunnerPath
=
path_str
.
substring
(
path_str
.
startsWith
(
"/"
)?
1
:
0
,
path_str
.
indexOf
(
appRunnerClassPath
.
split
(
"/"
)[
appRunnerClassPath
.
split
(
"/"
).
length
-
1
]));
System
.
setProperty
(
"APPRUNNER_PATH"
,
appRunnerPath
);
_logger
.
info
(
"appRunner dir "
+
appRunnerPath
);
_logger
.
info
(
"Application dir "
+
System
.
getProperty
(
"user.dir"
));
context
=
new
ClassPathXmlApplicationContext
(
new
String
[]
{
"spring/applicationContext.xml"
});
WebContext
.
applicationContext
=
context
;
service
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
}
}
...
...
@@ -343,28 +324,24 @@ public class MyBatisTestRunner {
@Test
public
void
queryPageResults
()
throws
Exception
{
_logger
.
info
(
"queryPageResults..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
Students
student
=
new
Students
();
//student.setId("af04d610-6092-481e-9558-30bd63ef783c");
student
.
setStdGender
(
"M"
);
//student.setStdMajor(政治");
student
.
setPageResults
(
10
);
student
.
setPage
(
2
);
_logger
.
info
(
"queryPageResults "
+
s
s
.
queryPageResults
(
student
));
_logger
.
info
(
"queryPageResults "
+
s
ervice
.
queryPageResults
(
student
));
}
@Test
public
void
queryPageResultsByMapperId
()
throws
Exception
{
_logger
.
info
(
"queryPageResults by mapperId..."
);
WebContext
.
applicationContext
=
context
;
StudentsService
ss
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
Students
student
=
new
Students
();
student
.
setStdGender
(
"M"
);
//student.setStdMajor(政治");
student
.
setPageResults
(
10
);
student
.
setPage
(
2
);
_logger
.
info
(
"queryPageResults by mapperId "
+
s
s
.
queryPageResults
(
"queryPageResults1"
,
student
));
_logger
.
info
(
"queryPageResults by mapperId "
+
s
ervice
.
queryPageResults
(
"queryPageResults1"
,
student
));
}
...
...
@@ -389,21 +366,9 @@ public class MyBatisTestRunner {
//Initialization ApplicationContext for Project
public
void
init
(){
_logger
.
info
(
"init ..."
);
String
path_str
=
MyBatisTestRunner
.
class
.
getResource
(
"ApplicationRunner.properties"
).
getFile
().
toString
();
String
appRunnerClassPath
=
path_str
.
substring
(
0
,
path_str
.
indexOf
(
"org"
));
_logger
.
info
(
"Application class "
+
appRunnerClassPath
);
System
.
setProperty
(
"APPRUNNER_CLASSPATH"
,
appRunnerClassPath
);
String
appRunnerPath
=
path_str
.
substring
(
path_str
.
startsWith
(
"/"
)?
1
:
0
,
path_str
.
indexOf
(
appRunnerClassPath
.
split
(
"/"
)[
appRunnerClassPath
.
split
(
"/"
).
length
-
1
]));
System
.
setProperty
(
"APPRUNNER_PATH"
,
appRunnerPath
);
_logger
.
info
(
"appRunner dir "
+
appRunnerPath
);
_logger
.
info
(
"Application dir "
+
System
.
getProperty
(
"user.dir"
));
context
=
new
ClassPathXmlApplicationContext
(
new
String
[]
{
"spring/applicationContext.xml"
});
WebContext
.
applicationContext
=
context
;
service
=(
StudentsService
)
WebContext
.
getBean
(
"studentsService"
);
}
}
...
...
@@ -456,7 +421,7 @@ public class MyBatisTestRunner {
<include
refid=
"sql_condition"
/>
</select>
<select
id=
"query"
parameterType=
"Students"
resultType=
"Students"
>
<select
id=
"query
By
"
parameterType=
"Students"
resultType=
"Students"
>
SELECT
ID ,
STDNO ,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录