Commit 251210db authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents f37ce934 d98d3d6c
package com.mortals.xhx.module.system.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.system.dao.SystemServiceDao;
......@@ -13,5 +17,13 @@ import com.mortals.xhx.module.system.service.SystemServiceService;
*/
@Service("systemServiceService")
public class SystemServiceServiceImpl extends AbstractCRUDServiceImpl<SystemServiceDao, SystemServiceEntity, Long> implements SystemServiceService {
@Override
protected SystemServiceEntity findBefore(SystemServiceEntity entity, PageInfo pageInfo, Context context) throws AppException {
if(StringUtils.isNotEmpty(entity.getPackageName())){
entity.setPackageName("%"+entity.getPackageName()+"%");
}
pageInfo.setPrePageResult(-1);
return entity;
}
}
\ No newline at end of file
package com.mortals.xhx.module.system.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.param.service.ParamService;
import com.mortals.xhx.module.system.model.SystemServiceApiEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -18,15 +21,11 @@ import com.mortals.xhx.module.system.service.SystemServiceService;
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;
......@@ -56,5 +55,25 @@ public class SystemServiceController extends BaseCRUDJsonBodyMappingController<S
super.init(model, context);
}
@Override
protected int doListAfter(SystemServiceEntity query, Map<String, Object> model, Context context) throws AppException {
List<SystemServiceEntity> result = (List<SystemServiceEntity>) model.get("data");
if(CollectionUtils.isNotEmpty(result)){
List<JSONObject> jsonObjectList = new ArrayList<>();
Map<String,List<SystemServiceEntity>> map = result.stream().collect(Collectors.groupingBy(SystemServiceEntity::getSystemServiceCode));
Iterator<Map.Entry<String,List<SystemServiceEntity>>> iterator = map.entrySet().iterator();
while(iterator.hasNext()){
Map.Entry<String,List<SystemServiceEntity>> item = iterator.next();
JSONObject jsonObject = new JSONObject();
jsonObject.put("serviceName",item.getValue().get(0).getSystemServiceName());
jsonObject.put("serviceCode",item.getValue().get(0).getSystemServiceCode());
jsonObject.put("count",item.getValue().size());
jsonObject.put("serviceList",item.getValue());
jsonObjectList.add(jsonObject);
}
model.put("data",jsonObjectList);
}
return 1;
}
}
\ 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