wangliang 1 жил өмнө
parent
commit
894d9b499e

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBSopInfoMapper.java

@@ -100,9 +100,10 @@ public interface TBSopInfoMapper extends BaseMapper<TBSopInfo> {
      *
      * @param serviceId
      * @param userId
+     * @param roleType
      * @return
      */
-    List<SopInfoResult> findFlowByServiceId(@Param("serviceId") Long serviceId, @Param("userId") Long userId);
+    List<SopInfoResult> findFlowByServiceId(@Param("serviceId") Long serviceId, @Param("userId") Long userId, @Param("roleType") String roleType);
 
     List<SysUser> userList(@Param("id") Long id);
 }

+ 13 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -1036,6 +1036,18 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     public List<SopInfoResult> findFlowByServiceId(Long serviceId, Long userId) {
         Optional.ofNullable(serviceId).orElseThrow(() -> ExceptionResultEnum.SERVICE_ID_NO_DATA.exception());
         Optional.ofNullable(serviceId).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("用户id不能为空"));
-        return this.baseMapper.findFlowByServiceId(serviceId, userId);
+        List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(userId);
+        RoleTypeEnum roleTypeEnum = null;
+        if (!CollectionUtils.isEmpty(sysRoleList)) {
+            for (SysRole sysRole : sysRoleList) {
+                if (sysRole.getType() == RoleTypeEnum.EFFECT_ENGINEER) {
+                    roleTypeEnum = sysRole.getType();
+                    break;
+                } else if (sysRole.getType() == RoleTypeEnum.ASSISTANT_ENGINEER) {
+                    roleTypeEnum = sysRole.getType();
+                }
+            }
+        }
+        return this.baseMapper.findFlowByServiceId(serviceId, userId, Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
     }
 }

+ 9 - 2
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -206,12 +206,19 @@
         left join sys_custom sc on sc.id = tbsi.custom_id
         <where>
             <if test="userId != null and userId != ''">
-                and (tbsid.engineer_user_id is not null and tbsid.engineer_user_id = #{userId})
+                <choose>
+                    <when test="roleType != null roleType != '' and roleType == 'EFFECT_ENGINEER'">
+                        and (tbsid.engineer_user_id is not null and tbsid.engineer_user_id = #{userId})
+                    </when>
+                    <otherwise>
+                        and (tbsid.assistant_engineer_user_ids is not null and FIND_IN_SET(#{userId},tbsid.assistant_engineer_user_ids))
+                    </otherwise>
+                </choose>
             </if>
             <if test="serviceId != null and serviceId != ''">
                 and tbsi.service_id = #{serviceId}
             </if>
-<!--                and tbsi.status = 'START'-->
+                and tbsi.status = 'START'
         </where>
     </select>