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.TyCrkjsxxVO;
import com.unis.base.server.dao.TyCrkjsxxDao;
import com.unis.base.server.entity.TyCrkjsxxDO;
import com.unis.common.utils.LsBeanUtils;

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

	@Autowired
	private TyCrkjsxxDao tyCrkjsxxDao;

	/**
	 *
	 * @param tyCrkjsxxVO
	 * @return
	 */
	public List<TyCrkjsxxVO> getTyCrkjsxxList(TyCrkjsxxVO tyCrkjsxxVO) {
		TyCrkjsxxDO dCfxxsjyDO = new TyCrkjsxxDO();
		//进行传递参数copy
		LsBeanUtils.copyAllProperties(tyCrkjsxxVO,dCfxxsjyDO);
		List<TyCrkjsxxVO> tyCrkjsxxVOList = new ArrayList<TyCrkjsxxVO>();

		for (TyCrkjsxxDO TyCrkjsxxDO : tyCrkjsxxDao.selectAlls(dCfxxsjyDO)) {
			LsBeanUtils.copyAllProperties(TyCrkjsxxDO,tyCrkjsxxVO);
			tyCrkjsxxVOList.add(tyCrkjsxxVO);
		}
		return tyCrkjsxxVOList;
	}

	/**
	 *
	 * @param tyCrkjsxxVO
	 * @return
	 */
	public int insert(TyCrkjsxxVO tyCrkjsxxVO) {
		//进行传递参数copy
		TyCrkjsxxDO tyCrkjsxxDO = new TyCrkjsxxDO();
		LsBeanUtils.copyAllProperties(tyCrkjsxxVO,tyCrkjsxxDO);
		return tyCrkjsxxDao.insert(tyCrkjsxxDO);
	}

	/**
	 *
	 * @param jsid
	 * @return
	 */
	public TyCrkjsxxVO getTyCrkjsxxById(String jsid) {
		TyCrkjsxxVO tyCrkjsxxVO = new TyCrkjsxxVO();
		LsBeanUtils.copyAllProperties(tyCrkjsxxDao.selectByKey(jsid), tyCrkjsxxVO);
		return tyCrkjsxxVO;
	}

	/**
	 *
	 * @param tyCrkjsxxVO
	 * @return
	 */
	public int update(TyCrkjsxxVO tyCrkjsxxVO) {
		//进行传递参数copy
		TyCrkjsxxDO tyCrkjsxxDO = new TyCrkjsxxDO();
		LsBeanUtils.copyAllProperties(tyCrkjsxxVO,tyCrkjsxxDO);
		return tyCrkjsxxDao.updateByPrimaryKey(tyCrkjsxxDO);
	}
}
