Commit 5dfa2571 authored by 廖旭伟's avatar 廖旭伟

产品页面列表去重

parent d8dd933f
......@@ -3,6 +3,8 @@ package com.mortals.xhx.module.page.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.product.ProductPdu;
......@@ -10,12 +12,14 @@ import com.mortals.xhx.feign.product.IProductFeign;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import com.mortals.xhx.module.page.service.PageInfoService;
import com.mortals.xhx.module.param.service.ParamService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -77,4 +81,51 @@ public class PageInfoController extends BaseCRUDJsonBodyMappingController<PageIn
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@Override
@PostMapping({"list"})
@UnAuth
public Rest<Object> list(@RequestBody PageInfoEntity query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
this.doListBefore(query, model, context);
PageInfo pageInfo = this.buildPageInfo(query);
Result<PageInfoEntity> result = this.getService().find(query, pageInfo, context);
this.doListAfter(query, result.getList(), context);
if(CollectionUtils.isNotEmpty(result.getList())){
List<PageInfoEntity> newList = new ArrayList<>();
Map<String,String> pageCode = new HashMap<>();
for (PageInfoEntity item:result.getList()){
if(pageCode.containsKey(item.getPageCode())){
continue;
}else {
pageCode.put(item.getPageCode(),item.getPageCode());
newList.add(item);
}
}
result.setList(newList);
}
model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo());
this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, (Map)model, context);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
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