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.ShbraceletPointkeyMapper;
import com.gyee.frame.model.auto.ShbraceletPointkey;
import com.gyee.frame.model.auto.ShbraceletPointkeyExample;
import com.gyee.frame.util.StringUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class ShbraceletPointkeyService implements BaseService<ShbraceletPointkey, ShbraceletPointkeyExample> {
	@Resource
	private ShbraceletPointkeyMapper shbraceletPointkeyMapper;
	

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<Integer> lista=Convert.toIntArrayList(ids);
			ShbraceletPointkeyExample example=new ShbraceletPointkeyExample();
			example.createCriteria().andIdIn(lista);
			return shbraceletPointkeyMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public ShbraceletPointkey selectByPrimaryKey(String id) {
				
			return shbraceletPointkeyMapper.selectByPrimaryKey(Integer.valueOf(id));
				
	}

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

				
		return shbraceletPointkeyMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(ShbraceletPointkey record, ShbraceletPointkeyExample example) {
		
		return shbraceletPointkeyMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(ShbraceletPointkey record, ShbraceletPointkeyExample example) {
		
		return shbraceletPointkeyMapper.updateByExample(record, example);
	}

	@Override
	public List<ShbraceletPointkey> selectByExample(ShbraceletPointkeyExample example) {
		
		return shbraceletPointkeyMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(ShbraceletPointkeyExample example) {
		
		return shbraceletPointkeyMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(ShbraceletPointkeyExample example) {
		
		return shbraceletPointkeyMapper.deleteByExample(example);
	}

	//通过设备编号获得相应测点信息
	public List<ShbraceletPointkey> findShbraceletPointkeyList(int deviceId) {

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

		if(StringUtils.notEmp(deviceId))
		{
			ShbraceletPointkeyExample example=new ShbraceletPointkeyExample();

			ShbraceletPointkeyExample.Criteria criteria =example.createCriteria();

			criteria.andDeviceidEqualTo(deviceId);
			list= shbraceletPointkeyMapper.selectByExample(example);

		}

		return list;

	}
}
