ly vor 3 Jahren
Ursprung
Commit
8b7867c615

+ 17 - 4
master/src/main/java/com/ruoyi/project/system/controller/TAlarmPrincipalController.java

@@ -5,6 +5,8 @@ import java.util.List;
 
 import com.ruoyi.project.plant.domain.TStaffmgr;
 import com.ruoyi.project.plant.service.ITStaffmgrService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -39,16 +41,25 @@ public class TAlarmPrincipalController extends BaseController
 
     @Autowired
     private ITStaffmgrService tStaffmgrService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询预警管理负责人列表
      */
-    @PreAuthorize("@ss.hasPermi('system:principal:list')")
     @GetMapping("/list")
     public TableDataInfo list(TAlarmPrincipal tAlarmPrincipal)
     {
         startPage();
         List<TAlarmPrincipal> list = tAlarmPrincipalService.selectTAlarmPrincipalList(tAlarmPrincipal);
+        for (TAlarmPrincipal t: list
+             ) {
+            SysUser user = sysUserService.selectUserByStaffId(t.getStaffid());
+            if (user != null) {
+                t.setPrincipalName(user.getNickName());
+                t.setPrincipalEmail(user.getEmail());
+            }
+        }
         return getDataTable(list);
     }
 
@@ -103,9 +114,11 @@ public class TAlarmPrincipalController extends BaseController
         tAlarmPrincipal.setUpdaterCode(getUserId().toString());
         tAlarmPrincipal.setUpdatedate(new Date());
         //人员信息对应
-        TStaffmgr staffmgr = tStaffmgrService.selectTStaffmgrByStaffId(tAlarmPrincipal.getStaffid());
-        tAlarmPrincipal.setPrincipalName(staffmgr.getName());
-        tAlarmPrincipal.setPrincipalEmail(staffmgr.getMail());
+        SysUser user = sysUserService.selectUserByStaffId(tAlarmPrincipal.getStaffid());
+        if (user!=null) {
+            tAlarmPrincipal.setPrincipalName(user.getNickName());
+            tAlarmPrincipal.setPrincipalEmail(user.getEmail());
+        }
         return toAjax(tAlarmPrincipalService.updateTAlarmPrincipal(tAlarmPrincipal));
     }
 

+ 9 - 0
master/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java

@@ -47,6 +47,13 @@ public interface SysUserMapper
      */
     public SysUser selectUserById(Long userId);
 
+    /**
+     * 通过staffid查询用户
+     *
+     * @param staffid 用户ID
+     * @return 用户对象信息
+     */
+    SysUser selectUserByStaffId(String staffid);
     /**
      * 新增用户信息
      *
@@ -131,4 +138,6 @@ public interface SysUserMapper
      * @return 装置维修经理信息
      */
     SysUser selectSafeManagerUserByPlantCode(String plantCode);
+
+
 }

+ 10 - 0
master/src/main/java/com/ruoyi/project/system/service/ISysUserService.java

@@ -53,6 +53,14 @@ public interface ISysUserService
      */
     public SysUser selectUserById(Long userId);
 
+    /**
+     * 通过staffid查询用户
+     *
+     * @param staffid 用户ID
+     * @return 用户对象信息
+     */
+    SysUser selectUserByStaffId(String staffid);
+
     /**
      * 根据用户ID查询用户所属角色组
      *
@@ -194,4 +202,6 @@ public interface ISysUserService
      * @return 装置维修经理信息
      */
     SysUser selectSafeManagerUserByPlantCode(String plantCode);
+
+
 }

+ 11 - 0
master/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java

@@ -108,6 +108,17 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.selectUserById(userId);
     }
 
+    /**
+     * 通过staffid查询用户
+     *
+     * @param staffid 用户ID
+     * @return 用户对象信息
+     */
+    @Override
+    public SysUser selectUserByStaffId(String staffid) {
+        return userMapper.selectUserByStaffId(staffid);
+    }
+
     /**
      * 查询用户所属角色组
      *

+ 6 - 0
master/src/main/resources/mybatis/system/SysUserMapper.xml

@@ -158,6 +158,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		where u.user_id = #{userId}
 	</select>
 
+	<select id="selectUserByStaffId" parameterType="String" resultMap="SysUserResult">
+		<include refid="selectUserVo"/>
+
+		where u.staffid = #{staffid}
+	</select>
+
 	<select id="checkUserNameUnique" parameterType="String" resultType="int">
 		select count(1) from sys_user where user_name = #{userName} and rownum <![CDATA[ <= ]]> 1
 	</select>