package com.unis.base.server.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;
import com.unis.base.common.vo.TyXzzyxxHisVO;
import com.unis.base.common.vo.TyXzzyxxVO;
import com.unis.base.server.domain.TyXzzyxxDomain;
import com.unis.base.server.service.TyXzzyxxService;
import com.unis.common.utils.DateUtil;
/**
 * @author huangxing
 * @version 1.0
 * @Title TyCrkjsxxServiceImpl
 * @ProjectName TyCrkjsxxServiceImpl
 * @date 2019/07/22 17点26分
 */
@Service
public class TyXzzyxxServiceImpl implements TyXzzyxxService {

	@Autowired
	private TyXzzyxxDomain tyXzzyxxDomain;

	/**+
	 * 获取数据
	 */
	@Override
	public List<TyXzzyxxVO> getTyXzzyxxList(TyXzzyxxVO tyXzzyxxVO) {
		return tyXzzyxxDomain.getTyXzzyxxList(tyXzzyxxVO);
	}

	/**
	 * 分页展示
	 */
	@Override
	public PageInfo<TyXzzyxxVO> getTyXzzyxxPage(TyXzzyxxVO tyXzzyxxVO, Integer pageNum, Integer pageSize) {
		return tyXzzyxxDomain.getTyXzzyxxPage(tyXzzyxxVO,pageNum, pageSize);
	}

	/**
	 * 添加
	 */
	@Override
	public int insert(TyXzzyxxVO tyXzzyxxVO) {
		String date = DateUtil.getCurrentDateTime16Str();
		tyXzzyxxVO.setXzzyid("XZ"+date);
		return tyXzzyxxDomain.insert(tyXzzyxxVO);
	}

	/**
	 * 更新信息
	 */
	@Override
	public int update(TyXzzyxxVO tyXzzyxxVO) {
		return tyXzzyxxDomain.update(tyXzzyxxVO);
	}

	/**
	 * 删除
	 */
	@Override
	public int delete(String xzzyid) {
		TyXzzyxxVO tyXzzyxxVO = tyXzzyxxDomain.getTyXzzyxxById(xzzyid);
		if (tyXzzyxxVO == null) {
			return -1;
		}
		tyXzzyxxVO.setStatus(0);
		return tyXzzyxxDomain.update(tyXzzyxxVO);
	}

	/**
	 * 根据编号获取信息
	 */
	@Override
	public TyXzzyxxVO getXzzyxxByXzzyxxid(String xzzyid) {
		return tyXzzyxxDomain.getTyXzzyxxById(xzzyid);
	}

	/**
	 * 熏蒸作业信息-更改备案状态
	 * @param tyXzzyxxVO
	 * @return
	 */
	@Override
	public Integer updateFumigationOperationStatus(TyXzzyxxHisVO tyXzzyxxHisVO) {
		return tyXzzyxxDomain.updateFumigationOperationStatus(tyXzzyxxHisVO);
	}
	
	
}
