cn.sylinx.hbatis.ext.mirage.repository.BaseRepositoryImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbatis-mirage Show documentation
Show all versions of hbatis-mirage Show documentation
hbatis mirage is a simple orm framework, extends hbatis-core
package cn.sylinx.hbatis.ext.mirage.repository;
import java.util.List;
import java.util.Map;
import cn.sylinx.hbatis.ext.mirage.spi.MirageServiceManager;
import cn.sylinx.hbatis.ext.res.ClasspathSqlResource;
public class BaseRepositoryImpl extends RepositoryImpl implements BaseRepository {
public BaseRepositoryImpl() {
}
public BaseRepositoryImpl(String datasourceName) {
super(datasourceName);
}
@Override
public boolean execute(ClasspathSqlResource resource, Map params) {
return MirageServiceManager.getMirageService().useService(getDatabase()).execute(resource, params);
}
@Override
public boolean execute(ClasspathSqlResource resource) {
return execute(resource, null);
}
@Override
public List queryList(ClasspathSqlResource resource, Map params, Class clz) {
return MirageServiceManager.getMirageService().useService(getDatabase()).query(resource, params, clz);
}
@Override
public List queryList(ClasspathSqlResource resource, Class clz) {
return queryList(resource, null, clz);
}
@Override
public T queryFirst(ClasspathSqlResource resource, Map params, Class clz) {
return MirageServiceManager.getMirageService().useService(getDatabase()).queryFirst(resource, params, clz);
}
@Override
public T queryFirst(ClasspathSqlResource resource, Class clz) {
return queryFirst(resource, null, clz);
}
@Override
public List queryListWithCache(ClasspathSqlResource resource, Map params, Class clz) {
return MirageServiceManager.getMirageService().useService(getDatabase()).withMirageCache().query(resource,
params, clz);
}
@Override
public List queryListWithCache(ClasspathSqlResource resource, Class clz) {
return queryListWithCache(resource, null, clz);
}
@Override
public T queryFirstWithCache(ClasspathSqlResource resource, Map params, Class clz) {
return MirageServiceManager.getMirageService().useService(getDatabase()).withMirageCache().queryFirst(resource,
params, clz);
}
@Override
public T queryFirstWithCache(ClasspathSqlResource resource, Class clz) {
return queryFirstWithCache(resource, null, clz);
}
}