Sfoglia il codice sorgente

批量修改用户允许修改角色

anderx 2 anni fa
parent
commit
222a094b7a

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/mapper/ProjectTaskMapper.java

@@ -32,7 +32,7 @@ public interface ProjectTaskMapper {
 
     void updateDuration(Long pid);
 
-    ProjectTask selectByProjectNumber(String projectNumber);
+    ProjectTask selectByProjectNumber(@Param("projectNumber") String projectNumber, @Param("companyId") Long companyId);
 
     void updateAdminNameByAid(SysUser user);
 }

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

@@ -450,7 +450,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                         throw new ServiceException(String.format("新增必须知道打卡人"));
                     }
                     if (StringUtils.isBlank(p.getProjectNumber())){
-                        ProjectTask projectTask = projectTaskMapper.selectByProjectNumber(p.getProjectNumber());
+                        ProjectTask projectTask = projectTaskMapper.selectByProjectNumber(p.getProjectNumber(),companyId);
                         if (StringUtils.isNull(projectTask)){
                             throw new ServiceException(String.format("项目[%s]不存在",p.getProjectName()));
                         }

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

@@ -136,10 +136,12 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
                     throw new ServiceException("创建年份不能为空");
                 }
                 // 验证是否存在这个用户
-                ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(p.getId());
+                ProjectTask projectTask = projectTaskMapper.selectByProjectNumber(p.getProjectNumber(),company);
                 if (StringUtils.isNull(projectTask)){
                     BeanValidators.validateWithException(validator, p);
-
+                    if (checkProjectNumber(p)){
+                        throw new ServiceException(String.format("项目编号[%s]已存在", p.getProjectNumber()));
+                    }
                     if(StringUtils.isNotBlank(p.getAdminName())) {
                         SysUser sysUser = userMapper.selectByNikeName(p.getAdminName(),company);
                         if (sysUser == null) {
@@ -234,7 +236,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
 
     @Override
     public boolean checkProjectNumber(ProjectTask projectTask) {
-        ProjectTask projectTask1 = projectTaskMapper.selectByProjectNumber(projectTask.getProjectNumber());
+        Long companyId = deptService.selectCompanyByDeptId();
+        ProjectTask projectTask1 = projectTaskMapper.selectByProjectNumber(projectTask.getProjectNumber(),companyId);
         if (projectTask.getId()==null){
             if (projectTask1!=null){
                 return true;

+ 8 - 2
ruoyi-system/src/main/resources/mapper/project/ProjectTaskMapper.xml

@@ -291,7 +291,13 @@
   </select>
   <select id="selectByProjectNumber" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    FROM project_task where project_number= #{projectNumber}
+    a.id, a.aid, a.`name`, a.project_status, a.create_time, a.remark, a.admin_name, a.staff_name, a.project_number,
+    a.project_year, a.create_year, a.cross_year, a.duration, a.start_time, a.end_time
+    FROM project_task a  left join sys_user  b on a.aid=b.user_id
+    left join sys_dept d on b.dept_id=d.dept_id
+    where project_number= #{projectNumber}
+    <if test="companyId !=null">
+      and (d.dept_id= #{companyId} or find_in_set(#{companyId},d.ancestors))
+    </if>
     </select>
 </mapper>