package com.ag.dynamicmodule.service;

import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 *
 * @author WangN
 * @date 2017/4/8
 *
 */
public abstract class IBaseRepository {

    private SqlSessionTemplate sqlSessionTemplate;

    private List<?> beanList;

    private String sqlType;

    /**
     *  namespace+tag
     */
    private String myBatisNameSpace;
    
    public static final String INSERT="insert";

    public static final String UPDATE="update";

    public static final String DELETE="delete";

    SqlSessionTemplate getSqlSessionTemplate() {
        return sqlSessionTemplate;
    }

    List<?> beanList() {
        return beanList;
    }

    public abstract Object mbtParams(Object bean,int index) throws Exception;

    String sqlType() {
        return sqlType;
    }

    String myBatisNameSpace() {
        return myBatisNameSpace;
    }

    public IBaseRepository(SqlSessionTemplate sqlSessionTemplate,
                           List<?> beanList, String sqlType, String myBatisNameSpace) {
        this.sqlSessionTemplate=sqlSessionTemplate;
        this.beanList = beanList;
        this.sqlType = sqlType;
        this.myBatisNameSpace = myBatisNameSpace;
    }
}