https://github.com/shengtu0328/mybatisplus-demo 自己整理了一下
2019-06-11
我執(zhí)行測試 出現(xiàn)
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mp.dao.UserMapper.selectAll
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mp.dao.UserMapper.selectAll
2019-06-11
已采納回答 / 老猿
? ? ? ?兩個類的父類都是抽象類AbstractWrapper,一般情況下QueryWrapper用在查詢和刪除中,UpdateWrapper用在修改中,UpdateWrapper提供了set方法,可以在不傳入實體的情況下,設(shè)置update語句中的set條件。而且set方法只有在調(diào)用MP的相關(guān)Update方法時才生效。? ? ? ?經(jīng)過我的測試修改、刪除、更新方法用QueryWrapper、UpdateWrapper都不報錯可以正常執(zhí)行,但是還是建議查詢和刪除用 QueryWrapper、修改用Upd...
2019-06-10
想問下mp的條件構(gòu)造器,查詢和刪除的時候只能用 QueryWrapper, 修改的時候只能用UpdateWrapper 對嗎
2019-06-10
如果有同學(xué)的分頁配置的頁數(shù)和總記錄數(shù)為0 的話可使用下面的配置
@EnableTransactionManagement
@Configuration
@MapperScan("Mapper包名")
public class MyBatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
當(dāng)然Mapper的位置要根據(jù)你的項目中實際的位置做修改
@EnableTransactionManagement
@Configuration
@MapperScan("Mapper包名")
public class MyBatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
當(dāng)然Mapper的位置要根據(jù)你的項目中實際的位置做修改
講師回答 / 老猿
這種情況,在where中你需要“別名.name”就可以了。我看你的表已經(jīng)起別名了,例如:條件構(gòu)造器中的條件可以這樣寫,wrapper.eq("a.name","某某")
2019-06-06