当前位置:首页 > 移动开发 > 正文

Mybatis Generator 生成的mapper只有insert方法

检查一下是不是表没有设置主键!!!

 表没有设置primary key 的话生成的TestMapper 里就会只有 insert 、insertSelective 这两个方法。

 
public interface TestMapper {
    int deleteByPrimaryKey(Long id);//表没有设置主键就会生不出这个方法

    int insert(a record);

    int insertSelective(a record);

    a selectByPrimaryKey(Long id);//表没有设置主键就会生不出这个方法
 
    int updateByPrimaryKeySelective(a record);//表没有设置主键就会生不出这个方法

    int updateByPrimaryKey(a record);//表没有设置主键就会生不出这个方法
 }