Commit 7633f97e authored by 廖旭伟's avatar 廖旭伟

单事项查询接口排序bug修改

parent 254100cf
package com.mortals.xhx.module.single.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -15,12 +17,10 @@ import com.mortals.xhx.module.single.model.SingleMatterEntity;
import com.mortals.xhx.module.single.service.SingleMatterService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
......@@ -55,11 +55,18 @@ public class SingleMatterController extends BaseCRUDJsonBodyMappingController<Si
return 1;
}
@Override
protected int infoAfter(Long id, Map<String, Object> model, SingleMatterEntity entity, Context context) throws AppException {
this.service.addViewsCount(id);
return 1;
}
@Override
protected void doListBefore(SingleMatterEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderMap = new HashMap<>();
orderMap.put("viewsCount","DESC");
query.setOrderCols(orderMap);
List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("viewsCount", "desc"));
orderColList.add(new OrderCol("createTime", "desc"));
query.setOrderColList(orderColList);
super.doListBefore(query,model,context);
}
......
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