package com.huiju.estateagents.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huiju.estateagents.base.ResponseBean;
import com.huiju.estateagents.entity.HelpInitiateRecord;
import com.huiju.estateagents.entity.TaShareRecord;
import com.huiju.estateagents.mapper.HelpInitiateRecordMapper;
import com.huiju.estateagents.service.IHelpInitiateRecordService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 助力活动发起人员记录  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-10-17
 */
@Service
public class HelpInitiateRecordServiceImpl extends ServiceImpl<HelpInitiateRecordMapper, HelpInitiateRecord> implements IHelpInitiateRecordService {
	
	@Autowired
	private HelpInitiateRecordMapper helpInitiateRecordMapper;
	/**
	 * 分页获取我的助力数据
	 *
	 * @param pageNum
	 * @param pageSize
	 * @param orgId
	 * @param personId
	 * @return
	 */
	@Override
	public ResponseBean getInitiateRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId) {
		Page<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
		List<HelpInitiateRecord> helpInitiateRecordList = helpInitiateRecordMapper.getInitiateRecordList(pg,orgId,personId);
		pg.setRecords(helpInitiateRecordList);
		return ResponseBean.success(pg);
	}

	@Override
	public void updateHelpActivityProcessToEnd() {
		helpInitiateRecordMapper.updateHelpActivityProcessToEnd();
	}
}
