package com.fjs.scenic.service.common.impl;

import com.fjs.scenic.entity.news.News;
import com.fjs.scenic.mapper.common.BaseMapper;
import com.fjs.scenic.service.common.BaseService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * This class is used for ...
 *
 * @author qufei
 * @version 1.0
 * @CreateDate ${date} ${time}
 */
public class BaseServiceImpl<T> implements BaseService<T> {
    @Autowired
    private BaseMapper<T> mapper;

    @Override
    public List<T> page(T obj) {
        return mapper.selectAll(obj);
    }

    @Override
    public int add(T obj) {
        return mapper.insertSelective(obj);
    }

    @Override
    public int update(T obj) {
        return mapper.updateByPrimaryKeySelective(obj);
    }

    @Override
    public int del(int id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public T get(int id) {
        return mapper.selectByPrimaryKey(id);
    }

}
