Commit 49fbd32a by 吴迪

【修改】显示排序修改

parent 6e779e46
...@@ -140,6 +140,7 @@ public class MedicalController extends AbstractController { ...@@ -140,6 +140,7 @@ public class MedicalController extends AbstractController {
queryWrapper.select("top 10 id,title "); queryWrapper.select("top 10 id,title ");
queryWrapper.gt("level", "0"); queryWrapper.gt("level", "0");
queryWrapper.eq("status", "1"); queryWrapper.eq("status", "1");
queryWrapper.orderByDesc("level");
if (StringUtils.isBlank(medical.getType())) { if (StringUtils.isBlank(medical.getType())) {
return R.error("请输入分类"); return R.error("请输入分类");
} }
......
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.AbstractCollection;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -12,7 +12,6 @@ import io.office.modules.manage.vo.request.NewtopicEntityVo; ...@@ -12,7 +12,6 @@ import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
......
...@@ -11,4 +11,6 @@ import lombok.Data; ...@@ -11,4 +11,6 @@ import lombok.Data;
public class PageParams { public class PageParams {
private int page; private int page;
private int limit; private int limit;
private String sidx;
private String order;
} }
...@@ -29,6 +29,18 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsDao, LogisticsEnt ...@@ -29,6 +29,18 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsDao, LogisticsEnt
if(!StringUtils.isNullOrEmpty(String.valueOf(params.get("type")))){ if(!StringUtils.isNullOrEmpty(String.valueOf(params.get("type")))){
logisticsEntityQueryWrapper.eq("type",params.get("type")); logisticsEntityQueryWrapper.eq("type",params.get("type"));
} }
if (params.get("sidx") == null || org.apache.commons.lang3.StringUtils.isBlank(params.get("sidx").toString())) {
logisticsEntityQueryWrapper.orderByDesc("id");
} else {
if (params.get("order") != null && org.apache.commons.lang3.StringUtils.isBlank(params.get("order").toString())) {
if (params.get("order").toString().equalsIgnoreCase("asc")) {
logisticsEntityQueryWrapper.orderByAsc(params.get("sidx").toString());
} else {
logisticsEntityQueryWrapper.orderByDesc(params.get("sidx").toString());
}
}
}
IPage<LogisticsEntity> page = this.page( IPage<LogisticsEntity> page = this.page(
new Query<LogisticsEntity>().getPage(params), new Query<LogisticsEntity>().getPage(params),
logisticsEntityQueryWrapper logisticsEntityQueryWrapper
......
...@@ -32,6 +32,11 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i ...@@ -32,6 +32,11 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i
if(!StringUtil.isNullOrEmpty(String.valueOf(params.get("type")))){ if(!StringUtil.isNullOrEmpty(String.valueOf(params.get("type")))){
medicalEntityQueryWrapper.eq("type",params.get("type")); medicalEntityQueryWrapper.eq("type",params.get("type"));
} }
if(!StringUtil.isNullOrEmpty(String.valueOf(params.get("level")))){
medicalEntityQueryWrapper.eq("level",params.get("level"));
} else {
medicalEntityQueryWrapper.ge("level",0);
}
IPage<MedicalEntity> page = this.page( IPage<MedicalEntity> page = this.page(
new Query<MedicalEntity>().getPage(params), new Query<MedicalEntity>().getPage(params),
medicalEntityQueryWrapper medicalEntityQueryWrapper
......
...@@ -28,14 +28,27 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity ...@@ -28,14 +28,27 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper queryWrapper = new QueryWrapper<NewtopicEntity>(); QueryWrapper queryWrapper = new QueryWrapper<NewtopicEntity>();
queryWrapper.orderByDesc("ClassId"); if (params.get("sidx") == null || StringUtils.isBlank(params.get("sidx").toString())) {
queryWrapper.orderByDesc("ClassId");
} else {
if (params.get("order") != null && StringUtils.isBlank(params.get("order").toString())) {
if (params.get("order").toString().equalsIgnoreCase("asc")) {
queryWrapper.orderByAsc(params.get("sidx").toString());
} else {
queryWrapper.orderByDesc(params.get("sidx").toString());
}
}
}
queryWrapper.eq("parentid",0); queryWrapper.eq("parentid",0);
if(params.containsKey("levels")) { if (params.containsKey("levels")) {
if(params.get("levels") !=null){ if (params.get("levels") != null && StringUtils.isNotBlank(String.valueOf(params.get("levels")))) {
queryWrapper.eq("levels",params.get("levels")); queryWrapper.eq("levels", params.get("levels"));
} else {
queryWrapper.gt("levels", 0);
} }
} else{ } else {
queryWrapper.gt("levels",0); queryWrapper.gt("levels", 0);
} }
if(params.containsKey("status")) { if(params.containsKey("status")) {
if(StringUtils.isNotBlank(String.valueOf(params.get("status")))) { if(StringUtils.isNotBlank(String.valueOf(params.get("status")))) {
......
...@@ -26,7 +26,17 @@ public class PlanBranchServiceImpl extends ServiceImpl<PlanBranchDao, PlanBranch ...@@ -26,7 +26,17 @@ public class PlanBranchServiceImpl extends ServiceImpl<PlanBranchDao, PlanBranch
planBranchEntityQueryWrapper.eq(params.get("classnum")!=null && StringUtils.isNotBlank(params.get("classnum").toString()),"classnum",params.get("classnum")); planBranchEntityQueryWrapper.eq(params.get("classnum")!=null && StringUtils.isNotBlank(params.get("classnum").toString()),"classnum",params.get("classnum"));
planBranchEntityQueryWrapper.eq(params.get("checkflag")!=null && StringUtils.isNotBlank(params.get("checkflag").toString()),"checkflag",params.get("checkflag")); planBranchEntityQueryWrapper.eq(params.get("checkflag")!=null && StringUtils.isNotBlank(params.get("checkflag").toString()),"checkflag",params.get("checkflag"));
planBranchEntityQueryWrapper.like(params.get("name")!=null && StringUtils.isNotBlank(params.get("name").toString()),"name",params.get("name")); planBranchEntityQueryWrapper.like(params.get("name")!=null && StringUtils.isNotBlank(params.get("name").toString()),"name",params.get("name"));
planBranchEntityQueryWrapper.orderByAsc("id"); if (params.get("sidx") == null || org.apache.commons.lang3.StringUtils.isBlank(params.get("sidx").toString())) {
planBranchEntityQueryWrapper.orderByAsc("id");
} else {
if (params.get("order") != null && org.apache.commons.lang3.StringUtils.isBlank(params.get("order").toString())) {
if (params.get("order").toString().equalsIgnoreCase("asc")) {
planBranchEntityQueryWrapper.orderByAsc(params.get("sidx").toString());
} else {
planBranchEntityQueryWrapper.orderByDesc(params.get("sidx").toString());
}
}
}
IPage<PlanBranchEntity> page = this.page( IPage<PlanBranchEntity> page = this.page(
new Query<PlanBranchEntity>().getPage(params), new Query<PlanBranchEntity>().getPage(params),
planBranchEntityQueryWrapper planBranchEntityQueryWrapper
......
...@@ -56,7 +56,13 @@ ...@@ -56,7 +56,13 @@
<if test="newsParams.type !=null and newsParams.type !=''"> <if test="newsParams.type !=null and newsParams.type !=''">
and a.announcetype =#{newsParams.type} and a.announcetype =#{newsParams.type}
</if> </if>
ORDER BY <choose>
a.id DESC <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY a.${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
ORDER BY a.id DESC
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -50,7 +50,13 @@ ...@@ -50,7 +50,13 @@
<if test="newsParams.service !=null and newsParams.service !=''"> <if test="newsParams.service !=null and newsParams.service !=''">
and t.service = #{newsParams.service} and t.service = #{newsParams.service}
</if> </if>
ORDER BY <choose>
t.id DESC <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY t.${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
ORDER BY t.id DESC
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -43,7 +43,13 @@ ...@@ -43,7 +43,13 @@
AND levels > 0 AND levels > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY <choose>
id DESC <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
order by id desc <choose>
<when test="params.sidx!=null and params.sidx!=''">
ORDER BY t.${params.sidx} ${params.order},
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -53,8 +53,15 @@ ...@@ -53,8 +53,15 @@
AND t.levels > 0 AND t.levels > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY <choose>
t.levels desc,t.starttime_index DESC,t.id desc <when test="indexCarouselManage.sidx!=null and indexCarouselManage.sidx!=''">
ORDER BY ${indexCarouselManage.sidx} ${indexCarouselManage.order},
</when>
<otherwise>
ORDER BY t.levels desc,t.starttime_index DESC,t.id desc
</otherwise>
</choose>
</select> </select>
<select id="indexCarouselManageList" resultMap="indexCarouselManageMap"> <select id="indexCarouselManageList" resultMap="indexCarouselManageMap">
......
...@@ -53,8 +53,15 @@ ...@@ -53,8 +53,15 @@
<if test="newsParams.categoryId !=null and newsParams.categoryId !=''"> <if test="newsParams.categoryId !=null and newsParams.categoryId !=''">
and b.knowledgeCategoryID = #{newsParams.categoryId} and b.knowledgeCategoryID = #{newsParams.categoryId}
</if> </if>
ORDER BY <choose>
<when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
ORDER BY
inputdate DESC inputdate DESC
</otherwise>
</choose>
</select> </select>
......
...@@ -123,8 +123,14 @@ ...@@ -123,8 +123,14 @@
<if test="newsParams.auditor !=null and newsParams.auditor !=''"> <if test="newsParams.auditor !=null and newsParams.auditor !=''">
and auditor =#{newsParams.auditor} and auditor =#{newsParams.auditor}
</if> </if>
ORDER BY <choose>
id desc ,releasedate DESC <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
ORDER BY id desc
</otherwise>
</choose>
</select> </select>
......
...@@ -85,6 +85,13 @@ ...@@ -85,6 +85,13 @@
AND levels > 0 AND levels > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY releasedate desc <choose>
<when test="params.sidx!=null and params.sidx!=''">
ORDER BY ${params.sidx} ${params.order},
</when>
<otherwise>
ORDER BY releasedate desc
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
AND levels > 0 AND levels > 0
</otherwise> </otherwise>
</choose> </choose>
<if test="newsParams.firmname !=null and newsParams.firmname !=''"> <if test="newsParams.firmname !=null and newsParams.firmname !=''">
and firmname like concat('%',#{newsParams.firmname},'%') and firmname like concat('%',#{newsParams.firmname},'%')
</if> </if>
<if test="newsParams.editor !=null and newsParams.editor !=''"> <if test="newsParams.editor !=null and newsParams.editor !=''">
and editor = #{newsParams.editor} and editor = #{newsParams.editor}
</if> </if>
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
<if test="newsParams.updateTimeStart !=null and newsParams.updateTimeEnd !=null"> <if test="newsParams.updateTimeStart !=null and newsParams.updateTimeEnd !=null">
and updatedate BETWEEN #{newsParams.updateTimeStart} AND #{newsParams.updateTimeEnd} and updatedate BETWEEN #{newsParams.updateTimeStart} AND #{newsParams.updateTimeEnd}
</if> </if>
order by id desc <choose>
<when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -67,8 +67,14 @@ ...@@ -67,8 +67,14 @@
AND PicLevel > 0 AND PicLevel > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY <choose>
pictureID DESC <when test="params.sidx!=null and params.sidx!=''">
ORDER BY ${params.sidx} ${params.order},
</when>
<otherwise>
ORDER BY pictureID DESC
</otherwise>
</choose>
</select> </select>
<select id="selectPictureNewList" resultMap="pictureMap" parameterType="io.office.modules.manage.entity.dto.NewsParams"> <select id="selectPictureNewList" resultMap="pictureMap" parameterType="io.office.modules.manage.entity.dto.NewsParams">
SELECT * SELECT *
......
...@@ -52,8 +52,14 @@ ...@@ -52,8 +52,14 @@
AND levels > 0 AND levels > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY <choose>
id DESC <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
</select> </select>
<select id="selectPolicyNewList" resultMap="policyMap" parameterType="io.office.modules.manage.entity.dto.PolicyParams"> <select id="selectPolicyNewList" resultMap="policyMap" parameterType="io.office.modules.manage.entity.dto.PolicyParams">
......
...@@ -55,7 +55,14 @@ ...@@ -55,7 +55,14 @@
<if test="params.categoryid !='' and params.categoryid !=null"> <if test="params.categoryid !='' and params.categoryid !=null">
and a.categoryid =#{params.categoryid} and a.categoryid =#{params.categoryid}
</if> </if>
order by a.id desc <choose>
<when test="params.sidx!=null and params.sidx!=''">
ORDER BY a.${params.sidx} ${params.order},
</when>
<otherwise>
order by a.id desc
</otherwise>
</choose>
</select> </select>
<select id="findPage" resultType="io.office.modules.manage.entity.ProductEntity" parameterType="string"> <select id="findPage" resultType="io.office.modules.manage.entity.ProductEntity" parameterType="string">
select * from product where levels > 0 and categoryid=1 select * from product where levels > 0 and categoryid=1
......
...@@ -68,8 +68,15 @@ ...@@ -68,8 +68,15 @@
AND PicLevel > 0 AND PicLevel > 0
</otherwise> </otherwise>
</choose> </choose>
ORDER BY <choose>
pictureID DESC <when test="params.sidx!=null and params.sidx!=''">
ORDER BY ${params.sidx} ${params.order},
</when>
<otherwise>
ORDER BY
pictureID DESC
</otherwise>
</choose>
</select> </select>
<select id="selectPictureNewList" resultMap="retailpictureMap" parameterType="io.office.modules.manage.entity.dto.NewsParams"> <select id="selectPictureNewList" resultMap="retailpictureMap" parameterType="io.office.modules.manage.entity.dto.NewsParams">
SELECT * SELECT *
......
...@@ -63,7 +63,14 @@ ...@@ -63,7 +63,14 @@
AND b.levels > 0 AND b.levels > 0
</otherwise> </otherwise>
</choose> </choose>
order by b.levels desc,b.releasedate desc <choose>
<when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY b.${newsParams.sidx} ${newsParams.order},
</when>
<otherwise>
order by b.levels desc,b.releasedate desc
</otherwise>
</choose>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment