Ipage<T>
的子類(下面會有詳細使用說明)Wrapper<T>
實現類的改動
1.
EntityWrapper<T>
改名爲QueryWrapper<T>
2.新增一個實現類UpdateWrapper<T>
用於update
方法git
BaseMapper<T>
的改動
1.去除了
insertAllColumn(T entity)
方法
2.去除了updateAllColumn(T entity)
方法
3.新增update(T entity, Wrapper<T> updateWrapper)
方法github
Wrapper<T>
使用QueryWrapper<T>
與UpdateWrapper<T>
共有方法方法名 | 說明 |
---|---|
allEq | 基於 map 內容等於= |
eq | 等於 = |
ne | 不等於 <> |
gt | 大於 > |
ge | 大於等於 >= |
lt | 小於 < |
le | 小於等於 <= |
between | BETWEEN 條件語句 |
notBetween | NOT BETWEEN 條件語句 |
like | LIKE '%值%'' |
notLike | NOT LIKE '%值%' |
likeLeft | LIKE '%值' |
likeRight | LIKE '值%' |
-------- | -------- |
isNull | NULL 值查詢 |
isNotNull | NOT NULL 值查詢 |
in | IN 查詢 |
notIn | NOT IN 查詢 |
inSql | IN 查詢(sql注入式) |
notInSql | NOT IN 查詢(sql注入式) |
groupBy | 分組 GROUP BY |
orderByAsc | ASC 排序 ORDER BY |
orderByDesc | DESC 排序 ORDER BY |
orderBy | 排序 ORDER BY |
having | HAVING 關鍵詞(sql注入式) |
-------- | -------- |
or | or 拼接 |
apply | 拼接自定義內容(sql注入式) |
last | 拼接在最後(sql注入式) |
exists | EXISTS 條件語句(sql注入式) |
notExists | NOT EXISTS 條件語句(sql注入式) |
-------- | -------- |
and(Function) | AND (嵌套內容) |
or(Function) | OR (嵌套內容) |
nested(Function) | (嵌套內容) |
QueryWrapper<T>
特有方法方法名 | 說明 |
---|---|
select | SQL 查詢字段內容,例如:id,name,age(重複設置以最後一次爲準) |
UpdateWrapper<T>
特有方法方法名 | 說明 |
---|---|
set | SQL SET 字段(一個字段使用一次) |
IPage<T> selectPage(IPage<T> page, @Param("ew") Wrapper<T> queryWrapper);
以上面的方法爲例,入參一個
IPage<T>
接口的子類(能夠使用mp自帶的一個叫Page<T>
的子類), 返回一個IPage<T>
,其實這個返回的分頁類==入參的分頁類
, 若是你須要自定義一個分頁方法只須要注意一點:入參第一位放置你使用的IPage<T>
子類!sql
update(T entity, Wrapper<T> updateWrapper)
使用只須要注意,入參第一位是須要update的實體類,
updateWrapper
裏的實體類是用於生成where條件的mybatis