/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.mdjfhf.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.mdjfhf.entity.HfEntity;
import org.springblade.modules.mdjfhf.vo.HfVO;
import org.springblade.modules.mdjfhf.excel.HfExcel;
import org.springblade.modules.mdjfhf.mapper.HfMapper;
import org.springblade.modules.mdjfhf.service.IHfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;

import java.util.Date;
import java.util.List;

/**
 * 矛盾纠纷-回访 服务实现类
 *
 * @author BladeX
 * @since 2023-11-17
 */
@Service
public class HfServiceImpl extends BaseServiceImpl<HfMapper, HfEntity> implements IHfService {

	@Override
	public IPage<HfVO> selectHfPage(IPage<HfVO> page, HfVO hf) {
		return page.setRecords(baseMapper.selectHfPage(page, hf));
	}


	@Override
	public List<HfExcel> exportHf(Wrapper<HfEntity> queryWrapper) {
		List<HfExcel> hfList = baseMapper.exportHf(queryWrapper);
		//hfList.forEach(hf -> {
		//	hf.setTypeName(DictCache.getValue(DictEnum.YES_NO, Hf.getType()));
		//});
		return hfList;
	}

	@Override
	public List<HfEntity> getCountsHfcsByMdId(Long jfId, Date jzsj) {
		return baseMapper.getCountsHfcsByMdId(jfId,jzsj);
	}

	@Override
	public Integer getYhfcsByMdIdAndHfjzsj(Long jfId, Date jzsj) {
		return baseMapper.getCountHfcsByMdId(jfId,jzsj);
	}

	@Override
	public Integer getCountHfcsByMdIdBYTime2(Long jfId, Date hfjzsj, Date hfjzsj2) {
		return  baseMapper.getCountHfcsByMdIdBYTime2(jfId, hfjzsj, hfjzsj2);
	}

	@Override
	public Integer getCountHfcsByMdIdBYTime3(Long jfId, Date hfjzsj2, Date hfjzsj3) {
		return baseMapper.getCountHfcsByMdIdBYTime3(jfId, hfjzsj2, hfjzsj3);
	}
	@Override
	public Integer getCountHfcsByMdIdBYTime4(Long jfId, Date hfjzsj3) {
		return baseMapper.getCountHfcsByMdIdBYTime4(jfId, hfjzsj3);
	}

	@DS("jl")
	@Override
	public void saveJl(HfEntity hf) {
		baseMapper.insert(hf);
	}

}
