|
@@ -1,5 +1,6 @@
|
|
|
package cn.hnthyy.thmz.controller.mz;
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.R;
|
|
|
import cn.hnthyy.thmz.Utils.TokenUtil;
|
|
|
import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
import cn.hnthyy.thmz.entity.thmz.Menu;
|
|
@@ -12,6 +13,7 @@ import cn.hnthyy.thmz.service.thmz.*;
|
|
|
import cn.hnthyy.thmz.vo.RoleMenuRelationVo;
|
|
|
import cn.hnthyy.thmz.vo.RoleMenuVo;
|
|
|
import cn.hnthyy.thmz.vo.RoleVo;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -75,6 +77,25 @@ public class RoleController {
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @description:检查是否为医生角色
|
|
|
+ * @author: lihong
|
|
|
+ * @date: 2023/8/23 16:18
|
|
|
+ * @return: cn.hnthyy.thmz.Utils.R
|
|
|
+ **/
|
|
|
+ @UserLoginToken
|
|
|
+ @GetMapping("/checkDoctorRoleByUser")
|
|
|
+ public R checkDoctorRoleByUser(){
|
|
|
+ User user = TokenUtil.getUser();
|
|
|
+ List<UserRoleRelation> userRoleRelations = userRoleRelationService.queryByUserId(user.getId());
|
|
|
+ if(CollUtil.isNotEmpty(userRoleRelations)){
|
|
|
+ //10 为 门诊医生角色id
|
|
|
+ if (userRoleRelations.stream().anyMatch(o -> o.getRoleId() != null && o.getRoleId() == 10)) {
|
|
|
+ return R.ok().put("data",true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok().put("data", false);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 根据主键查询角色
|