展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

使用vo2dto插件

  • 参考
  • 项目中有实体类User
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Accessors(chain = true)
@TableName("user")
@ApiModel(value = "User对象", description = "")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String username;

    private String password;

    private String sex;

    private Date birthday;

}
  • dto
@Data
public class UserBookReq implements Serializable {

    private static final long serialVersionUID = 1L;

    // 用户名
    private String username;

    // 性别
    private String sex;

    // 书名
    private String bookname;

    // 作者
    private String author;

    // 价格
    private BigDecimal price;

    // 当前页
    private int pageNum = 1;

    // 每页条数
    private int pageSize = 5;

}
  • 在main方法中创建2个对象
public class TestAssembler {
    public static void main(String[] args) {
        UserBookReq userBookReq = new UserBookReq();
        User user = new User();
    }
}
  • 选中UserBookReq userBookReq并复制
  • 再选中user右键,选中Generate -> Vo2Dto
  • 生成相应的代码
posted @ 2022-04-02 20:13  DogLeftover  阅读(34)  评论(0编辑  收藏  举报