package com.unis.base.server.domain;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.unis.base.common.vo.TyLhtzdVO;
import com.unis.base.server.dao.TyLhtzdDao;
import com.unis.base.server.entity.TyLhtzdDO;
import com.unis.common.utils.LsBeanUtils;

/**
 * @author huangxing
 * @version 1.0
 * @Title TyLhtzdDomain
 * @ProjectName 持久化
 * @Description
 * @date 2019/07/22 17点26分
 */
@Component
public class TyLhtzdDomain extends BaseDomain {

	@Autowired
	private TyLhtzdDao tyLhtzdMapper;

	/**
	 *
	 * @param TyLhtzdVO
	 * @return
	 */
	public List<TyLhtzdVO> getTyLhtzdList(TyLhtzdVO tyLhtzdVO) {
		TyLhtzdDO tyLhtzdDO = new TyLhtzdDO();
		//进行传递参数copy
		LsBeanUtils.copyAllProperties(tyLhtzdVO,tyLhtzdDO);
		List<TyLhtzdVO> TyLhtzdVOList = new ArrayList<TyLhtzdVO>();

		for (TyLhtzdDO tyLhtzdDOs : tyLhtzdMapper.selectAlls(tyLhtzdDO)) {
			LsBeanUtils.copyAllProperties(tyLhtzdDOs,tyLhtzdVO);
			TyLhtzdVOList.add(tyLhtzdVO);
		}
		return TyLhtzdVOList;
	}

	/**
	 *
	 * @param TyLhtzdVO
	 * @return
	 */
	public int insert(TyLhtzdVO tyLhtzdVO) {
		//进行传递参数copy
		TyLhtzdDO tyLhtzdDO = new TyLhtzdDO();
		LsBeanUtils.copyAllProperties(tyLhtzdVO, tyLhtzdDO);
		return tyLhtzdMapper.insert(tyLhtzdDO);
	}

	/**
	 *
	 * @param tzdid
	 * @return
	 */
	public TyLhtzdVO getTyLhtzdById(String tzdid) {
		TyLhtzdVO TyLhtzdVO = new TyLhtzdVO();
		LsBeanUtils.copyAllProperties(tyLhtzdMapper.selectByKey(tzdid), TyLhtzdVO);
		return TyLhtzdVO;
	}

	/**
	 *
	 * @param TyLhtzdVO
	 * @return
	 */
	public int update(TyLhtzdVO tyLhtzdVO) {
		//进行传递参数copy
		TyLhtzdDO tyLhtzdDO = new TyLhtzdDO();
		LsBeanUtils.copyAllProperties(tyLhtzdVO, tyLhtzdDO);
		return tyLhtzdMapper.updateByPrimaryKey(tyLhtzdDO);
	}

}
