📄 manager.java
字号:
package com.lily.dap.service;
import java.io.Serializable;
import java.util.List;
import org.springframework.orm.ObjectRetrievalFailureException;
import com.lily.dap.model.QueryCondition;
import com.lily.dap.service.core.exception.DataNotExistException;
/**
* 基本的管理接口,实现了对任意对象的CRUD操作
*
* @author zouxuemo
*
*/
public interface Manager {
/**
* 检索给定ID的对象
*
* @param clazz model class to lookup
* @param id the identifier (primary key) of the class
* @return a populated object
* @see org.springframework.orm.ObjectRetrievalFailureException
*/
public Object get(Class clazz, long id) throws DataNotExistException;
/**
* 检索给定ID的对象
*
* @param clazz model class to lookup
* @param id the identifier (primary key) of the class
* @return a populated object
* @see org.springframework.orm.ObjectRetrievalFailureException
*/
public Object get(Class clazz, Serializable id) throws DataNotExistException;
/**
* 检索给定字段的给定值的给定类对象,如果没有检索到,则抛出异常
*
* @param clazz
* @param fieldName
* @param fieldValue
* @return
* @throws ObjectRetrievalFailureException
*/
public Object get(Class clazz, String fieldName, Object fieldValue) throws DataNotExistException;
/**
* 检索给定字段列表的给定值的给定类对象,如果没有检索到,则抛出异常
*
* @param clazz
* @param fieldNames
* @param fieldValues
* @return
* @throws ObjectRetrievalFailureException
*/
public Object get(Class clazz, String[] fieldNames, Object[] fieldValues) throws DataNotExistException;
/**
* 查询给定查询条件的数据集合列表
*
* @param clazz
* @param queryCondition
* @param callBack
* @return
*/
public List gets(Class clazz, QueryCondition queryCondition);
/**
* 给定SQL语句检索数据,并且指定返回结果的页号和每页记录数,返回存储查询结果Map的集合,其中Map的key对应查询字段的字段名
* SQL语句要求,对于查询字段中是表达式的字段需要指定一个别名
*
* @param sql
* @param pageNo
* @param pageSize
* @return
*/
public List gets(String sql, final int pageNo, final int pageSize);
/**
* 检索给定查询条件的给定类对象集合数量
*
* @param clazz
* @param queryCondition
* @return
*/
public long count(Class clazz, QueryCondition queryCondition);
/**
* 检索给定SQL语句的数据记录数量
*
* @param sql
* @return
*/
public long count(String sql);
/**
* 添加对象信息
*
* @param o
* @return
*/
public Object add(Object o);
/**
* 修改对象信息
*
* @param o
*/
public void modify(Object o);
/**
* Generic method to delete an object based on class and id
* @param clazz model class to lookup
* @param id the identifier of the class
*/
public void remove(Class clazz, Serializable id);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -