cn.vonce.sql.orm.dao.MybatisSqlBeanDao Maven / Gradle / Ivy
package cn.vonce.sql.orm.dao;
import cn.vonce.sql.bean.Delete;
import cn.vonce.sql.bean.Insert;
import cn.vonce.sql.bean.Paging;
import cn.vonce.sql.bean.Select;
import cn.vonce.sql.bean.Update;
import cn.vonce.sql.config.SqlBeanConfig;
import cn.vonce.sql.orm.provider.MybatisSqlBeanProvider;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* 通用的数据库操作
*
* @param
* @author Jovi
* @version 1.0
* @email [email protected]
* @date 2018年5月15日下午3:56:51
*/
@Repository
public interface MybatisSqlBeanDao {
/**
* 根据id条件查询
*
* @param sqlBeanConfig
* @param clazz
* @param id
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectById")
T selectById(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("id") Object id);
/**
* 根据id条件查询(可指定返回类型、查询的表)
*
* @param sqlBeanConfig
* @param clazz
* @param returnType
* @param id
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectById")
O selectByIdO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("id") Object id);
/**
* 根据ids条件查询
*
* @param sqlBeanConfig
* @param clazz
* @param ids
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByIds")
List selectByIds(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("ids") Object... ids);
/**
* 根据id条件查询(可指定返回类型、查询的表)
*
* @param sqlBeanConfig
* @param clazz
* @param returnType
* @param ids
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByIds")
List selectByIdsO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("ids") Object... ids);
/**
* 根据自定义条件查询 只返回一条记录
*
* @param sqlBeanConfig
* @param clazz
* @param select
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "select")
T selectOne(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("select") Select select);
/**
* 根据自定义条件查询 只返回一条记录(可指定返回类型)
*
* @param sqlBeanConfig
* @param clazz
* @param returnType
* @param select
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "select")
O selectOneO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("select") Select select);
/**
* 根据自定义条件查询返回Map
*
* @param sqlBeanConfig
* @param clazz
* @param select
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "select")
Map selectMap(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("select") Select select);
/**
* 根据条件查询
*
* @param sqlBeanConfig
* @param clazz
* @param where
* @param args
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByCondition")
T selectOneByCondition(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("where") String where, @Param("args") Object... args);
/**
* 根据条件查询(可指定返回类型、查询的表)
*
* @param sqlBeanConfig
* @param clazz
* @param returnType
* @param where
* @param args
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByCondition")
O selectOneByConditionO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("where") String where, @Param("args") Object... args);
/**
* 根据条件查询(可指定返回类型、查询的表)
*
* @param sqlBeanConfig
* @param clazz
* @param paging
* @param where
* @param args
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByCondition")
List selectByConditionO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("paging") Paging paging, @Param("where") String where, @Param("args") Object... args);
/**
* 根据条件查询
*
* @param sqlBeanConfig
* @param clazz
* @param paging
* @param where
* @param args
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectByCondition")
List selectByCondition(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("paging") Paging paging, @Param("where") String where, @Param("args") Object... args);
/**
* 根据条件查询统计
*
* @param sqlBeanConfig
* @param clazz
* @param where
* @param args
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectCountByCondition")
long selectCountByCondition(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("where") String where, @Param("args") Object... args);
/**
* 查询全部
*
* @param sqlBeanConfig
* @param clazz
* @param paging
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectAll")
List selectAll(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("paging") Paging paging);
/**
* 查询全部(可指定返回类型、查询的表)
*
* @param sqlBeanConfig
* @param clazz
* @param returnType
* @param paging
* @return
*/
@SelectProvider(type = MybatisSqlBeanProvider.class, method = "selectAll")
List selectAllO(@Param("sqlBeanConfig") SqlBeanConfig sqlBeanConfig, @Param("clazz") Class> clazz, @Param("returnType") Class returnType, @Param("paging") Paging paging);
/**
* 根据自定义条件查询(可自动分页)返回List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy