package com.gyee.frame.service;

import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.common.support.Convert;
import com.gyee.frame.mapper.auto.WindsubstationMapper;
import com.gyee.frame.model.auto.Windsubstation;
import com.gyee.frame.model.auto.WindsubstationExample;
import com.gyee.frame.util.SnowflakeIdWorker;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class WindsubstationService implements BaseService<Windsubstation, WindsubstationExample> {
    @Resource
    private WindsubstationMapper windsubstationMapper;


    @Override
    public int deleteByPrimaryKey(String ids) {

        List<String> lista = Convert.toListStrArray(ids);
        WindsubstationExample example = new WindsubstationExample();
        example.createCriteria().andIdIn(lista);
        return windsubstationMapper.deleteByExample(example);


    }


    @Override
    public Windsubstation selectByPrimaryKey(String id) {

        return windsubstationMapper.selectByPrimaryKey(id);

    }


    @Override
    public int updateByPrimaryKeySelective(Windsubstation record) {
        return windsubstationMapper.updateByPrimaryKeySelective(record);
    }


    /**
     * 添加
     */
    @Override
    public int insertSelective(Windsubstation record) {

        //添加雪花主键id
        record.setId(SnowflakeIdWorker.getUUID());


        return windsubstationMapper.insertSelective(record);
    }


    @Override
    public int updateByExampleSelective(Windsubstation record, WindsubstationExample example) {

        return windsubstationMapper.updateByExampleSelective(record, example);
    }


    @Override
    public int updateByExample(Windsubstation record, WindsubstationExample example) {

        return windsubstationMapper.updateByExample(record, example);
    }

    @Override
    public List<Windsubstation> selectByExample(WindsubstationExample example) {

        return windsubstationMapper.selectByExample(example);
    }


    @Override
    public long countByExample(WindsubstationExample example) {

        return windsubstationMapper.countByExample(example);
    }


    @Override
    public int deleteByExample(WindsubstationExample example) {

        return windsubstationMapper.deleteByExample(example);
    }


    public  List<Windsubstation> findAllList() {

        WindsubstationExample example = new WindsubstationExample();

        List<Windsubstation> vos = windsubstationMapper.selectByExample(example);


        return vos;

    }


}
