MP版本
3.5.5
问题描述
启动项目时会有警告信息: c.b.m.core.injector.DefaultSqlInjector : class po.SikaLedgerUser ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method.
Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method.
该PO对应的表只有两个字段, userId与ledgerId, 两个字段组成联合主键 JavaPO类的定义为:
@Data
@Builder
@TableName("sika_ledger_user")
public class SikaLedgerUser implements Serializable {
private Long userId;
private Long ledgerId;
}
我只需要MP帮我提供insert方法, 所以我继承了BaseMapper
public interface SikaLedgerUserMapper extends BaseMapper<SikaLedgerUser> {}
其他说明
- [x] 查阅官网文档关于复合主键的说明
- [x] 查阅 Issues 关于联合主键, 复合主键的所有open和close
虽然MP官网很明确的说明不使用联合主键, 但是在某些场景下还是不得不去使用联合主键, 使用联合主键时会警告 对于联合主键的PO类正常情况下不会使用getXXXById, 但是我想是否有方法能够屏蔽该警告信息, 我实在不想每次启动都需要花费精力在这个警告信息上
Comment From: miemieYaho
自己去配log.xml