排序修改
This commit is contained in:
parent
6e7c224109
commit
e51668cc4d
|
@ -389,7 +389,18 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
Integer pageNum = jsonObject.getInteger("pageNum");
|
Integer pageNum = jsonObject.getInteger("pageNum");
|
||||||
Integer pageSize = jsonObject.getInteger("pageSize");
|
Integer pageSize = jsonObject.getInteger("pageSize");
|
||||||
//默认按上架时间降序排列
|
//默认按上架时间降序排列
|
||||||
String orderField = StringUtils.isBlank(jsonObject.getString("orderField")) ? "total" : jsonObject.getString("orderField");
|
String orderField;
|
||||||
|
if (StringUtils.isBlank(jsonObject.getString("orderField"))) {
|
||||||
|
if ("应用资源".equals(jsonObject.getString("type"))) {
|
||||||
|
orderField = "deptSort";
|
||||||
|
} else if ("组件服务".equals(jsonObject.getString("type"))) {
|
||||||
|
orderField = "pin_top";
|
||||||
|
} else {
|
||||||
|
orderField = "total";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
orderField = jsonObject.getString("orderField");
|
||||||
|
}
|
||||||
String orderType = StringUtils.isBlank(jsonObject.getString("orderType")) ? "DESC" : jsonObject.getString("orderType");
|
String orderType = StringUtils.isBlank(jsonObject.getString("orderType")) ? "DESC" : jsonObject.getString("orderType");
|
||||||
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
|
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
|
||||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||||
|
|
|
@ -128,8 +128,7 @@
|
||||||
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
|
||||||
|
@ -184,10 +183,13 @@
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="orderField != null and orderField !=''">
|
<if test="orderField != null and orderField !=''">
|
||||||
ORDER BY ${orderField} ${orderType}
|
|
||||||
<if test="orderField == 'pin_top'">
|
<if test="orderField == 'pin_top'">
|
||||||
, pin_top_time DESC
|
ORDER BY ${orderField} ${orderType}, pin_top_time DESC
|
||||||
</if>
|
</if>
|
||||||
|
<if test="orderField == 'deptSort'">
|
||||||
|
ORDER BY sd.type, sd.sort
|
||||||
|
</if>
|
||||||
|
ORDER BY ${orderField} ${orderType}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -401,8 +403,7 @@
|
||||||
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
|
||||||
|
@ -447,10 +448,13 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="orderField != null and orderField !=''">
|
<if test="orderField != null and orderField !=''">
|
||||||
ORDER BY ${orderField} ${orderType}
|
|
||||||
<if test="orderField == 'pin_top'">
|
<if test="orderField == 'pin_top'">
|
||||||
, pin_top_time DESC
|
ORDER BY ${orderField} ${orderType}, pin_top_time DESC
|
||||||
</if>
|
</if>
|
||||||
|
<if test="orderField == 'deptSort'">
|
||||||
|
ORDER BY sd.type, sd.sort
|
||||||
|
</if>
|
||||||
|
ORDER BY ${orderField} ${orderType}
|
||||||
LIMIT ${pageNum}, ${pageSize}
|
LIMIT ${pageNum}, ${pageSize}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
@ -578,8 +582,7 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||||
"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",
|
||||||
|
@ -610,8 +613,7 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||||
"type",
|
|
||||||
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
|
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
|
||||||
FROM
|
FROM
|
||||||
sys_dept sd
|
sys_dept sd
|
||||||
|
@ -649,8 +651,7 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||||
"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
|
||||||
|
|
Loading…
Reference in New Issue