package com.ssm.core.impl;

import com.ssm.core.mapper.BaseMapper;
import com.ssm.manage.dao.BaseDao;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

public abstract class BaseDaoImpl<Pojo> implements BaseDao<Pojo> {

   protected abstract BaseMapper<Pojo> getMapper();

    public int deleteByExample(Object o) {
        return getMapper().deleteByExample(o);
    }

    public int deleteByPrimaryKey(Object o) {
        return getMapper().deleteByPrimaryKey(o);
    }


    public int delete(Pojo pojo) {
        return getMapper().delete(pojo);
    }


    public boolean existsWithPrimaryKey(Object o) {
        return getMapper().existsWithPrimaryKey(o);
    }

    public int insertList(List<Pojo> list) {
        return getMapper().insertList(list);
    }


    public int insert(Pojo pojo) {
        return getMapper().insert(pojo);
    }

    public int saveNotNull(Pojo pojo) {
        return getMapper().insertSelective(pojo);
    }

//    public int insertUseGeneratedKeys(Pojo pojo) {
//        return getMapper().insertUseGeneratedKeys(pojo);
//    }

    public List<Pojo> selectAll() {
        return getMapper().selectAll();
    }

    public List<Pojo> selectByExample(Object o) {
        return getMapper().selectByExample(o);
    }

    public List<Pojo> selectByExampleAndRowBounds(Object o, RowBounds rowBounds) {
        return getMapper().selectByExampleAndRowBounds(o, rowBounds);
    }

    public Pojo selectByPrimaryKey(Object o) {
        return getMapper().selectByPrimaryKey(o);
    }

    public int selectCountByExample(Object o) {
        return getMapper().selectCountByExample(o);
    }

    public int selectCount(Pojo pojo) {
        return getMapper().selectCount(pojo);
    }

    public List<Pojo> select(Pojo pojo) {
        return getMapper().select(pojo);
    }

    public Pojo selectOne(Pojo pojo) {
        return getMapper().selectOne(pojo);
    }

    public List<Pojo> selectByRowBounds(Pojo pojo, RowBounds rowBounds) {
        return getMapper().selectByRowBounds(pojo, rowBounds);
    }

    public int updateByExample(Pojo pojo, Object o) {
        return getMapper().updateByExample(pojo, o);
    }

    public int updateByExampleSelective(Pojo pojo, Object o) {
        return getMapper().updateByExampleSelective(pojo, o);
    }

    public int updateByPrimaryKey(Pojo pojo) {
        return getMapper().updateByPrimaryKey(pojo);
    }

    public int updateByPrimaryKeySelective(Pojo pojo) {
        return getMapper().updateByPrimaryKeySelective(pojo);
    }

//
}
