每个备注里面都有 null 不知道哪里来的。想把null 去掉,有什么好办法吗
String rsStopRemark = orderStopEntity.getRsStopRemark() == null?" ": orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ;
这段代码是取人事停保备注的一段代码,我也没看懂 String rsStopRemark = orderStopEntity.getRsStopRemark() 这段应该是获取前台给传的内容 ,后面的 == null?" ": orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ; 我不知道怎弄 ,这段代码加点什么能把 备注里面的 null去掉呢
你的需求是要前端显示 【人事人:121】 而不是 【null 人事人:121】 ???
String rsStopRemark = orderStopEntity.getRsStopRemark() == null?" ": orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ;
// 这段代码的意思是:
// 如果 orderStopEntity.getRsStopRemark() == null 等于 true 那么 String rsStopRemark = " ",
// 否则 String rsStopRemark = orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ;
String rsStopRemark = orderStopEntity.getRsStopRemark() == null?" ": orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ;
你这个根据前面的结果可以判断orderStopEntity.getRsStopRemark()的值为“null”,你可以把orderStopEntity.getRsStopRemark()==null换成orderStopEntity.getRsStopRemark().equals("null")?" ":orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark") ;
怀疑是orderStopEntity.getRsStopRemark()返回字符串"null",这类问题你把这行代码分解一下再调试看看是不是你预期的值
orderStopEntity.getRsStopRemark() 多半是 字符串的 "null"
String rsStopRemark = (StringUtils.isEmpty(orderStopEntity.getRsStopRemark()) || "null".equals(orderStopEntity.getRsStopRemark())) ? " " : orderStopEntity.getRsStopRemark()+ "\n" + sysUserService.selectById(userId).getUsername()+":"+params.getString("rsStopRemark");
orderStopEntity.getRsStopRemark() 这个估计是个null对象所以 返回了 "NULL"+ ....