Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
s_guodong
gjjs-bd-common
Commits
985dcfda
Commit
985dcfda
authored
Aug 04, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbread如果查到多条返回一条
parent
52136545
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
MyBatisDaoSession.java
...com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
+18
-4
No files found.
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
View file @
985dcfda
...
...
@@ -167,17 +167,31 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public
<
T
extends
IModule
>
T
dbRead
(
T
module
,
Argument
...
args
)
{
// if (isMultiDb) {
// String moduleDB = MdaUtils.getModuleDB(module);
// DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
// }
// MybatisArgumentAdapter adapter = new MybatisArgumentAdapter(SELECT, module.getClass(), args);
//
// T entity = this.dyncReadOne(module.getClass(), adapter);
// if (entity != null) {
// MdaDriver.copyValues(module, entity);
// }
// return entity;
if
(
isMultiDb
)
{
String
moduleDB
=
MdaUtils
.
getModuleDB
(
module
);
DynamicDataSourceContextHolder
.
setDataSourceType
(
moduleDB
);
}
MybatisArgumentAdapter
adapter
=
new
MybatisArgumentAdapter
(
SELECT
,
module
.
getClass
(),
args
);
T
entity
=
this
.
dyncReadOne
(
module
.
getClass
(),
adapter
);
if
(
entity
!=
null
)
{
MdaDriver
.
copyValues
(
module
,
entity
);
String
sqlId
=
getSqlId
(
module
.
getClass
(),
SQLID_DYNCREAD
);
List
<
T
>
list
=
sqlSessionTemplate
.
selectList
(
sqlId
,
adapter
.
getSqlParams
());
if
(
list
==
null
||
list
.
size
()
==
0
)
{
setNoMoreRow
();
return
null
;
}
return
entity
;
MdaDriver
.
copyValues
(
module
,
list
.
get
(
0
));
return
list
.
get
(
0
);
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment