package com.ssm.core.service.impl;



import com.ssm.core.service.BaseService;
import com.ssm.manage.dao.BaseDao;
import com.ssm.manage.entity.SmsException;

import java.util.List;

public abstract class BaseServiceImpl<Pojo> implements BaseService<Pojo> {
    public abstract BaseDao<Pojo> getDao();

    public Pojo selectByPrimaryKey(Object key) {
        return this.getDao().selectByPrimaryKey(key);
    }

//    public Pojo selectOneByExample(Pojo example) {
//        return this.getDao().selectOneByExample(example);
//    }

    public List<Pojo> selectByExample(Object example) {
        return this.getDao().selectByExample(example);
    }

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

    public int save(Pojo entity) {
        return this.getDao().insert(entity);
    }

    public int saveNotNull(Pojo entity) {
        return this.getDao().saveNotNull(entity);
    }

    public int deleteByPrimaryKey(Object key){
        return this.getDao().deleteByPrimaryKey(key);
    }

    public int delete(Pojo entity) throws SmsException {
        return this.getDao().delete(entity);
    }

    public int updateByPrimaryKey(Pojo entity){
        return this.getDao().updateByPrimaryKey(entity);
    }

    public int updateNotNull(Pojo entity) {
        return this.getDao().updateByPrimaryKeySelective(entity);
    }

    public int selectCountByExample(Object example){return this.getDao().selectCountByExample(example);}

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

    public int selectCount(Pojo entity){return this.getDao().selectCount(entity);}

    public Pojo selectOne(Pojo entity){
        return this.getDao().selectOne(entity);
    }

    public List<Pojo> select(Pojo entity){
        return this.getDao().select(entity);
    }

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