Explorar o código

修改业务平类查询死循环

anderx %!s(int64=8) %!d(string=hai) anos
pai
achega
54e621a418

+ 0 - 2
src/main/java/com/goafanti/admin/controller/BusinessProjectController.java

@@ -127,9 +127,7 @@ public class BusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/getAllCName", method = RequestMethod.GET)
 	public Result getAllCname(Integer flag){
 		Result res=new Result();
-		logger.debug("get all cname come *************************");
 		res.setData(businessprojectService.getAllCnames(flag));
-		logger.debug("set result data end *************************");
 		return res;
 	}
 	

+ 14 - 10
src/main/java/com/goafanti/admin/service/impl/BusinessProjectServiceImpl.java

@@ -150,19 +150,22 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 	public List<Map<String, String>> getAllCnames(Integer flag) {
 		List<Map<String, String>> list=new ArrayList<Map<String, String>>();
 		List<String> listcid=businessVarietiesMapper.getListId();
-		System.out.println("this  is service start -----------------------");
 		for (String s : listcid) {
 			Map<String, String> map=new HashMap<>(); 
 			String cname=getAllCname(s);
 			map.put("id", s);
 			map.put("cname", cname);
-			
-			list.add(map);
-				
-			
-			
+			if (flag==1) {
+				if (StringUtils.isBlank(cname)) {
+					map.put("cname", "平台超级业务品类");
+				}
+				list.add(map);
+			}else {
+				if (StringUtils.isNotBlank(cname)) {
+					list.add(map);
+				}
+			}
 		}
-		System.out.println("this  is service end -----------------------");	
 		return list;
 	}
 	/**
@@ -171,15 +174,16 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 	 * @return  路径
 	 */
 	private String getAllCname(String s) {
-		System.out.println("to get cid by id-----------------------"+s);	
 		String cid=businessVarietiesMapper.getThisCid(s);
 		String cname=businessVarietiesMapper.getThisCname(cid);
 		BusinessVarieties bv=businessVarietiesMapper.selectByPrimaryKey(s);
 		String sid=bv.getSuperId();
 		if (cid.length()>4) {
+			if(bv.getSuperId().equals(bv.getId())){
+				return "";
+			}
 			String w=getAllCname(sid)+"-"+cname;
-			System.out.println("return result sid-----"+sid+"----------w----------"+w);	
-			 return w;
+			return w;
 		}else{
 			return cid.length()>3?cname:"";
 		}