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.StatejudgmentrecordMapper;
import com.gyee.frame.model.auto.Statejudgmentrecord;
import com.gyee.frame.model.auto.StatejudgmentrecordExample;
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 StatejudgmentrecordService implements BaseService<Statejudgmentrecord, StatejudgmentrecordExample> {
	@Resource
	private StatejudgmentrecordMapper statejudgmentrecordMapper;
	

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

	
	@Override
	public int updateByPrimaryKeySelective(Statejudgmentrecord record) {
		return statejudgmentrecordMapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(Statejudgmentrecord record) {
				
			
				
		return statejudgmentrecordMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(Statejudgmentrecord record, StatejudgmentrecordExample example) {
		
		return statejudgmentrecordMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(Statejudgmentrecord record, StatejudgmentrecordExample example) {
		
		return statejudgmentrecordMapper.updateByExample(record, example);
	}

	@Override
	public List<Statejudgmentrecord> selectByExample(StatejudgmentrecordExample example) {
		
		return statejudgmentrecordMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(StatejudgmentrecordExample example) {
		
		return statejudgmentrecordMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(StatejudgmentrecordExample example) {
		
		return statejudgmentrecordMapper.deleteByExample(example);
	}


	public List<Statejudgmentrecord> getStatejudgmentrecordListBywtId(String wtId) {

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

		if (StringUtils.notEmp(wtId)  ) {

			StatejudgmentrecordExample example=new StatejudgmentrecordExample();
			example.setOrderByClause("statejudgment DESC");
			StatejudgmentrecordExample.Criteria criteria =example.createCriteria();

			criteria.andWtidEqualTo(wtId);
			list= statejudgmentrecordMapper.selectByExample(example);

		}
		return list;

	}
}
