Explorar el Código

深时编辑器 中 在线合并数据集

lyhzzz hace 2 años
padre
commit
04c9fb9b95

+ 10 - 1
src/main/java/com/fdkankan/ucenter/service/impl/CameraServiceImpl.java

@@ -152,10 +152,19 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         return map;
     }
 
+    @Autowired
+    IUserRoleService userRoleService;
+
     @Override
     public PageInfo pageList(CameraParam param) {
         User user = userService.getByUserName(param.getUserName());
-        param.setUserId(user.getId());
+        Set<Long> roleIds = userRoleService.getByUser(user);
+        if(!roleIds.contains(5L) && !roleIds.contains(6L)){
+            param.setUserId(user.getId());
+        }
+        if(roleIds.contains(6L)){
+            param.setCompanyId(user.getCompanyId());
+        }
         Page<CameraVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
         List<Long> cameraIdList = page.getRecords().parallelStream().map(CameraVo::getId).collect(Collectors.toList());
         HashMap<Long,GroupByCount> sceneNumMap = new HashMap<>();      //场景数量,最后拍摄时间

+ 2 - 0
src/main/java/com/fdkankan/ucenter/vo/request/CameraParam.java

@@ -10,4 +10,6 @@ public class CameraParam extends RequestBase {
     private Integer selecttype;     // 1,查询协作者,2查询相机
     private String userName;
     private Long userId;
+
+    private Long companyId;
 }

+ 3 - 0
src/main/resources/mapper/ucenter/CameraMapper.xml

@@ -25,6 +25,9 @@
         <if test="param.cameraType!=null and param.cameraType >= 9">
             and d.type = #{param.cameraType}
         </if>
+        <if test="param.companyId!=null">
+            and d.company_id = #{param.companyId}
+        </if>
         order by c.activated_time desc
     </select>
     <select id="getCameraInfo" resultType="com.fdkankan.ucenter.vo.response.CameraAppVo">