add example Logic
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.spring.mapper;
|
||||
|
||||
import com.imyeyu.spring.bean.Logic;
|
||||
import com.imyeyu.spring.util.RawSQLProvider;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
|
||||
import java.util.List;
|
||||
@@ -38,8 +40,19 @@ public interface RawMapper<T, P> {
|
||||
* @param t 示例对象
|
||||
* @return 数据对象
|
||||
*/
|
||||
default T selectByExampleRaw(T t) {
|
||||
return selectByExampleRaw(t, Logic.AND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据示例查询单条数据
|
||||
*
|
||||
* @param t 示例对象
|
||||
* @param logic 条件连接逻辑
|
||||
* @return 数据对象
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "selectByExample")
|
||||
T selectByExampleRaw(T t);
|
||||
T selectByExampleRaw(@Param("entity") T t, @Param("logic") Logic logic);
|
||||
|
||||
/**
|
||||
* 根据示例查询全部数据
|
||||
@@ -47,6 +60,17 @@ public interface RawMapper<T, P> {
|
||||
* @param t 示例对象
|
||||
* @return 数据列表
|
||||
*/
|
||||
default List<T> selectAllByExampleRaw(T t) {
|
||||
return selectAllByExampleRaw(t, Logic.AND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据示例查询全部数据
|
||||
*
|
||||
* @param t 示例对象
|
||||
* @param logic 条件连接逻辑
|
||||
* @return 数据列表
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "selectAllByExample")
|
||||
List<T> selectAllByExampleRaw(T t);
|
||||
List<T> selectAllByExampleRaw(@Param("entity") T t, @Param("logic") Logic logic);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user