/*
 *      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.rhzf.fwFz.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springblade.modules.rhzf.fwFz.entity.FwFzEntity;
import org.springblade.modules.rhzf.fwFz.vo.FwFzVO;
import org.springblade.modules.rhzf.fwFz.excel.FwFzExcel;
import org.springblade.modules.rhzf.fwFz.mapper.FwFzMapper;
import org.springblade.modules.rhzf.fwFz.service.IFwFzService;
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.List;
import java.util.Map;

/**
 * 入户走访_房屋_房主 服务实现类
 *
 * @author BladeX
 * @since 2023-12-15
 */
@Service
public class FwFzServiceImpl extends BaseServiceImpl<FwFzMapper, FwFzEntity> implements IFwFzService {

	@Autowired
	private FwFzJlServiceImpl fwFzJlService;

	@Override
	public IPage<FwFzVO> selectFwFzPage(IPage<FwFzVO> page, FwFzVO fwFz) {
		return page.setRecords(baseMapper.selectFwFzPage(page, fwFz));
	}


	@Override
	public List<FwFzExcel> exportFwFz(Wrapper<FwFzEntity> queryWrapper) {
		List<FwFzExcel> fwFzList = baseMapper.exportFwFz(queryWrapper);
		//fwFzList.forEach(fwFz -> {
		//	fwFz.setTypeName(DictCache.getValue(DictEnum.YES_NO, FwFz.getType()));
		//});
		return fwFzList;
	}

	@Override
	public FwFzEntity getFzList(Map<String, Object> params) {
		return baseMapper.getFzList(params);
	}

	@Override
	public FwFzEntity getFzById(Long id) {
		return baseMapper.getFzById(id);
	}

	@Override
	public void updateFzByFwId(FwFzEntity fzInfo) {
		baseMapper.updateFzByFwId(fzInfo);
	}

	@DS("jl")
	@Override
	public void saveToJl(FwFzEntity fzInfo) {
		fwFzJlService.save(fzInfo);
	}

	@DS("jl")
	@Override
	public void updateFzByFwIdToJl(FwFzEntity fzInfo) {
		baseMapper.updateFzByFwId(fzInfo);
	}
}
