zl程序教程

您现在的位置是:首页 >  后端

当前栏目

java 设计BaseDao

JAVA 设计
2023-09-11 14:16:34 时间

import java.util.List;


public interface BaseDaoMapper<T extends BaseEntity> {
	
    public <PK> T getById(PK id)throws DataAccessException;

    public void save(T entity)throws DataAccessException;

    public void update(T entity)throws DataAccessException;

    public <PK> void deleteById(PK id)throws DataAccessException;
    
    public List<T> getAllData() throws DataAccessException;
    
    public List<T> getByEntity(T entity) throws DataAccessException;
    
    public void deleteByIds(List<String> ids)throws DataAccessException;
    
    
}




public class BaseEntity implements java.io.Serializable{

	/**
	 * serialVersionUID:
	 *
	 * @since Ver 1.1
	 */
	
	private static final long serialVersionUID = 4831177830237254301L;
	
	

}


public interface BaseService <T extends BaseEntity> {
	
    public <PK> T getById(PK id)throws ServiceException;

    public void save(T entity)throws ServiceException;

    public void update(T entity)throws ServiceException;

    public List<T> getAllData() throws ServiceException;
    
    public List<T> getByEntity(T entity) throws ServiceException;
    
    public <PK> void deleteByIds(List<String> ids)throws ServiceException;
}