XiaoRuby
2023-08-30 b0b8ca4b383c5c3a2373200ca1872c20ee9ff999
user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RoleManagerServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.exception.AuthException;
import com.yuanchu.limslaboratory.mapper.MenuMapper;
import com.yuanchu.limslaboratory.mapper.RoleManageMapper;
import com.yuanchu.limslaboratory.pojo.Menu;
@@ -18,6 +19,7 @@
import com.yuanchu.limslaboratory.service.RoleManagerService;
import com.yuanchu.limslaboratory.utils.JsonUtil;
import com.yuanchu.limslaboratory.utils.MyUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -31,6 +33,7 @@
 * @Date 2023/8/23
 */
@Service
@Slf4j
public class RoleManagerServiceImpl implements RoleManagerService {
    @Resource
@@ -73,6 +76,9 @@
                    ,createTime
            ));
        });
        if(roleMenuList.size()<1){
            roleMenuList.add(new RoleMenu(null,nextId,39L,true,false,false,false,createTime));
        }
        //roleMenuAddList.forEach(System.out::println);
        int i = roleManageMapper.insertBatchRoleMenu(roleMenuList);
        return insert>0&&i>0;
@@ -147,6 +153,10 @@
    public Map<String, Object> getUrlType(String url) {
        String type=null;
        Map<String, Object> stringIntegerMap = roleManageMapper.selctInterFaceType(url);
        if(Objects.isNull(stringIntegerMap)){
            log.warn("没有====》"+url+"请求资源");
            throw new AuthException("403","没有该资源");
        }
        String of = String.valueOf(stringIntegerMap.get("type"));
        switch (of) {
            case "0":
@@ -165,7 +175,6 @@
                break;
        }
        stringIntegerMap.put("type",type);
        System.out.println(type);
        return stringIntegerMap;
    }