判断父节点是否存在


$("#parentId").html(result.serviceClass!=null?result.serviceClass.name:"");
<td style="text-align: right;">上级分类名称</td>
     <td>
       <span id="parentId"></span>
     </td>
public void getById() {
  // 判断ID是否为空
  if (flatInfo != null) {
   FlatInfo obj = flatInfoService.getFlatInfoById(flatInfo.getId());
     if(obj.getParentId()!=null && !obj.getParentId().equals("")){
      FlatInfo fi = flatInfoService.getFlatInfoById(obj.getParentId());
     obj.setFlatInfo(fi);
     }
   
   CommonUtils.writeJson(obj, request, response);
  }
 }

$("#provinceRegionCode").html(result.provinceRegionCode !=null?result.provinceRegionCode.name:""+result.cityRegionCode!=null?result.cityRegionCode.name:""+result.countyRegionCode!=null?result.countyRegionCode.name:"");
发布了28 篇原创文章 · 获赞 27 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/danruoshui315/article/details/44862161
今日推荐