先檢查資料庫表有沒有主鍵,有才行; 然後檢查有沒有以下幾行: enableSelectByPrimaryKey="true" enableUpdateByPrimaryKey="true" enableDeleteByPrimaryKey="true" Mybatis Generator(代碼生成器)隻有insert方法 實作效果: Mybatis Generator(代碼生成器)隻有insert方法