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.StopAnalysisMapper;
import com.gyee.frame.model.auto.StopAnalysis;
import com.gyee.frame.model.auto.StopAnalysisExample;
import com.gyee.frame.util.SnowflakeIdWorker;
import com.gyee.frame.util.StringUtils;
import org.springframework.stereotype.Service;

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


@Service
public class StopAnalysisService implements BaseService<StopAnalysis, StopAnalysisExample> {
	@Resource
	private StopAnalysisMapper stopAnalysisMapper;
	

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<String> lista=Convert.toListStrArray(ids);
			StopAnalysisExample example=new StopAnalysisExample();
			example.createCriteria().andIdIn(lista);
			return stopAnalysisMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public StopAnalysis selectByPrimaryKey(String id) {
				
			return stopAnalysisMapper.selectByPrimaryKey(id);
				
	}

	
	@Override
	public int updateByPrimaryKeySelective(StopAnalysis record) {
		return stopAnalysisMapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(StopAnalysis record) {
				

				
		return stopAnalysisMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(StopAnalysis record, StopAnalysisExample example) {
		
		return stopAnalysisMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(StopAnalysis record, StopAnalysisExample example) {
		
		return stopAnalysisMapper.updateByExample(record, example);
	}

	@Override
	public List<StopAnalysis> selectByExample(StopAnalysisExample example) {
		
		return stopAnalysisMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(StopAnalysisExample example) {
		
		return stopAnalysisMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(StopAnalysisExample example) {
		
		return stopAnalysisMapper.deleteByExample(example);
	}

	public List<StopAnalysis> findStopAnalysis(String wpId, String modelId, String typeId) {


		List<StopAnalysis> list=new ArrayList<>();

		if(StringUtils.notEmp(wpId) && StringUtils.notEmp(modelId) && StringUtils.notEmp(typeId))
		{
			StopAnalysisExample example=new StopAnalysisExample();
			example.setOrderByClause("wpid asc");


			list= stopAnalysisMapper.selectByExample(example);
		}

		return list;

	}
}
