All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.sylinx.hbatis.ext.mirage.repository.BaseRepositoryImpl Maven / Gradle / Ivy

There is a newer version: 1.3.3-rc.2
Show newest version
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);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy