package org.springblade.modules.sqjw.sydw.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.sqjw.sydw.mapper.SydwMapper;
import org.springblade.modules.sqjw.sydw.pojo.entity.CyryEntity;
import org.springblade.modules.sqjw.sydw.pojo.entity.SydwEntity;
import org.springblade.modules.sqjw.sydw.pojo.vo.DwdzVO;
import org.springblade.modules.sqjw.sydw.pojo.vo.UserVO;
import org.springblade.modules.sqjw.sydw.service.SydwService;
import org.springframework.stereotype.Service;

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

@Service
public class SydwServiceImpl extends BaseServiceImpl<SydwMapper, SydwEntity> implements SydwService {
	@Override
	public IPage<SydwEntity> selectSydwPage(IPage<SydwEntity> page, Map<String, Object> params) {
		return baseMapper.selectSydwPage(page, params);
	}

	@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, String dzbm) {
		return baseMapper.selectDwDz(deptId, dzbm);
	}

	@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;
	}

	@Override
	public Long selectParentIdByDeptId(String deptId) {
		return baseMapper.selectParentIdByDeptId(deptId);
	}

	@Override
	public SydwEntity selectSydwByDzbm(String dzbm) {
		return baseMapper.selectSydwByDzbm(dzbm);
	}

	@Override
	public void updateSydwzx(SydwEntity sydw, Long userId) {
		baseMapper.updateSydwzx(sydw, userId);
	}

	@Override
	public void updateCyryzx(SydwEntity sydw, Long userId) {
		baseMapper.updateCyryzx(sydw, userId);
	}

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

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