依赖传入
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.11</version>
</dependency>
以下是将list<User>与list<UserVO>相同属性名的属性值,从list<User>传入list<UserVO>中。
User类就比UserVO类多了一个更新时间的字段。
查看代码
@Data
public class User implements Serializable {
private Integer id;
private String username;
@TableField(typeHandler = JacksonTypeHandler.class)
private UserInfo info;
private Boolean status;
private Integer balance;
private LocalDateTime updataTime;
}
查看代码
@Data
public class UserVO{
private Integer id;
private String username;
@TableField(typeHandler = JacksonTypeHandler.class)
private UserInfo info;
private Boolean status;
private Integer balance;
}
List<User> list=userPage.getRecords();//反正就是获取了一串值
list<UserVO> newlist= BeanUtil.copyToList(list,UserVO.class)//这样就好了
下列可以判断一个字符串是否为空(null或""之类的情况)
StrUtil.isNotBlank(query.getSortBy())//query.getSortBy()是要判断的值
标签:UserVO,list,hutool,private,为空,Integer,class From: https://www.cnblogs.com/cyknote/p/17698198.html