Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
0c83b062
Commit
0c83b062
authored
Jun 11, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态字段调整排序逻辑
parent
93867451
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
80 deletions
+26
-80
base-manager/src/main/java/com/mortals/xhx/module/app/web/AppDatasetController.java
.../com/mortals/xhx/module/app/web/AppDatasetController.java
+23
-26
base-manager/src/main/resources/sqlmap/module/app/AppDatasetMapperExt.xml
.../main/resources/sqlmap/module/app/AppDatasetMapperExt.xml
+2
-54
base-manager/src/test/java/com/mortals/httpclient/app/AppDatasetController.http
...java/com/mortals/httpclient/app/AppDatasetController.http
+1
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/module/app/web/AppDatasetController.java
View file @
0c83b062
...
...
@@ -75,40 +75,37 @@ public class AppDatasetController extends BaseCRUDJsonBodyMappingController<AppD
@Override
protected
void
doListBefore
(
AppDatasetEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
query
.
getOrConditionList
())
||
!
ObjectUtils
.
isEmpty
(
query
.
getAndConditionList
()))
{
if
(!
ObjectUtils
.
isEmpty
(
query
.
getOrConditionList
())
||
!
ObjectUtils
.
isEmpty
(
query
.
getAndConditionList
()))
{
AppDatasetQuery
appDatasetQuery
=
new
AppDatasetQuery
();
if
(!
ObjectUtils
.
isEmpty
(
query
.
getOrConditionList
())){
appDatasetQuery
.
setOrConditionList
(
query
.
getOrConditionList
());
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getAndConditionList
())){
if
(!
ObjectUtils
.
isEmpty
(
query
.
getAndConditionList
()))
{
appDatasetQuery
.
setOrConditionList
(
query
.
getAndConditionList
());
}
appDatasetQuery
.
setAppId
(
query
.
getAppId
());
appDatasetQuery
.
setOrderCols
(
query
.
getOrderCols
());
PageInfo
pageInfo
=
this
.
buildPageInfo
(
query
);
Result
<
AppInfoFieldEntity
>
customResult
=
this
.
service
.
findCustomList
(
appDatasetQuery
,
pageInfo
,
context
);
//根据查询条件的数量去除数量不足的结果
int
count
=
query
.
getOrConditionList
().
size
();
List
<
Long
>
datasetIdList
=
customResult
.
getList
().
stream
().
map
(
item
->
item
.
getDatasetId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
Long
>
collect
=
datasetIdList
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
,
Collectors
.
counting
()));
List
<
Long
>
dataSets
=
collect
.
entrySet
().
stream
().
map
(
entrySet
->
{
if
(
entrySet
.
getValue
()
==
count
)
{
return
entrySet
.
getKey
();
if
(!
ObjectUtils
.
isEmpty
(
query
.
getOrConditionList
()))
{
appDatasetQuery
.
setOrConditionList
(
query
.
getOrConditionList
());
appDatasetQuery
.
setAppId
(
query
.
getAppId
());
appDatasetQuery
.
setOrderCols
(
query
.
getOrderCols
());
PageInfo
pageInfo
=
this
.
buildPageInfo
(
query
);
Result
<
AppInfoFieldEntity
>
customResult
=
this
.
service
.
findCustomList
(
appDatasetQuery
,
pageInfo
,
context
);
//根据查询条件的数量去除数量不足的结果
int
count
=
query
.
getOrConditionList
().
size
();
List
<
Long
>
datasetIdList
=
customResult
.
getList
().
stream
().
map
(
item
->
item
.
getDatasetId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
Long
>
collect
=
datasetIdList
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
,
Collectors
.
counting
()));
List
<
Long
>
dataSets
=
collect
.
entrySet
().
stream
().
map
(
entrySet
->
{
if
(
entrySet
.
getValue
()
==
count
)
{
return
entrySet
.
getKey
();
}
else
{
return
null
;
}
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
dataSets
))
{
query
.
setIdList
(
dataSets
);
}
else
{
return
null
;
query
.
setIdList
(
ListUtil
.
toList
(
0L
))
;
}
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
dataSets
))
{
query
.
setIdList
(
dataSets
);
}
else
{
query
.
setIdList
(
ListUtil
.
toList
(
0L
));
query
.
setOrConditionList
(
null
);
}
query
.
setOrConditionList
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getFieldCode
())
||
!
ObjectUtils
.
isEmpty
(
query
.
getFieldName
()))
{
...
...
base-manager/src/main/resources/sqlmap/module/app/AppDatasetMapperExt.xml
View file @
0c83b062
...
...
@@ -15,18 +15,7 @@
<if
test=
"condition.appId!=null and condition.appId!=''"
>
and a.appId = #{condition.appId,jdbcType=VARCHAR}
</if>
<include
refid=
"_second_condition_"
/>
<!-- <if test="condition.fieldCode!=null and condition.fieldCode!=''">
and b.fieldCode = #{condition.fieldCode,jdbcType=VARCHAR}
</if>
<if test="condition.fieldName!=null and condition.fieldName!=''">
and b.fieldName = #{condition.fieldName,jdbcType=VARCHAR}
</if>
<if test="condition.fieldValue != null and condition.fieldValue != ''">
and b.fieldValue like #{condition.fieldValue}
</if>-->
</trim>
</trim>
</select>
...
...
@@ -45,53 +34,12 @@
and a.appId = #{condition.appId,jdbcType=VARCHAR}
</if>
<include
refid=
"_second_condition_"
/>
<!-- <if test="condition.fieldCode!=null and condition.fieldCode!=''">
and b.fieldCode = #{condition.fieldCode,jdbcType=VARCHAR}
</if>
<if test="condition.fieldName!=null and condition.fieldName!=''">
and b.fieldName = #{condition.fieldName,jdbcType=VARCHAR}
</if>
<if test="condition.fieldValue != null and condition.fieldValue != ''">
and b.fieldValue like #{condition.fieldValue}
</if>-->
</trim>
</trim>
<if
test=
"(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()"
>
order by
IF
( `fieldType` = 'top', '0', '1' ),
`fieldValue` DESC,
order by
fieldType IN('top','date') DESC ,fieldValue DESC
<trim
prefix=
""
suffixOverrides=
","
suffix=
""
>
<if
test=
"orderCol.containsKey('id')"
>
a.id
<if
test=
'orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'
>
DESC
</if>
,
</if>
<if
test=
"orderCol.containsKey('appId')"
>
a.appId
<if
test=
'orderCol.appId != null and "DESC".equalsIgnoreCase(orderCol.appId)'
>
DESC
</if>
,
</if>
<if
test=
"orderCol.containsKey('createTime')"
>
a.createTime
<if
test=
'orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'
>
DESC
</if>
,
</if>
<if
test=
"orderCol.containsKey('updateUserId')"
>
a.updateUserId
<if
test=
'orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'
>
DESC
</if>
,
</if>
<if
test=
"orderCol.containsKey('updateTime')"
>
a.updateTime
<if
test=
'orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'
>
DESC
</if>
,
</if>
</trim>
</if>
</select>
<!-- 条件映射 -->
...
...
base-manager/src/test/java/com/mortals/httpclient/app/AppDatasetController.http
View file @
0c83b062
...
...
@@ -46,6 +46,7 @@ Content-Type: application/json
"page": 1,
"size": 10
}
...
...
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