先检查数据库表有没有主键,有才行; 然后检查有没有以下几行: enableSelectByPrimaryKey="true" enableUpdateByPrimaryKey="true" enableDeleteByPrimaryKey="true" 实现效果: