Browse Source

bug优化

admin 2 years ago
parent
commit
d6ef8389e2

+ 3 - 0
src/main/java/com/yx/face/dao/FaceDeviceDao.java

@@ -2,6 +2,7 @@ package com.yx.face.dao;
 
 import com.yx.face.boot.component.tk.TKMapper;
 import com.yx.face.model.entity.FaceDevice;
+import com.yx.face.model.vo.AdminVO;
 import com.yx.face.model.vo.FaceDeviceVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -57,5 +58,7 @@ public interface FaceDeviceDao extends TKMapper<FaceDevice> {
 
     List<FaceDevice> getByAdminAndType(@Param("adminId")Integer adminId);
 
+    List<String> getByAminVo(@Param("adminVo")AdminVO info);
+
 }
 

+ 4 - 1
src/main/java/com/yx/face/service/impl/UserWhitelistServiceImpl.java

@@ -346,7 +346,10 @@ public class UserWhitelistServiceImpl implements UserWhitelistService {
         } else {
             one.setAvatar(avatar);
         }
-        List<String> faceDeviceOne = faceDeviceDao.selectList(one.getAdminId());
+        //查询超管旗下所有设备
+        AdminVO info = adminService.getInfo();
+        //List<String> faceDeviceOne = faceDeviceDao.selectList(one.getAdminId());
+        List<String> faceDeviceOne = faceDeviceDao.getByAminVo(info);
         if (faceDeviceOne.isEmpty()) {
             //objectRestResult.setCode(401);
             //objectRestResult.setMsg("设备不在线常客名单全量失败");

+ 21 - 8
src/main/resources/mapper/FaceDeviceDao.xml

@@ -3,15 +3,15 @@
 <mapper namespace="com.yx.face.dao.FaceDeviceDao">
     <update id="update">
         UPDATE face_device
-        SET type = #{type},
-        admin_id_of_staff_entrance = #{adminId}
+        SET type                       = #{type},
+            admin_id_of_staff_entrance = #{adminId}
         WHERE sn = #{sn}
     </update>
 
     <update id="updateStatus">
         UPDATE face_device
-        SET type = #{type},
-            state = 0,
+        SET type                       = #{type},
+            state                      = 0,
             admin_id_of_staff_entrance = #{adminId}
         WHERE sn = #{sn}
     </update>
@@ -117,6 +117,18 @@
         </if>
     </select>
 
+    <select id="getByAminVo" resultType="java.lang.String">
+
+        SELECT sn
+        FROM face_device fd
+        left join admin a on a.id = fd.admin_id
+        WHERE fd.enable = 1
+          AND fd.online = 1
+          AND fd.auth = 1
+          and a.province_id = #{adminVo.provinceId}
+          and a.type in (3,4, 5)
+    </select>
+
     <select id="getFaceDeviceBySn" resultType="com.yx.face.model.entity.FaceDevice">
         SELECT *
         FROM face_device
@@ -211,9 +223,11 @@
         </where>
     </select>
     <select id="selectTypeFaceDev" resultType="com.yx.face.model.entity.FaceDevice">
-        SELECT sn ,id
+        SELECT sn, id
         FROM face_device
-        WHERE enable = 1 and  online = 1 and  auth = 1
+        WHERE enable = 1
+          and online = 1
+          and auth = 1
           AND type = #{type}
     </select>
     <select id="getBySnList" resultType="com.yx.face.model.vo.FaceDeviceVO">
@@ -244,5 +258,4 @@
             AND admin_id = #{adminId}
         </if>
     </select>
-</mapper>
-
+</mapper>