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

cn.cliveyuan.robin.base.provider.SqlProvider Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*
 * Copyright (c) 2020  Clive Yuan ([email protected]).
 */

package cn.cliveyuan.robin.base.provider;

import cn.cliveyuan.robin.base.support.SqlProviderSupport;
import org.apache.ibatis.builder.annotation.ProviderContext;
import org.apache.ibatis.builder.annotation.ProviderMethodResolver;

import java.util.Map;

/**
 * SQL提供者
 *
 * @author Clive Yuan
 * @date 2020/10/28
 */
public class SqlProvider implements ProviderMethodResolver {

    public  String insert(ProviderContext providerContext, T entity) {
        SqlProviderSupport.checkEntity(entity);
        return SqlProviderSupport.getSqlScript("insert", providerContext);
    }

    public  String insertAll(ProviderContext providerContext, T entity) {
        SqlProviderSupport.checkEntity(entity);
        return SqlProviderSupport.getSqlScript("insertAll", providerContext);
    }

    public  String insertIgnore(ProviderContext providerContext, T entity) {
        SqlProviderSupport.checkEntity(entity);
        return SqlProviderSupport.getSqlScript("insertIgnore", providerContext);
    }

    public String batchInsert(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkEntityList(paramMap);
        return SqlProviderSupport.getSqlScript("batchInsert", providerContext);
    }

    public  String batchInsertIgnore(ProviderContext providerContext, T entity) {
        SqlProviderSupport.checkEntity(entity);
        return SqlProviderSupport.getSqlScript("batchInsertIgnore", providerContext);
    }

    public String delete(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkId(paramMap);
        return SqlProviderSupport.getSqlScript("delete", providerContext);
    }

    public String batchDelete(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkIds(paramMap);
        return SqlProviderSupport.getSqlScript("batchDelete", providerContext);
    }

    public String deleteByExample(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkCondition(paramMap);
        return SqlProviderSupport.getSqlScript("deleteByExample", providerContext);
    }

    public String update(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkEntity(paramMap);
        return SqlProviderSupport.getSqlScript("update", providerContext);
    }

    public String updateAll(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkEntity(paramMap);
        return SqlProviderSupport.getSqlScript("updateAll", providerContext);
    }

    public String updateByExample(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkCondition(paramMap);
        return SqlProviderSupport.getSqlScript("updateByExample", providerContext);
    }

    public String updateByExampleAll(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkCondition(paramMap);
        return SqlProviderSupport.getSqlScript("updateByExampleAll", providerContext);
    }

    public String get(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkId(paramMap);
        return SqlProviderSupport.getSqlScript("get", providerContext);
    }

    public String batchGet(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.checkIds(paramMap);
        return SqlProviderSupport.getSqlScript("batchGet", providerContext);
    }

    public String getByExample(ProviderContext providerContext) {
        return SqlProviderSupport.getSqlScript("getByExample", providerContext);
    }

    public String list(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.filterCondition(paramMap);
        return SqlProviderSupport.getSqlScript("list", providerContext);
    }

    public String count(ProviderContext providerContext, Map paramMap) {
        SqlProviderSupport.filterCondition(paramMap);
        return SqlProviderSupport.getSqlScript("count", providerContext);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy