Przeglądaj źródła

用户\项目模块修改

anderx 2 lat temu
rodzic
commit
6754c70992

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

@@ -355,7 +355,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                 // 验证是否存在
                 ProjectStaffRecord projectStaffRecord = projectStaffRecordMapper.selectByPrimaryKey(p.getId());
                 if (StringUtils.isNull(projectStaffRecord)){
-                    BeanValidators.validateWithException(validator, projectStaffRecord);
+//                    BeanValidators.validateWithException(validator, projectStaffRecord);
                     if (StringUtils.isNotBlank(p.getAdminName())){
                         SysUser sysUser = sysUserMapper.checkJobNumber(p.getJobNumber());
                         if (StringUtils.isNull(sysUser)){

+ 12 - 8
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -48,7 +48,9 @@ public class SysDeptServiceImpl implements ISysDeptService
     @DataScope(deptAlias = "d")
     public List<SysDept> selectDeptList(SysDept dept)
     {
-        dept.setAncestors(SecurityUtils.getDeptId().toString());
+        if (SecurityUtils.hashRoles(UserRolesType.CEO.getCode())){
+            dept.setAncestors(SecurityUtils.getDeptId().toString());
+        }
         return deptMapper.selectDeptList(dept);
     }
 
@@ -331,15 +333,17 @@ public class SysDeptServiceImpl implements ISysDeptService
         boolean flag = SecurityUtils.isSuperAdmin();
         if (flag){
             return deptMapper.getCompany();
-        }
-        SysDept dep=new SysDept();
-        SysDept dept = SecurityUtils.getLoginUser().getUser().getDept();
-        if (dept.getCompanyId()!=null){
-            dep.setDeptId(dept.getCompanyId());
         }else {
-            dep.setDeptId(dept.getDeptId());
+            SysDept dep=new SysDept();
+            SysDept dept = SecurityUtils.getLoginUser().getUser().getDept();
+            if (dept.getCompanyId()!=null){
+                dep.setDeptId(dept.getCompanyId());
+            }else {
+                dep.setDeptId(dept.getDeptId());
+            }
+            return deptMapper.selectDeptList(dep);
         }
-        return deptMapper.selectDeptList(dep);
+
     }
 
     /**

+ 11 - 11
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -21,40 +21,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateBy"   column="update_by"   />
 		<result property="updateTime" column="update_time" />
 		<result property="companyId" column="company_id" />
-		<result property="companyName" column="company_name" />
+		<result property="companyName" column="companyName" />
 		<result property="maxDuration" column="max_duration" />
 	</resultMap>
 
 	<sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
-               d.del_flag, d.create_by, d.create_time,d.company_id,d.company_name,d.max_duration
-        from sys_dept d
+               d.del_flag, d.create_by, d.create_time,d.company_id,d.company_name,d.max_duration,sd.dept_name companyName
+        from sys_dept d left join sys_dept sd on d.company_id = sd.dept_id
     </sql>
 
 	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
 		<if test="deptId != null and deptId != 0">
-			AND dept_id = #{deptId}
+			AND d.dept_id = #{deptId}
 		</if>
         <if test="parentId != null and parentId != 0">
-			AND parent_id = #{parentId}
+			AND d.parent_id = #{parentId}
 		</if>
 		<if test="deptName != null and deptName != ''">
-			AND dept_name like concat('%', #{deptName}, '%')
+			AND d.dept_name like concat('%', #{deptName}, '%')
 		</if>
 		<if test="status != null and status != ''">
-			AND status = #{status}
+			AND d.status = #{status}
 		</if>
 		<if test="companyName != null and companyName != ''">
-			AND company_name like concat('%', #{companyName}, '%')
+			AND d.company_name like concat('%', #{companyName}, '%')
 		</if>
 
 		<if test="startTime != null and endTime !=null">
-			AND create_time bentween #{startTime} and #{endTime}
+			AND d.create_time bentween #{startTime} and #{endTime}
 		</if>
 		<if test="ancestors !=null">
-			and (dept_id= #{ancestors} or find_in_set(#{ancestors},ancestors))
+			and (d.dept_id= #{ancestors} or find_in_set(#{ancestors},d.ancestors))
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}
@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	<select id="getCompany" resultMap="SysDeptResult">
 		<include refid="selectDeptVo"/>
-		 where parent_id = 100
+		 where d.parent_id = 100
 	</select>
 
 	<insert id="insertDept" parameterType="SysDept">