com.kqinfo.universal.comdao.core.CommonDao Maven / Gradle / Ivy
The newest version!
package com.kqinfo.universal.comdao.core;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import java.util.List;
import java.util.Map;
/**
*
* @author zpj
* @date 2016/10/17
* 根据动态SQL的原理,组装SQL
*/
@Mapper
public interface CommonDao {
/**
* 插入一个对象
*
* @param params 实体对象
* @return 大于0为成功
*/
@InsertProvider(type = SqlBuilder.class, method = "insert")
int insert(T params);
/**
* 删除一个对象
*
* @param id 主键
* @param cls 指定一个实体类型
* @return delete line count
*/
@DeleteProvider(type = SqlBuilder.class, method = "delete")
int delete(@Param("id") T id, Class> cls);
/**
* 修改对象,必须有主键
*
* @param params param
* @param type
* @return update line count
*/
@UpdateProvider(type = SqlBuilder.class, method = "update")
int update(T params);
/**
* 根据主键选择一个对象
*
* @param id 关键字
* @param cls 指定一个实体
* @return result
*/
@SelectProvider(type = SqlBuilder.class, method = "select")
Map,?> select(@Param("id") T id, Class> cls);
/**
* 查询列表条数跟 selectList 配对使用
*
* @param params param
* @param param type
* @return count
*/
@SelectProvider(type = SqlBuilder.class, method = "selectCount")
long selectCount(T params);
/**
* 查询列表
*
* @param params param
* @return result
*/
@SelectProvider(type = SqlBuilder.class, method = "selectList")
List