add RawMapper
This commit is contained in:
52
src/main/java/com/imyeyu/spring/mapper/RawMapper.java
Normal file
52
src/main/java/com/imyeyu/spring/mapper/RawMapper.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.imyeyu.spring.mapper;
|
||||
|
||||
import com.imyeyu.spring.util.RawSQLProvider;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 原始 SQL 映射
|
||||
*
|
||||
* @param <T> 实体类型
|
||||
* @param <P> 主键类型
|
||||
* @author 夜雨
|
||||
* @since 2026-01-05 12:58
|
||||
*/
|
||||
public interface RawMapper<T, P> {
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
*
|
||||
* @return 数据列表
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "selectAll")
|
||||
List<T> selectAllRaw();
|
||||
|
||||
/**
|
||||
* 根据 ID 获取对象
|
||||
*
|
||||
* @param id 索引
|
||||
* @return 数据对象
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "select")
|
||||
T selectRaw(P id);
|
||||
|
||||
/**
|
||||
* 根据示例查询单条数据
|
||||
*
|
||||
* @param t 示例对象
|
||||
* @return 数据对象
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "selectByExample")
|
||||
T selectByExampleRaw(T t);
|
||||
|
||||
/**
|
||||
* 根据示例查询全部数据
|
||||
*
|
||||
* @param t 示例对象
|
||||
* @return 数据列表
|
||||
*/
|
||||
@SelectProvider(type = RawSQLProvider.class, method = "selectAllByExample")
|
||||
List<T> selectAllByExampleRaw(T t);
|
||||
}
|
||||
Reference in New Issue
Block a user