package com.ruoyi.ibs.tabs.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ibs.tabs.domain.entity.IbsLsdm;
import com.ruoyi.ibs.tabs.mapper.IbsLsdmMapper;
import com.ruoyi.ibs.tabs.service.IbsLsdmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IbsLsdmServiceImpl implements IbsLsdmService {

    @Autowired
    IbsLsdmMapper mapper;

    @Override
    public String getUrl(String viewName) {
        String dept = SecurityUtils.getDeptId().toString().substring(0,3)+"000";
        IbsLsdm ibsLsdm = mapper.selectOne(new LambdaQueryWrapper<IbsLsdm>().eq(IbsLsdm::getDeptId, dept).eq(IbsLsdm::getViewName, viewName));
        if (ibsLsdm != null)
            return ibsLsdm.getLsdmUrl();
        return "";
    }
}
