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

import java.util.List;


@Service
public class MismapSqlService implements BaseService<MismapSql, MismapSqlExample> {
	@Resource
	private MismapSqlMapper mismapSqlMapper;
	

	@Override
	public int deleteByPrimaryKey(String ids) {

			List<String> lista=Convert.toListStrArray(ids);
			MismapSqlExample example=new MismapSqlExample();
			example.createCriteria().andSiskeyIn(lista);
			return mismapSqlMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public MismapSql selectByPrimaryKey(String id) {
				
			return mismapSqlMapper.selectByPrimaryKey(id);
				
	}

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

				
		return mismapSqlMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(MismapSql record, MismapSqlExample example) {
		
		return mismapSqlMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(MismapSql record, MismapSqlExample example) {
		
		return mismapSqlMapper.updateByExample(record, example);
	}

	@Override
	public List<MismapSql> selectByExample(MismapSqlExample example) {
		
		return mismapSqlMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(MismapSqlExample example) {
		
		return mismapSqlMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(MismapSqlExample example) {
		
		return mismapSqlMapper.deleteByExample(example);
	}

	public MismapSql findMismapSqlById(String wtnum) {


		MismapSql po=new MismapSql();

		if(StringUtils.notEmp(wtnum) )
		{
			MismapSqlExample example=new MismapSqlExample();

			MismapSqlExample.Criteria criteria =example.createCriteria();

			criteria.andSiskeyEqualTo(wtnum);

			List<MismapSql> list= mismapSqlMapper.selectByExample(example);

			if(!list.isEmpty())
			{
				po=list.get(0);

			}

		}

		return po;

	}
}
