|
@ -2,16 +2,22 @@ package org.dromara.business.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
import cn.hutool.core.convert.Convert; |
|
|
import cn.hutool.core.convert.impl.MapConverter; |
|
|
import cn.hutool.core.convert.impl.MapConverter; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference; |
|
|
import org.dromara.business.domain.BusinessLayer; |
|
|
import org.dromara.business.domain.BusinessLayer; |
|
|
import org.dromara.business.domain.bo.BusinessLayerBo; |
|
|
import org.dromara.business.domain.bo.BusinessLayerBo; |
|
|
|
|
|
import org.dromara.business.domain.model.enums.LayerTypeEnum; |
|
|
import org.dromara.business.domain.vo.BusinessLayerVo; |
|
|
import org.dromara.business.domain.vo.BusinessLayerVo; |
|
|
import org.dromara.business.mapper.BusinessLayerMapper; |
|
|
import org.dromara.business.mapper.BusinessLayerMapper; |
|
|
import org.dromara.business.service.IBusinessLayerService; |
|
|
import org.dromara.business.service.IBusinessLayerService; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
|
|
|
import org.dromara.system.api.RemoteDeptService; |
|
|
|
|
|
import org.dromara.system.api.domain.vo.RemoteDeptVo; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -27,6 +33,9 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService { |
|
|
|
|
|
|
|
|
private final BusinessLayerMapper baseMapper; |
|
|
private final BusinessLayerMapper baseMapper; |
|
|
|
|
|
|
|
|
|
|
|
@DubboReference |
|
|
|
|
|
RemoteDeptService remoteDeptService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public TableDataInfo<BusinessLayerVo> queryPageList(BusinessLayerBo bo, PageQuery pageQuery) { |
|
|
public TableDataInfo<BusinessLayerVo> queryPageList(BusinessLayerBo bo, PageQuery pageQuery) { |
|
|
Page<BusinessLayerVo> result = baseMapper.queryPageList(pageQuery.build(), bo); |
|
|
Page<BusinessLayerVo> result = baseMapper.queryPageList(pageQuery.build(), bo); |
|
@ -45,13 +54,29 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService { |
|
|
@Override |
|
|
@Override |
|
|
public Boolean insert(BusinessLayerBo bo) { |
|
|
public Boolean insert(BusinessLayerBo bo) { |
|
|
BusinessLayer layerVo = Convert.convert( BusinessLayer.class,bo); |
|
|
BusinessLayer layerVo = Convert.convert( BusinessLayer.class,bo); |
|
|
|
|
|
|
|
|
|
|
|
RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(layerVo.getDeptId()); |
|
|
|
|
|
|
|
|
|
|
|
layerVo.setDeptName(remoteDeptVo.getDeptName()); |
|
|
|
|
|
|
|
|
return baseMapper.insert(layerVo)>0; |
|
|
return baseMapper.insert(layerVo)>0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean update(BusinessLayerBo bo) { |
|
|
public Boolean update(BusinessLayerBo bo) { |
|
|
BusinessLayer layerVo = Convert.convert( BusinessLayer.class,bo); |
|
|
|
|
|
return baseMapper.updateById(layerVo)>0; |
|
|
BusinessLayer businessLayer = baseMapper.selectById(bo.getId()); |
|
|
|
|
|
|
|
|
|
|
|
//判断是否修改部门
|
|
|
|
|
|
if (!businessLayer.getDeptId().equals(bo.getDeptId())) { |
|
|
|
|
|
RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(bo.getDeptId()); |
|
|
|
|
|
|
|
|
|
|
|
bo.setDeptName(remoteDeptVo.getDeptName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(bo,businessLayer); |
|
|
|
|
|
|
|
|
|
|
|
return baseMapper.updateById(businessLayer)>0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -61,7 +86,13 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<BusinessLayerVo> optionSelect() { |
|
|
public List<BusinessLayerVo> optionSelect() { |
|
|
return baseMapper.selectInfoByParent(0L); |
|
|
List<BusinessLayerVo> layerVoList = baseMapper.selectInfoByParent(0L); |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(layerVoList)){ |
|
|
|
|
|
return List.of(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return layerVoList.stream().filter(p-> p.getLayerType().equals(LayerTypeEnum.menu.getType())).toList(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|