All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.obatis.orm.mapper.BaseBeanSessionMapper Maven / Gradle / Ivy

The newest version!
package com.obatis.orm.mapper;

import com.obatis.orm.sql.SqlProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * mapper的顶层父类,每一个实体对应的map都需要继承,提供类常规的对数据库的操作
 */
public interface BaseBeanSessionMapper extends CommonMapper {
	
	@InsertProvider(type = SqlProvider.class, method = "insert")
	int insert(@Param("request") T t, String tableName, Class cls);
	
	@InsertProvider(type = SqlProvider.class, method = "batchInsert")
	int insertBatch(@Param("request") List list, String tableName, Class cls);
	
	@UpdateProvider(type = SqlProvider.class, method = "update")
	int update(@Param("request") Map params, String tableName);
	
	@UpdateProvider(type = SqlProvider.class, method = "batchUpdate")
	int updateBatch(@Param("request") Map params, String tableName);
	
	@DeleteProvider(type = SqlProvider.class, method = "deleteById")
	int deleteById(@Param("id") Object id, String tableName);
	
	@DeleteProvider(type = SqlProvider.class, method = "delete")
	int delete(@Param("request") Map param, String tableName);

	@SelectProvider(type = SqlProvider.class, method = "validate")
	int validate(@Param("request") Map param, String tableName);
	
	@SelectProvider(type = SqlProvider.class, method = "find")
	Map findToMap(@Param("request") Map params, String tableName);
	
	@SelectProvider(type = SqlProvider.class, method = "find")
	Object findObject(@Param("request") Map param, String tableName);
	
	@SelectProvider(type = SqlProvider.class, method = "replaceSql")
	Object findObjectBySql(String sql, @Param("request") List list);

	@SelectProvider(type = SqlProvider.class, method = "replaceSql")
	Map findMapBySql(String sql, @Param("request") List list);

	@SelectProvider(type = SqlProvider.class, method = "find")
	List> query(@Param("request") Map params, String tableName);

	@SelectProvider(type = SqlProvider.class, method = "returnParamSql")
	int findTotal(String sql, @Param("request") Map params);
	
	@SelectProvider(type = SqlProvider.class, method = "replaceSql")
	int findTotalByParam(String sql, @Param("request") List params);
}