关于使用mybatis-plus, selectById ,getById 查出来的数据为空的问题

原因: mybatis_plus 默认会使用 “id” 为主键字段

解决:加上@TableId(value =“数据库你的主键字段”)注解即可
例如我的是product_id为主键

在这里插入图片描述

public class ProductInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value ="product_id")
    private String productId;

    private Integer categoryType;

    private Date createTime;
    }

有帮助的朋友麻烦点个赞!!!


版权声明:本文为weixin_43923229原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。