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.Wttragetreport3Mapper;
import com.gyee.frame.model.auto.Wttragetreport3;
import com.gyee.frame.model.auto.Wttragetreport3Example;
import com.gyee.frame.util.DateUtils;
import com.gyee.frame.util.StringUtils;
import org.springframework.stereotype.Service;

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

/**
 * 线路 Wttragetreport3Service
 * @Title: Wttragetreport3Service.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class Wttragetreport3Service implements BaseService<Wttragetreport3, Wttragetreport3Example> {
	@Resource
	private Wttragetreport3Mapper wttragetreport3Mapper;
	
   
	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<Integer> lista=Convert.toIntArrayList(ids);
			Wttragetreport3Example example=new Wttragetreport3Example();
			example.createCriteria().andIdIn(lista);
			return wttragetreport3Mapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public Wttragetreport3 selectByPrimaryKey(String id) {
				
			return wttragetreport3Mapper.selectByPrimaryKey(Integer.valueOf(id));
				
	}

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

				
		return wttragetreport3Mapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(Wttragetreport3 record, Wttragetreport3Example example) {
		
		return wttragetreport3Mapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(Wttragetreport3 record, Wttragetreport3Example example) {
		
		return wttragetreport3Mapper.updateByExample(record, example);
	}

	@Override
	public List<Wttragetreport3> selectByExample(Wttragetreport3Example example) {
		
		return wttragetreport3Mapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(Wttragetreport3Example example) {
		
		return wttragetreport3Mapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(Wttragetreport3Example example) {
		
		return wttragetreport3Mapper.deleteByExample(example);
	}

	public List<Wttragetreport3> findWttragetreport3(String wtId, Integer  year,Integer month) {


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

		if(StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
		{
			Wttragetreport3Example example=new Wttragetreport3Example();
			example.setOrderByClause("recodedate asc");

			Wttragetreport3Example.Criteria criteria =example.createCriteria();

			criteria.andYearEqualTo(year);

			criteria.andMonthEqualTo(month);

			list= wttragetreport3Mapper.selectByExample(example);
		}


		return list;

	}


	public List<Wttragetreport3> findWttragetreport3(String wtId,  Date recorddate) {


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

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

			Wttragetreport3Example.Criteria criteria =example.createCriteria();


			criteria.andRecodedateGreaterThanOrEqualTo(recorddate).andRecodedateLessThan(DateUtils.addDays(recorddate,1));
			list= wttragetreport3Mapper.selectByExample(example);
		}


		return list;

	}

}
