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
55123585
Commit
55123585
authored
Jun 25, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页
parent
d0fc1a35
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
50 deletions
+93
-50
Comsel.java
...siness/src/main/java/com/ceb/gjjs/mda/manager/Comsel.java
+7
-3
pom.xml
gjjs-bd-mybatis-support/pom.xml
+7
-0
MyBatisDaoSession.java
...com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
+33
-40
CacheOption.java
...main/java/com/brilliance/mda/runtime/mda/CacheOption.java
+26
-4
IDaoSession.java
...main/java/com/brilliance/mda/runtime/mda/IDaoSession.java
+0
-3
BaseVO.java
.../main/java/com/brilliance/mda/runtime/request/BaseVO.java
+20
-0
No files found.
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/manager/Comsel.java
View file @
55123585
...
...
@@ -9,6 +9,8 @@ import com.brilliance.mda.runtime.mda.impl.*;
import
com.brilliance.mda.runtime.annotation.*
;
import
com.brilliance.mda.runtime.mda.driver.*
;
import
static
com
.
brilliance
.
mda
.
runtime
.
mda
.
Constants
.*;
import
com.brilliance.mda.runtime.request.BaseVO
;
import
com.fasterxml.jackson.annotation.*
;
import
com.brilliance.mda.runtime.mda.util.*
;
import
lombok.Getter
;
...
...
@@ -686,7 +688,9 @@ public class Comsel extends AbstractTransaction{
@Rule
(
target
=
"accsel"
,
order
=
100
)
public
boolean
ruleAccselN100
(){
IContext
ctx
=
MdaEnv
.
getContext
();
BaseVO
baseVO
=
ctx
.
getVo
();
int
pageNum
=
baseVO
.
getPageNum
();
int
pageSize
=
baseVO
.
getPageSize
();
ctx
.
getErrorCode
();
MdaUtils
.
clear
(
this
.
getActlst
());
...
...
@@ -694,11 +698,11 @@ public class Comsel extends AbstractTransaction{
String
cur
=
this
.
getCur
();
if
(
MdaUtils
.
isEmpty
(
cur
))
{
ctx
.
getDaoSession
().
dbReadset
(
this
.
getActlst
(),
new
CacheOption
(
0
,
tru
e
),
new
Argument
<
String
>(
"ptyinr"
,
ptyinr
));
ctx
.
getDaoSession
().
dbReadset
(
this
.
getActlst
(),
new
CacheOption
(
pageNum
,
pageSiz
e
),
new
Argument
<
String
>(
"ptyinr"
,
ptyinr
));
}
else
ctx
.
getDaoSession
().
dbReadset
(
this
.
getActlst
(),
new
CacheOption
(
0
,
tru
e
),
new
Argument
<
String
>(
"cur"
,
cur
),
new
Argument
<
String
>(
"ptyinr"
,
ptyinr
));
ctx
.
getDaoSession
().
dbReadset
(
this
.
getActlst
(),
new
CacheOption
(
pageNum
,
pageSiz
e
),
new
Argument
<
String
>(
"cur"
,
cur
),
new
Argument
<
String
>(
"ptyinr"
,
ptyinr
));
if
(
ctx
.
getErrorCode
()!=
NO_ERROR
)
{
ctx
.
setMessage
(
MdaUtils
.
getI18NString
(
"comsel"
,
"CT000070"
),
MdaUtils
.
getI18NString
(
"comsel"
,
"CT000071"
));
...
...
gjjs-bd-mybatis-support/pom.xml
View file @
55123585
...
...
@@ -42,6 +42,12 @@
<groupId>
org.postgresql
</groupId>
<artifactId>
postgresql
</artifactId>
</dependency>
<!--pageHelper-->
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.5
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
View file @
55123585
...
...
@@ -9,6 +9,7 @@ import com.brilliance.mda.runtime.mda.impl.ModuleList;
import
com.brilliance.mda.runtime.mda.util.MdaUtils
;
import
com.brilliance.mda.support.mybatis.count.CounterService
;
import
com.brilliance.mda.support.mybatis.dync.mapper.DbExecuteMapper
;
import
com.github.pagehelper.PageHelper
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -159,36 +160,42 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
return
entity
;
}
@Override
public
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
int
limitSize
,
Argument
...
args
)
{
String
moduleDB
=
MdaUtils
.
getModuleListDB
(
list
);
DynamicDataSourceContextHolder
.
setDataSourceType
(
moduleDB
);
list
.
clear
();
MybatisArgumentAdapter
adapter
=
new
MybatisArgumentAdapter
(
SELECT
,
list
.
getDataClass
(),
args
);
String
temp
=
adapter
.
getSqlTemplate
();
Map
<
String
,
Object
>
params
=
adapter
.
getSqlParams
();
if
(
limitSize
==
0
)
{
List
<
T
>
resultList
=
this
.
dyncRead
(
list
.
getDataClass
(),
params
);
list
.
addAll
(
resultList
);
}
else
{
//TODO 实现分页查询
// Page<T> page = new Page<>(1,limitSize);
// IPage<T> pageData = baseMapper.selectPage(page, wrapper);
// list.addAll(pageData.getRecords());
}
return
list
.
size
();
}
@Override
public
<
T
extends
IModule
>
int
dbReadset
(
ModuleList
<
T
>
list
,
CacheOption
cacheOption
,
Argument
...
args
)
{
return
dbReadset
(
list
,
args
);
if
(
cacheOption
!=
null
)
{
PageHelper
.
startPage
(
cacheOption
.
getPageNum
(),
cacheOption
.
getPageSize
());
}
int
size
=
dbReadset
(
list
,
args
);
if
(
cacheOption
!=
null
)
{
PageHelper
.
clearPage
();
}
return
size
;
}
@Override
public
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>[]
lists
,
CacheOption
cacheOption
,
String
whereSql
,
Object
[]
param
)
{
return
dbReadset
(
lists
,
0
,
whereSql
,
param
);
String
moduleDB
=
MdaUtils
.
getModuleListsDB
(
lists
);
DynamicDataSourceContextHolder
.
setDataSourceType
(
moduleDB
);
if
(
cacheOption
!=
null
)
{
PageHelper
.
startPage
(
cacheOption
.
getPageNum
(),
cacheOption
.
getPageSize
());
}
List
<
Class
<?
extends
IModule
>>
clazzList
=
new
ArrayList
<>();
for
(
IModuleList
iModule
:
lists
)
{
clazzList
.
add
(
iModule
.
getDataClass
());
}
MybatisArgumentAdapter
adapter
=
new
MybatisArgumentAdapter
(
SELECT
,
clazzList
,
whereSql
,
param
);
for
(
IModuleList
iModule
:
lists
)
{
List
<
T
>
result
=
this
.
dyncRead
(
iModule
.
getDataClass
(),
adapter
);
iModule
.
addAll
(
result
);
}
if
(
cacheOption
!=
null
)
{
PageHelper
.
clearPage
();
}
return
lists
[
0
].
size
();
}
@Override
...
...
@@ -197,7 +204,9 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
DynamicDataSourceContextHolder
.
setDataSourceType
(
moduleDB
);
list
.
clear
();
this
.
dbReadset
(
list
,
0
,
args
);
MybatisArgumentAdapter
adapter
=
new
MybatisArgumentAdapter
(
SELECT
,
list
.
getDataClass
(),
args
);
List
<
T
>
result
=
this
.
dyncRead
(
list
.
getDataClass
(),
adapter
);
list
.
addAll
(
result
);
return
list
.
size
();
}
...
...
@@ -264,22 +273,6 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
return
dbReadset
(
list
,
whereSql
,
param
.
toArray
());
}
@Override
public
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>[]
lists
,
int
maxSize
,
String
whereClause
,
Object
[]
datas
)
{
String
moduleDB
=
MdaUtils
.
getModuleListsDB
(
lists
);
DynamicDataSourceContextHolder
.
setDataSourceType
(
moduleDB
);
List
<
Class
<?
extends
IModule
>>
clazzList
=
new
ArrayList
<>();
for
(
IModuleList
iModule
:
lists
)
{
clazzList
.
add
(
iModule
.
getDataClass
());
}
MybatisArgumentAdapter
adapter
=
new
MybatisArgumentAdapter
(
SELECT
,
clazzList
,
whereClause
,
datas
);
for
(
IModuleList
iModule
:
lists
)
{
List
<
T
>
result
=
this
.
dyncRead
(
iModule
.
getDataClass
(),
adapter
);
iModule
.
addAll
(
result
);
}
return
lists
[
0
].
size
();
}
@Override
public
void
dbReadset
(
IModuleList
[]
lists
,
String
whereClause
,
Object
[]
datas
)
{
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/CacheOption.java
View file @
55123585
package
com
.
brilliance
.
mda
.
runtime
.
mda
;
import
java.net.InetAddress
;
/**
* @Description
* @Author s_guodong
* @Date 2023/6/5
*/
public
class
CacheOption
{
public
class
CacheOption
{
public
long
cacheTimeout
;
public
boolean
paging
;
private
int
pageNum
=
1
;
private
int
pageSize
=
10
;
public
CacheOption
(
long
cacheTimeout
)
{
this
(
cacheTimeout
,
false
);
}
...
...
@@ -26,4 +27,25 @@ public class CacheOption
this
.
cacheTimeout
=
cacheTimeout
;
this
.
paging
=
paging
;
}
public
CacheOption
(
int
pageNum
,
int
pageSize
)
{
this
.
pageNum
=
pageNum
;
this
.
pageSize
=
pageSize
;
}
public
int
getPageNum
()
{
return
pageNum
;
}
public
void
setPageNum
(
int
pageNum
)
{
this
.
pageNum
=
pageNum
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/IDaoSession.java
View file @
55123585
...
...
@@ -21,8 +21,6 @@ public interface IDaoSession {
<
T
extends
IModule
>
int
dbDelete
(
T
module
,
Argument
...
args
);
@SuppressWarnings
(
"rawtypes"
)
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
Argument
...
args
);
@SuppressWarnings
(
"rawtypes"
)
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
int
limitSize
,
Argument
...
args
);
<
T
extends
IModule
>
int
dbReadset
(
ModuleList
<
T
>
list
,
CacheOption
cacheOption
,
Argument
...
args
);
...
...
@@ -33,7 +31,6 @@ public interface IDaoSession {
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
String
whereSql
,
Object
[]
params
);
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
String
whereSql
,
String
...
params
);
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>[]
lists
,
int
maxSize
,
String
whereClause
,
Object
[]
datas
);
void
dbReadset
(
IModuleList
[]
lists
,
String
whereClause
,
Object
[]
datas
);
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/request/BaseVO.java
View file @
55123585
...
...
@@ -9,6 +9,10 @@ public class BaseVO {
protected
List
<
Map
<
String
,
Object
>>
changes
;
protected
int
pageNum
;
protected
int
pageSize
;
public
Map
<
String
,
Object
>
getParams
()
{
return
params
;
}
...
...
@@ -32,4 +36,20 @@ public class BaseVO {
public
void
setPageId
(
String
pageId
)
{
this
.
pageId
=
pageId
;
}
public
int
getPageNum
()
{
return
pageNum
;
}
public
void
setPageNum
(
int
pageNum
)
{
this
.
pageNum
=
pageNum
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
}
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