List<User> approverList = JsonUtils.jsonToList(taskApplyInfo.getApprover(),User.class); List<User> approverTwo = JsonUtils.jsonToList(taskApplyInfo.getApproveTwo(),User.class); List<User> approverThree = JsonUtils.jsonToList(taskApplyInfo.getApproveThree(),User.class); List<User> collaboratorTwo = JsonUtils.jsonToList(taskApplyInfo.getCollaboratorTwo(),User.class); List<User> collaboratorList = JsonUtils.jsonToList(taskApplyInfo.getCollaborator(),User.class); if ((null == approverList || approverList.size() == 0) && (null == collaboratorList || collaboratorList.size() == 0) && (null == approverTwo || approverTwo.size() == 0) && (null == collaboratorTwo || collaboratorTwo.size() == 0) && (null == approverThree || approverThree.size() == 0)) { return false; } return true;优化代码
时间: 2023-02-08 22:01:02 浏览: 148
list转成json对象
这段代码中,使用了JsonUtils.jsonToList()方法将taskApplyInfo对象中的五个字段转换为List<User>类型,分别是approver、approveTwo、approveThree、collaboratorTwo、collaborator,然后判断approverList是否为空或长度为0。
阅读全文