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

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.mdjfpj.entity.PjEntity;
import org.springblade.modules.mdjfry.entity.MdjfRyEntity;
import org.springblade.modules.mdjfry.excel.MdjfRyExcel;
import org.springblade.modules.mdjfry.mapper.MdjfRyMapper;
import org.springblade.modules.mdjfry.service.IMdjfRyService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 纠纷人员登记表 服务实现类
 *
 * @author BladeX
 * @since 2023-08-02
 */
@Service
public class MdjfRyServiceImpl extends BaseServiceImpl<MdjfRyMapper, MdjfRyEntity> implements IMdjfRyService {

	@Override
	public IPage<MdjfRyEntity> selectmdjfRyPage(IPage<MdjfRyEntity> page, MdjfRyEntity mdjfry) {
		return page.setRecords(baseMapper.selectmdjfRyPage(page, mdjfry));
	}


	@Override
	public List<MdjfRyExcel> exportmdjfRy(Wrapper<MdjfRyEntity> queryWrapper) {
		List<MdjfRyExcel> mdjfryList = baseMapper.exportmdjfRy(queryWrapper);
		//mdjfryList.forEach(mdjfry -> {
		//	mdjfry.setTypeName(DictCache.getValue(DictEnum.YES_NO, mdjfRy.getType()));
		//});
		return mdjfryList;
	}

	@Override
	public List<MdjfRyEntity> getRyByMdId(Long id) {
		return baseMapper.getRyByMdId(id);
	}

	@Override
	public void updateLkry(String ryids) {
		baseMapper.updateLkry(ryids);
	}

	@Override
	public void updateAllQmzp(Map<String, String> qmzpMap) {
		baseMapper.updateAllQmzp(qmzpMap);
	}

	public void updateAllHfzp(Map<String, String> hfzpMap) {
		baseMapper.updateAllHfzp(hfzpMap);
	}

	public void updateAllRyzp(Map<String, String> ryzpMap) {
		baseMapper.updateAllRyzp(ryzpMap);
	}

	@Override
	public void updateAllPj(PjEntity pjEntity) {
		baseMapper.updateAllPj(pjEntity);
	}

	@Override
	public List<MdjfRyEntity> getRyByMdIdJl(Long mdid) {
		return baseMapper.getRyByMdIdJl(mdid);
	}

	@Override
	public void saveJl(MdjfRyEntity mdjfRy) {
		baseMapper.saveJl(mdjfRy);
	}

	@Override
	public void updateAllQmzpJl(Map<String, String> qmzpMap) {
		baseMapper.updateAllQmzpJl(qmzpMap);
	}

	@Override
	public void updateAllRyzpJl(Map<String, String> ryzpMap) {
		baseMapper.updateAllRyzpJl(ryzpMap);
	}

	@DS("jl")
	@Override
	public void updateByIdToJl(MdjfRyEntity mdjfRy) {
		baseMapper.updateById(mdjfRy);
	}

	@DS("jl")
	@Override
	public void saveBatchToJl(List<MdjfRyEntity> mdjfRyList) {
		for (MdjfRyEntity mdjfRyEntity : mdjfRyList) {
			baseMapper.insert(mdjfRyEntity);
		}
	}

	@Override
	public void updateAllHfzpJl(Map<String, String> hfzpMap) {
		baseMapper.updateAllHfzpJl(hfzpMap);
	}
}
