mybatis plus一些通用方法如何使用

2021-09-14 08:50:49 字數 996 閱讀 7054

insert相關

boolean insert(t entity); //插入

boolean insertselective(t entity); //選擇性插入,null欄位不插入

boolean insertbatch(listentitylist); //批量插入

delete相關

boolean deletebyid(i id); //通過id刪除

boolean deletebymap(mapcolumnmap); // 通過自定義map刪除

boolean deleteselective(t entity); //通過entity實體選擇性刪除,null欄位不作為條件

boolean deletebatchids(listidlist); //批量刪除

update相關

boolean updatebyid(t entity); //通過id更新

boolean updateselectivebyid(t entity); //通過id選擇性更新,null欄位不更新

boolean update(t entity, t whereentity); //通過whereentity實體構造where條件進行更新

boolean updateselective(t entity, t whereentity); //通過whereentity實體構造where條件進行選擇性更新

boolean updatebatchbyid(listentitylist); //批量更新

select相關

t selectbyid(i id); //通過id查詢

listselectbatchids(listidlist); //通過id集合批量查詢

listselectbymap(mapcolumnmap); //通過自定義map查詢

t selectone(t entity); //通過實體entity查詢

int selectcount(t entity); //統計查詢

MyBatisPlus 通用列舉

mybatisplus解決了繁瑣的配置,讓mybatis更優雅的適用列舉屬性。配置列舉掃瞄包 插入資料 自動將列舉對映為字段值 查詢 自動將字段值對映為列舉值 test public void testselectlist 控制台列印 execute sql select id,user name,...

通用列舉 MyBatisPlus

通用列舉用於對資料庫運算元據時,用列舉的值代替原值。例如有如下列舉型別 public enum ageenum private string name private integer value override public string tostring public string getnam...

mybatisPlus 通用列舉處理

1 配置pom檔案 我這裡的mybatisplus版本較低 推薦使用最新版本 新版的可以使用邏輯刪除等擴充套件功能 2 開啟列舉處理 路徑寫到包名即可 3 新建乙個列舉就處理類 4 在domain裡面引用該列舉類 5 直接查詢即可 6 返回資料格式如下 7 如果返回的資料為null 一般就是字段型別...