package com.unis.base.server.domain;


import java.util.ArrayList;
import java.util.List;

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

import com.unis.base.common.vo.TyLqxxVO;
import com.unis.base.server.dao.TyLqxxDao;
import com.unis.base.server.entity.TyLqxxDO;
import com.unis.common.utils.LsBeanUtils;

import org.springframework.stereotype.Component;

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

	@Autowired
	private TyLqxxDao tyLqxxMapper;

	/**
	 *
	 * @param TyLqxxVO
	 * @return
	 */
	public List<TyLqxxVO> getTyLqxxList(TyLqxxVO tyLqxxVO) {
		TyLqxxDO dCfxxsjyDO = new TyLqxxDO();
		//进行传递参数copy
		LsBeanUtils.copyAllProperties(tyLqxxVO,dCfxxsjyDO);
		List<TyLqxxVO> TyLqxxVOList = new ArrayList<TyLqxxVO>();

		for (TyLqxxDO tyLqxxDO : tyLqxxMapper.selectAlls(dCfxxsjyDO)) {
			LsBeanUtils.copyAllProperties(tyLqxxDO, tyLqxxVO);
			TyLqxxVOList.add(tyLqxxVO);
		}
		return TyLqxxVOList;
	}

	/**
	 *
	 * @param TyLqxxVO
	 * @return
	 */
	public int insert(TyLqxxVO tyLqxxVO) {
		//进行传递参数copy
		TyLqxxDO tyLqxxDO = new TyLqxxDO();
		LsBeanUtils.copyAllProperties(tyLqxxVO, tyLqxxDO);
		return tyLqxxMapper.insert(tyLqxxDO);
	}

	/**
	 *
	 * @param lqid
	 * @return
	 */
	public TyLqxxVO getTyLqxxById(String lqid) {
		TyLqxxVO tyLqxxVO = new TyLqxxVO();
		LsBeanUtils.copyAllProperties(tyLqxxMapper.selectByKey(lqid), tyLqxxVO);
		return tyLqxxVO;
	}

	/**
	 *
	 * @param TyLqxxVO
	 * @return
	 */
	public int update(TyLqxxVO tyLqxxVO) {
		//进行传递参数copy
		TyLqxxDO tyLqxxDO = new TyLqxxDO();
		LsBeanUtils.copyAllProperties(tyLqxxVO, tyLqxxDO);
		return tyLqxxMapper.updateByPrimaryKey(tyLqxxDO);
	}

}
