package com.gyee.frame.service.report;

import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.common.support.Convert;
import com.gyee.frame.mapper.auto.WtReportFault3Mapper;
import com.gyee.frame.model.auto.WtReportFault3;
import com.gyee.frame.model.auto.WtReportFault3Example;
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;

/**
 * 线路 WtReportFault3Service
 * @Title: WtReportFault3Service.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class WtReportFault3Service implements BaseService<WtReportFault3, WtReportFault3Example> {
	@Resource
	private WtReportFault3Mapper wtReportFault3Mapper;
	

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

	
	@Override
	public int updateByPrimaryKeySelective(WtReportFault3 record) {
		return wtReportFault3Mapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(WtReportFault3 record) {
				
		//添加雪花主键id
		record.setId(SnowflakeIdWorker.getUUID());
			
				
		return wtReportFault3Mapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(WtReportFault3 record, WtReportFault3Example example) {
		
		return wtReportFault3Mapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(WtReportFault3 record, WtReportFault3Example example) {
		
		return wtReportFault3Mapper.updateByExample(record, example);
	}

	@Override
	public List<WtReportFault3> selectByExample(WtReportFault3Example example) {
		
		return wtReportFault3Mapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(WtReportFault3Example example) {
		
		return wtReportFault3Mapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(WtReportFault3Example example) {
		
		return wtReportFault3Mapper.deleteByExample(example);
	}

	public List<WtReportFault3> findWtReportFault3(Integer tid,String wtId) {


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

		if(StringUtils.notEmp(tid) && StringUtils.notEmp(wtId))
		{
			WtReportFault3Example example=new WtReportFault3Example();
			example.setOrderByClause("recodedate asc");

			WtReportFault3Example.Criteria criteria =example.createCriteria();

			criteria.andTidEqualTo(tid);
			criteria.andWtidEqualTo(wtId);
			list= wtReportFault3Mapper.selectByExample(example);
		}

		return list;

	}

}
