total排序时,置顶优于total
This commit is contained in:
parent
42f5f3e46a
commit
ce881d43de
|
@ -257,6 +257,8 @@ public class ResourceController {
|
||||||
if ("f".equals(source)) {
|
if ("f".equals(source)) {
|
||||||
dto.setDelFlag(2); // 来自前端页面 走审批流程
|
dto.setDelFlag(2); // 来自前端页面 走审批流程
|
||||||
}
|
}
|
||||||
|
dto.setPinTop(0);
|
||||||
|
dto.setPinTopTime(new Date(0));
|
||||||
logger.info(dto.toString());
|
logger.info(dto.toString());
|
||||||
resourceService.insertWithAttrs(dto);
|
resourceService.insertWithAttrs(dto);
|
||||||
|
|
||||||
|
|
|
@ -471,17 +471,54 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
case "DESC": // total 倒序
|
case "DESC": // total 倒序
|
||||||
ids = customThreadPool.submit(() -> {
|
ids = customThreadPool.submit(() -> {
|
||||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||||
Map index = (Map) x;
|
// Map index = (Map) x;
|
||||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
// String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||||
return Long.valueOf(string);
|
// return Long.valueOf(string);
|
||||||
}).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
Map index = (Map) x;
|
||||||
|
int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||||
|
return pingTOp;
|
||||||
|
}, Comparator.reverseOrder())
|
||||||
|
.thenComparing(x -> {
|
||||||
|
// Map index = (Map) x;
|
||||||
|
// int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||||
|
// return pingTOp;
|
||||||
|
Map index = (Map) x;
|
||||||
|
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||||
|
return pingTOp;
|
||||||
|
}, Comparator.reverseOrder()).thenComparing(x -> {
|
||||||
|
// Map index = (Map) x;
|
||||||
|
// long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||||
|
// return pingTOp;
|
||||||
|
Map index = (Map) x;
|
||||||
|
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||||
|
return Long.valueOf(string);
|
||||||
|
}, Comparator.reverseOrder())
|
||||||
|
).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||||
return temp;
|
return temp;
|
||||||
}).get();
|
}).get();
|
||||||
break;
|
break;
|
||||||
case "ASC": // total 升序
|
case "ASC": // total 升序
|
||||||
ids = customThreadPool.submit(() -> {
|
ids = customThreadPool.submit(() -> {
|
||||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||||
String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
// Map index = (Map) x;
|
||||||
|
// String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||||
|
// return Long.valueOf(string);
|
||||||
|
Map index = (Map) x;
|
||||||
|
int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||||
|
return pingTOp;
|
||||||
|
}, Comparator.reverseOrder()).thenComparing(x -> {
|
||||||
|
// Map index = (Map) x;
|
||||||
|
// int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||||
|
// return pingTOp;
|
||||||
|
Map index = (Map) x;
|
||||||
|
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||||
|
return pingTOp;
|
||||||
|
}, Comparator.reverseOrder()).thenComparing(x -> {
|
||||||
|
// Map index = (Map) x;
|
||||||
|
// long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||||
|
// return pingTOp;
|
||||||
|
Map index = (Map) x;
|
||||||
|
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||||
return Long.valueOf(string);
|
return Long.valueOf(string);
|
||||||
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -491,14 +528,29 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||||
if ("DESC".equals(orderType)) {
|
if ("DESC".equals(orderType)) {
|
||||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||||
ResourceDTO index = (ResourceDTO) x;
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
return index.getTotal() == null ? 0L : index.getTotal();
|
return index.getTotal() == null ? 0L : index.getTotal();
|
||||||
}).reversed()).collect(Collectors.toList()));
|
}, Comparator.reverseOrder())
|
||||||
|
.thenComparing(x -> {
|
||||||
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
|
return index.getPinTop() == null ? 0 : index.getPinTop();
|
||||||
|
}, Comparator.reverseOrder()).thenComparing(x -> {
|
||||||
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
|
return index.getPinTopTime() == null ? new Date(0) : index.getPinTopTime();
|
||||||
|
}, Comparator.reverseOrder())
|
||||||
|
).collect(Collectors.toList()));
|
||||||
} else {
|
} else {
|
||||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||||
ResourceDTO index = x;
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
return index.getTotal() == null ? 0L : index.getTotal();
|
return index.getTotal() == null ? 0L : index.getTotal();
|
||||||
})).collect(Collectors.toList()));
|
}).thenComparing(x -> {
|
||||||
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
|
return index.getPinTop() == null ? 0 : index.getPinTop();
|
||||||
|
}, Comparator.reverseOrder())
|
||||||
|
.thenComparing(x -> {
|
||||||
|
ResourceDTO index = (ResourceDTO) x;
|
||||||
|
return index.getPinTopTime() == null ? new Date(0) : index.getPinTopTime();
|
||||||
|
}, Comparator.reverseOrder())).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
customThreadPool.shutdown();
|
customThreadPool.shutdown();
|
||||||
} else { // 非总体评价排序时
|
} else { // 非总体评价排序时
|
||||||
|
@ -1924,7 +1976,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||||
case TSINGTAO_XHA:
|
case TSINGTAO_XHA:
|
||||||
break;
|
break;
|
||||||
case TSINGTAO: {
|
case TSINGTAO: {
|
||||||
CompletableFuture<Void> dataResourceCount = CompletableFuture.runAsync(() -> { //数据资源
|
CompletableFuture<Void> dataResourceCount = CompletableFuture.runAsync(() -> { //数据资源
|
||||||
//青岛市局数据资源
|
//青岛市局数据资源
|
||||||
|
@ -1941,7 +1993,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
|
CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
|
||||||
HashMap<Object, Object> queryMap = new HashMap<>();
|
HashMap<Object, Object> queryMap = new HashMap<>();
|
||||||
queryMap.put("cameraName",keyWorld);
|
queryMap.put("cameraName", keyWorld);
|
||||||
Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
|
Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
|
||||||
resultList.add(new HashMap<String, Object>() {
|
resultList.add(new HashMap<String, Object>() {
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,8 @@
|
||||||
AND user_id = #{dto.creator}
|
AND user_id = #{dto.creator}
|
||||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
||||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id =
|
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id
|
||||||
|
=
|
||||||
taa3.resource_id
|
taa3.resource_id
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
|
@ -414,7 +415,8 @@
|
||||||
AND user_id = #{dto.creator}
|
AND user_id = #{dto.creator}
|
||||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
||||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id =
|
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id
|
||||||
|
=
|
||||||
taa3.resource_id
|
taa3.resource_id
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
|
@ -475,7 +477,9 @@
|
||||||
<select id="selectDTOPageSpecilTotal" resultType="java.util.Map">
|
<select id="selectDTOPageSpecilTotal" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.id,
|
tdr.id,
|
||||||
tdr.total AS total
|
tdr.total AS total,
|
||||||
|
tdr.pin_top,
|
||||||
|
tdr.UNIX_TIMESTAMP(pin_top_time) AS pin_top_time
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -595,7 +599,8 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||||
|
"type",
|
||||||
sd.NAME AS "deptName",
|
sd.NAME AS "deptName",
|
||||||
IFNULL( tdr.deptCount, 0 ) AS "deptCount",
|
IFNULL( tdr.deptCount, 0 ) AS "deptCount",
|
||||||
sd.id AS "deptId",
|
sd.id AS "deptId",
|
||||||
|
@ -628,7 +633,8 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||||
|
"type",
|
||||||
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
|
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
|
||||||
FROM
|
FROM
|
||||||
sys_dept sd
|
sys_dept sd
|
||||||
|
@ -666,7 +672,8 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||||
|
"type",
|
||||||
IFNULL( tdr.deptCount, 0) AS "deptCount",
|
IFNULL( tdr.deptCount, 0) AS "deptCount",
|
||||||
IFNULL(sr.name, '暂无该地区') AS "districtName"
|
IFNULL(sr.name, '暂无该地区') AS "districtName"
|
||||||
FROM
|
FROM
|
||||||
|
@ -1496,7 +1503,7 @@
|
||||||
|
|
||||||
<select id="resourceInstallationOrDataResourceDetails" parameterType="java.util.Map" resultType="java.util.Map">
|
<select id="resourceInstallationOrDataResourceDetails" parameterType="java.util.Map" resultType="java.util.Map">
|
||||||
SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName
|
SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName
|
||||||
FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
||||||
WHERE a.type = #{resourceType} AND a.del_flag = 0
|
WHERE a.type = #{resourceType} AND a.del_flag = 0
|
||||||
<if test="id != '0'.toString()">
|
<if test="id != '0'.toString()">
|
||||||
AND (b.ID = #{id} OR INSTR(b.pids,#{id}))
|
AND (b.ID = #{id} OR INSTR(b.pids,#{id}))
|
||||||
|
@ -1506,34 +1513,34 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAppList" resultType="java.util.Map">
|
<select id="selectAppList" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.id,
|
tdr.id,
|
||||||
tdr.`name`,
|
tdr.`name`,
|
||||||
sd.name AS "deptName"
|
sd.name AS "deptName"
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
AND tdr.type = '应用资源'
|
AND tdr.type = '应用资源'
|
||||||
AND tdr.del_flag = 0
|
AND tdr.del_flag = 0
|
||||||
<if test=" type != null and type != ''">
|
<if test=" type != null and type != ''">
|
||||||
AND sd.type = #{type}
|
AND sd.type = #{type}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
tdr.visitor
|
tdr.visitor
|
||||||
LIMIT ${pageNum}, 9
|
LIMIT ${pageNum}, 9
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPicByResId" resultType="java.lang.String">
|
<select id="selectPicByResId" resultType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
tda.attr_value
|
tda.attr_value
|
||||||
FROM
|
FROM
|
||||||
tb_data_attr tda
|
tb_data_attr tda
|
||||||
LEFT JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id
|
LEFT JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id
|
||||||
WHERE
|
WHERE
|
||||||
tda.attr_type = '应用图片'
|
tda.attr_type = '应用图片'
|
||||||
AND tdr.id = #{id}
|
AND tdr.id = #{id}
|
||||||
AND tda.del_flag = 0
|
AND tda.del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="selectTypeCountByName" resultType="java.util.Map">
|
<select id="selectTypeCountByName" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
Loading…
Reference in New Issue