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

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springblade.modules.rhzf.ryJwrk.entity.RyJwrkEntity;
import org.springblade.modules.rhzf.ryJwrk.vo.RyJwrkVO;
import org.springblade.modules.rhzf.ryJwrk.excel.RyJwrkExcel;
import org.springblade.modules.rhzf.ryJwrk.mapper.RyJwrkMapper;
import org.springblade.modules.rhzf.ryJwrk.service.IRyJwrkService;
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;

/**
 * 入户走访_人员_境外人口 服务实现类
 *
 * @author BladeX
 * @since 2023-11-14
 */
@Service
public class RyJwrkServiceImpl extends BaseServiceImpl<RyJwrkMapper, RyJwrkEntity> implements IRyJwrkService {

	@Autowired
	private RyJwrkJlServiceImpl ryJwrkJlService;

	@Override
	public IPage<RyJwrkVO> selectRyJwrkPage(IPage<RyJwrkVO> page, RyJwrkVO ryJwrk) {
		return page.setRecords(baseMapper.selectRyJwrkPage(page, ryJwrk));
	}


	@Override
	public List<RyJwrkExcel> exportRyJwrk(Wrapper<RyJwrkEntity> queryWrapper) {
		List<RyJwrkExcel> ryJwrkList = baseMapper.exportRyJwrk(queryWrapper);
		//ryJwrkList.forEach(ryJwrk -> {
		//	ryJwrk.setTypeName(DictCache.getValue(DictEnum.YES_NO, RyJwrk.getType()));
		//});
		return ryJwrkList;
	}

	@Override
	public boolean updateRy(RyJwrkEntity ryJwrkEntity) {
		return baseMapper.updateRy(ryJwrkEntity);
	}

	@Override
	public void jwrkZx(RyJwrkEntity ryJwrkEntity) {
		baseMapper.jwrkZx(ryJwrkEntity);
	}

	@DS("jl")
	@Override
	public void saveToJl(RyJwrkEntity jwrkEntity) {
		ryJwrkJlService.save(jwrkEntity);
	}

	@DS("jl")
	@Override
	public void updateByIdToJl(RyJwrkEntity jwrkEntity) {
		ryJwrkJlService.updateById(jwrkEntity);
	}

	@DS("jl")
	@Override
	public void jwrkZxToJl(RyJwrkEntity jwrkEntity) {
		baseMapper.jwrkZx(jwrkEntity);
	}
}
