anderx 2 lat temu
rodzic
commit
274ae29bf7

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -80,7 +80,7 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
     }
 
     private void pushRoleType(ProjectListInput in) {
-        if (in.getRoleType()==null)in.getRoleType();
+        if (in.getRoleType()==null)in.setRoleType(0);
         if (in.getRoleType()==1)in.setRoleType(getRoleType());
     }
 
@@ -89,6 +89,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
             return 1;
         }else if (SecurityUtils.hashRoles(UserRolesType.INSPECTORS.getCode())){
             return 2;
+        }else if (SecurityUtils.hashRoles(UserRolesType.CEO.getCode())){
+            return 3;
         }else {
             return 0;
         }

+ 10 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -5,6 +5,8 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
+
+import com.ruoyi.common.enums.UserRolesType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
@@ -298,10 +300,14 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     @Override
     public Long selectCompanyByDeptId() {
-        SysDept sysDept = deptMapper.selectDeptById(SecurityUtils.getDeptId());
-        String[] split = sysDept.getAncestors().split(",");
-        if (split.length==2)return Long.valueOf(split[1]);
-        if (split.length>2)return Long.valueOf(split[2]);
+        if (SecurityUtils.hashRoles(UserRolesType.CEO.getCode())){
+            return SecurityUtils.getDeptId();
+        }else {
+            SysDept sysDept = deptMapper.selectDeptById(SecurityUtils.getDeptId());
+            String[] split = sysDept.getAncestors().split(",");
+            if (split.length==2)return Long.valueOf(split[1]);
+            if (split.length>2)return Long.valueOf(split[2]);
+        }
         return null;
     }
 

+ 3 - 2
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -39,7 +39,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName"  column="dept_name"   />
         <result property="ancestors" column="ancestors"   />
         <result property="orderNum"  column="order_num"   />
-        <result property="leader"    column="leader"      />
+		<result property="leader"    column="leader"      />
+		<result property="ancestors"    column="ancestors"      />
         <result property="status"    column="dept_status" />
     </resultMap>
 
@@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<sql id="selectUserVo">
         select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
-        d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
+        d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,d.ancestors,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from sys_user u
 		    left join sys_dept d on u.dept_id = d.dept_id