package org.linlinjava.jz.db.service.hm;

import org.linlinjava.jz.db.dao.HmCommentMapper;
import org.linlinjava.jz.db.domain.HmComment;
import org.linlinjava.jz.db.domain.HmCommentExample;
import org.linlinjava.jz.db.domain.HmEmployRelation;
import org.linlinjava.jz.db.dto.hm.HmCommentDto;
import org.linlinjava.jz.db.util.hm.HmCommentEnum;
import org.linlinjava.jz.db.util.hm.HmNoticeEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

import javax.annotation.Resource;

/**
 * @author fuxubing
 */
@Service
public class HmCommentService {
	@Resource
	private HmCommentMapper hmCommentMapper;



//	public HmComment queryByRId(Long rid) {
//		HmCommentExample example = new HmCommentExample();
//		example.or().andRIdEqualTo(rid);
//		return hmCommentMapper.selectOneByExample(example);
//	}
	public HmComment queryByRIdAndType(Long rid,int type) {
		HmCommentExample example = new HmCommentExample();
		example.or().andRIdEqualTo(rid).andRTypeEqualTo(type);
		return hmCommentMapper.selectOneByExample(example);
	}

	public void addComment(HmComment comment) {

		hmCommentMapper.insertSelective(comment);

	}

	public void addCommentDto(HmCommentDto dto) {
		HmComment comment = new HmComment();
		BeanUtils.copyProperties(dto, comment);


		hmCommentMapper.insertSelective(comment);

	}
}
