package cn.com.ty.lift.ud.recruitmentInfos.service.impl;

import java.util.List;

import cn.com.ty.lift.ud.payment.mapper.entity.TyBillEntity;
import cn.com.ty.lift.ud.recruitmentInfos.controller.query.RecruitmentDeliveryQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.ty.lift.ud.recruitmentInfos.mapper.RecruitmentDeliveryMapper;
import cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentDeliveryEntity;
import cn.com.ty.lift.ud.recruitmentInfos.service.IRecruitmentDeliveryService;
import cn.com.xwy.boot.web.dto.RestResponse;

/**
 * 招聘投递信息 -ServiceImpl
 *
 * @author Xson
 * @date 2020-04-23
 */
@Service
@Transactional
public class RecruitmentDeliveryServiceImpl extends ServiceImpl<RecruitmentDeliveryMapper,RecruitmentDeliveryEntity>
    implements IRecruitmentDeliveryService {
	
	private @Autowired RecruitmentDeliveryMapper recruitmentDeliveryMapper;

	@Override
	public RestResponse selectByExample(RecruitmentDeliveryQuery query) {
		IPage page = query.page();
		List<TyBillEntity> list = recruitmentDeliveryMapper.selectByQuery(query.condition(), query);
		int total = recruitmentDeliveryMapper.countByQuery(query.condition());
		page.setRecords(list);
		page.setTotal(total);
		return RestResponse.success(page, "Queried successfully");
	}

	@Override
	public RestResponse finOneById(Long id) {
		RecruitmentDeliveryEntity invoice = recruitmentDeliveryMapper.finOneById(id);
		return RestResponse.success(invoice, "Queried successfully");
	}

	@Override
	public RecruitmentDeliveryEntity findByDataIdAndResumeId(Long id, Long userId) {
		return recruitmentDeliveryMapper.findByDataIdAndResumeId(id,userId);
	}


}
