package org.springblade.modules.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.entity.CyryEntity;
import org.springblade.modules.entity.SydwEntity;
import org.springblade.modules.mapper.SydwMapper;
import org.springblade.modules.service.SydwService;
import org.springblade.modules.vo.DwdzVO;
import org.springblade.modules.vo.UserVO;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SydwServiceImpl extends ServiceImpl<SydwMapper, SydwEntity> implements SydwService {
	@Override
	public IPage<SydwEntity> selectSydwPage(IPage<SydwEntity> page, SydwEntity sydwEntity) {
		return baseMapper.selectSydwPage(page, sydwEntity);
	}

	@Override
	public SydwEntity sydwDetail(SydwEntity sydwEntity) {
		return baseMapper.sydwDetail(sydwEntity);
	}

	@Override
	public List<CyryEntity> selectCyryByDzbm(String tyshxydm) {
		List<CyryEntity> list = baseMapper.selectCyryByDzbm(tyshxydm);
		if (list.size() > 0) {
			for (CyryEntity cyry:list) {
				String dzbm = cyry.getXz();
				cyry.setXz(baseMapper.getFwxzByRkDzxx(dzbm));
			}
		}
		return list;
	}

	@Override
	public CyryEntity cyryDetail(CyryEntity cyryEntity) {
		return baseMapper.cyryDetail(cyryEntity);
	}

	@Override
	public List<DwdzVO> selectDwDz(String deptId) {
		return baseMapper.selectDwDz(deptId);
	}

	@Override
	public List<CyryEntity> selectCyrylsByDzbm(String tyshxydm) {
		List<CyryEntity> list = baseMapper.selectCyrylsByDzbm(tyshxydm);
		if (list.size() > 0) {
			for (CyryEntity cyry:list) {
				String dzbm = cyry.getXz();
				cyry.setXz(baseMapper.getFwxzByRkDzxx(dzbm));
			}
		}
		return list;
	}

	@Override
	public UserVO djxx(Long userId) {
		return baseMapper.djxx(userId);
	}

	@Override
	public List<SydwEntity> getMphxlhByLdphxlh(String ldphxlh) {
		return baseMapper.getMphxlhByLdphxlh(ldphxlh);
	}

	@Override
	public SydwEntity selectFwInfo(SydwEntity sydwEntity, String dzbm) {
		SydwEntity fw = baseMapper.selectFwInfo(sydwEntity, dzbm);
		return fw;
	}
}
