Pārlūkot izejas kodu

Merge branch 'dev' of http://192.168.1.43:3000/v2/zd-parents into dev

chaiyunlong 2 gadi atpakaļ
vecāks
revīzija
495ef91e25
15 mainītis faili ar 504 papildinājumiem un 243 dzēšanām
  1. 8 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteLaboratoryService.java
  2. 5 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteLaboratoryFallbackFactory.java
  3. 20 3
      zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpBottleStorageMapper.xml
  4. 20 3
      zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpBottleStorageOutMapper.xml
  5. 55 31
      zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpTaskMapper.xml
  6. 9 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSparseHardwareController.java
  7. 7 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSparseHardwareMapper.java
  8. 3 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/service/OneMachineService.java
  9. 7 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabSparseHardwareService.java
  10. 9 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineServiceImpl.java
  11. 7 7
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java
  12. 6 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSparseHardwareServiceImpl.java
  13. 6 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSparseHardwareMapper.xml
  14. 329 187
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml
  15. 13 5
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabWhiteJoinSublistMapper.xml

+ 8 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteLaboratoryService.java

@@ -372,6 +372,14 @@ public interface RemoteLaboratoryService {
     public R<Object> getSpeakerBySub(@PathVariable("floorId") Long floorId, @PathVariable("subId") Long subId);
     public R<Object> getSpeakerBySub(@PathVariable("floorId") Long floorId, @PathVariable("subId") Long subId);
 
 
     /**
     /**
+     * 获取喇叭总数
+     * @Return com.zd.model.domain.R<java.lang.Object>
+     **/
+    @ApiOperation(value = "获取喇叭总数")
+    @GetMapping("/sparseHardware/selectSpeakerCount")
+    R<Object> selectSpeakerCount();
+
+    /**
      * 定时任务分级管控工作过期记录 - 并排列下次工作计划
      * 定时任务分级管控工作过期记录 - 并排列下次工作计划
      */
      */
     @ApiOperation(value = "定时任务分级管控工作过期记录 - 并排列下次工作计划")
     @ApiOperation(value = "定时任务分级管控工作过期记录 - 并排列下次工作计划")

+ 5 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteLaboratoryFallbackFactory.java

@@ -346,6 +346,11 @@ public class RemoteLaboratoryFallbackFactory implements FallbackFactory<RemoteLa
             }
             }
 
 
             @Override
             @Override
+            public R<Object> selectSpeakerCount() {
+                throw new RuntimeException("获取喇叭总数失败!" + cause.getMessage());
+            }
+
+            @Override
             public void workArrange() {
             public void workArrange() {
                 throw new RuntimeException("定时任务分级管控工作过期记录 - 并排列下次工作计划失败:" + cause.getMessage());
                 throw new RuntimeException("定时任务分级管控工作过期记录 - 并排列下次工作计划失败:" + cause.getMessage());
             }
             }

+ 20 - 3
zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpBottleStorageMapper.xml

@@ -470,11 +470,28 @@
     <select id="selectQpBottleStorageByRelationSubject" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageVO"
     <select id="selectQpBottleStorageByRelationSubject" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageVO"
             resultMap="QpBottleStorageResult">
             resultMap="QpBottleStorageResult">
         select t.id,t.task_id,t.task_detail_id, t.create_time,
         select t.id,t.task_id,t.task_detail_id, t.create_time,
-        (select d.dept_class_name from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=t.location_id)
+        (select f.name
+        from lab_build_floor f
+        where f.type = 1
+        and f.id = (
+        select f.parent_id
+        from lab_build_floor f
+        where f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t.location_id)))
         campus,
         campus,
-        (select d.dept_name building from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=t.location_id)
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t.location_id))
         building,
         building,
-        (select l.room room from lab_subject s,lab_subject_layout l where s.layout_id =l.id and s.id=t.location_id) room
+        (select bfl.room_num
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t.location_id) room
         from (
         from (
         select bs.*,ta.location_id from qp_bottle_storage bs, qp_task ta,qp_task_detail td
         select bs.*,ta.location_id from qp_bottle_storage bs, qp_task ta,qp_task_detail td
         where bs.task_id = ta.id and bs.task_detail_id = td.id
         where bs.task_id = ta.id and bs.task_detail_id = td.id

+ 20 - 3
zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpBottleStorageOutMapper.xml

@@ -164,9 +164,26 @@
     <!-- 回收单 实验室关联查询-->
     <!-- 回收单 实验室关联查询-->
     <select id="selectQpBottleStorageOutRelationSubject" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageOutVO" resultMap="QpBottleStorageOutResult">
     <select id="selectQpBottleStorageOutRelationSubject" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageOutVO" resultMap="QpBottleStorageOutResult">
         select t2.id,t2.storage_id,t2.task_id, t2.create_time,taskDetailId,
         select t2.id,t2.storage_id,t2.task_id, t2.create_time,taskDetailId,
-               (select d.dept_class_name  from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=t2.location_id) campus,
-               (select d.dept_name building from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=t2.location_id) building,
-               (select l.room room from lab_subject s,lab_subject_layout l where s.layout_id =l.id and  s.id=t2.location_id) room
+        (select f.name
+        from lab_build_floor f
+        where f.type = 1
+        and f.id = (
+        select f.parent_id
+        from lab_build_floor f
+        where f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t2.location_id))) campus,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t2.location_id)) building,
+        (select bfl.room_num
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t2.location_id) room
         from (
         from (
                  select *, (select ta.location_id from qp_task ta where ta.id=t.task_id ) location_id from (
                  select *, (select ta.location_id from qp_task ta where ta.id=t.task_id ) location_id from (
                    select * from (
                    select * from (

+ 55 - 31
zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpTaskMapper.xml

@@ -44,42 +44,49 @@
                t.dept_name,
                t.dept_name,
                t.type,
                t.type,
                t.create_time,
                t.create_time,
-               (select d.dept_class_name
-                from lab_subject s,
-                     sys_dept d
-                where s.build_id = d.dept_id
-                  and s.id = t.location_id)                                                              campus,/**校区**/
-               (select d.dept_name building
-                from lab_subject s,
-                     sys_dept d
-                where s.build_id = d.dept_id
-                  and s.id = t.location_id)                                                              building,/**楼栋*/
-               (select l.room room
-                from lab_subject s,
-                     lab_subject_layout l
-                where s.layout_id = l.id
-                  and s.id = t.location_id)                                                              room,/*房间号**/
+               (select f.name
+                from lab_build_floor f
+                where f.type = 1
+                  and f.id = (
+                    select f.parent_id
+                    from lab_build_floor f
+                    where f.id =
+                          (select bfl.build_id
+                           from lab_build_floor_layout bfl
+                           where bfl.sub_id = t.location_id)))                               campus,/**校区**/
+               (select f.`name`
+                from lab_build_floor f
+                where f.type = 2
+                  and f.id =
+                      (select bfl.build_id
+                       from lab_build_floor_layout bfl
+                       where bfl.sub_id = t.location_id))                                    building,/**楼栋*/
+               (select bfl.room_num
+                from lab_build_floor_layout bfl
+                where bfl.sub_id = t.location_id)                                            room,/*房间号**/
                (select COALESCE(sum(bottle_number), 0)
                (select COALESCE(sum(bottle_number), 0)
                 from qp_task_detail d
                 from qp_task_detail d
-                where d.task_id = t.id)                                                                  applyNum, /**申请总数**/
+                where d.task_id = t.id)                                                      applyNum, /**申请总数**/
                (select count(1)
                (select count(1)
                 from qp_bottle_storage st
                 from qp_bottle_storage st
                 where st.task_id = t.id
                 where st.task_id = t.id
-                  and st.air_status = 0)                                                                 storageNum, /** 入库总数 **/
+                  and st.air_status = 0)                                                     storageNum, /** 入库总数 **/
                (select count(1)
                (select count(1)
                 from qp_bottle_storage st
                 from qp_bottle_storage st
                 where st.task_id = t.id
                 where st.task_id = t.id
-                  and st.air_status = 1)                                                                 refuseNum, /** 拒收总数 **/
+                  and st.air_status = 1)                                                     refuseNum, /** 拒收总数 **/
                (select COALESCE(sum(bottle_number), 0)
                (select COALESCE(sum(bottle_number), 0)
                 from qp_task_detail td
                 from qp_task_detail td
-                where td.task_id = t.id and qp_status = 0)                                               wpsNum,/** 未派送总数 **/
+                where td.task_id = t.id
+                  and qp_status = 0)                                                         wpsNum,/** 未派送总数 **/
                ((select ifnull((SELECT sum(td.bottle_number)
                ((select ifnull((SELECT sum(td.bottle_number)
-                        FROM qp_task_detail td
-                         WHERE td.task_id = t.id
-                         AND qp_status = 1),0) from dual) - (select  count(1) from qp_bottle_storage where task_id=t.id))    drkNum /** 待入库总数 **/
+                                FROM qp_task_detail td
+                                WHERE td.task_id = t.id
+                                  AND qp_status = 1), 0)
+                 from dual) - (select count(1) from qp_bottle_storage where task_id = t.id)) drkNum /** 待入库总数 **/
         from qp_task as t
         from qp_task as t
-        LEFT JOIN   sys_dept d on   t.dept_id=d.dept_id
-        LEFT JOIN sys_user u on  t.user_id=u.user_id
+                 LEFT JOIN sys_dept d on t.dept_id = d.dept_id
+                 LEFT JOIN sys_user u on t.user_id = u.user_id
     </sql>
     </sql>
     <select id="selectQpTaskList" parameterType="com.zd.airbottle.domain.vo.QpTaskVO" resultMap="QpTaskResult">
     <select id="selectQpTaskList" parameterType="com.zd.airbottle.domain.vo.QpTaskVO" resultMap="QpTaskResult">
         <include refid="selectQpTaskListVo"/>
         <include refid="selectQpTaskListVo"/>
@@ -107,7 +114,7 @@
                 AND DATE_FORMAT(t.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
                 AND DATE_FORMAT(t.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
             </if>
             </if>
             <if test="ids !=null">
             <if test="ids !=null">
-                AND  t.id in
+                AND t.id in
                 <foreach item="id" collection="ids" open="(" separator="," close=")">
                 <foreach item="id" collection="ids" open="(" separator="," close=")">
                     #{id}
                     #{id}
                 </foreach>
                 </foreach>
@@ -206,7 +213,7 @@
                    qp_task_detail td
                    qp_task_detail td
               where bso.storage_id = bs.id
               where bso.storage_id = bs.id
                 and bs.task_detail_id = td.id
                 and bs.task_detail_id = td.id
-                and bso.out_status=0
+                and bso.out_status = 0
                 and td.supplier_id = #{companyId}
                 and td.supplier_id = #{companyId}
               GROUP BY date_format(bso.create_time, '%Y-%m-%d')) t
               GROUP BY date_format(bso.create_time, '%Y-%m-%d')) t
         GROUP BY t.create_time
         GROUP BY t.create_time
@@ -265,11 +272,28 @@
             resultMap="QpTaskResult">
             resultMap="QpTaskResult">
         select
         select
         ta.id,ta.create_time,
         ta.id,ta.create_time,
-        (select d.dept_class_name from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=ta.location_id)
+        (select f.name
+        from lab_build_floor f
+        where f.type = 1
+        and f.id = (
+        select f.parent_id
+        from lab_build_floor f
+        where f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = ta.location_id)))
         campus,
         campus,
-        (select d.dept_name building from lab_subject s,sys_dept d where s.build_id=d.dept_id and s.id=ta.location_id)
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = ta.location_id))
         building,
         building,
-        (select l.room room from lab_subject s,lab_subject_layout l where s.layout_id =l.id and s.id=ta.location_id)
+        (select bfl.room_num
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = ta.location_id)
         room
         room
         from qp_task ta where 1=1
         from qp_task ta where 1=1
         <if test="id != null">and ta.id = #{id}</if>
         <if test="id != null">and ta.id = #{id}</if>
@@ -282,7 +306,7 @@
         <if test="isDispose != null">and (ta.id in (select td.task_id from qp_task_detail td where
         <if test="isDispose != null">and (ta.id in (select td.task_id from qp_task_detail td where
             td.is_dispose=#{isDispose}
             td.is_dispose=#{isDispose}
             <if test="companyId != null">
             <if test="companyId != null">
-                 and td.supplier_id=#{companyId}) )
+                and td.supplier_id=#{companyId}) )
             </if>
             </if>
         </if>
         </if>
     </select>
     </select>
@@ -298,7 +322,7 @@
         left join qp_task_detail td on td.task_id=ta.id
         left join qp_task_detail td on td.task_id=ta.id
         left JOIN qp_use_record ur on ur.storage_id=bs.id
         left JOIN qp_use_record ur on ur.storage_id=bs.id
         where bs.air_status=0 and (bs.storage_status=1 or bs.storage_status=2 )
         where bs.air_status=0 and (bs.storage_status=1 or bs.storage_status=2 )
-        <if test="companyId != null">td.supplier_id=#{companyId} </if>
+        <if test="companyId != null">td.supplier_id=#{companyId}</if>
         <if test="userId != null">and ta.user_id=#{userId}</if>
         <if test="userId != null">and ta.user_id=#{userId}</if>
         GROUP BY ta.location,ta.location_id
         GROUP BY ta.location,ta.location_id
     </select>
     </select>

+ 9 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSparseHardwareController.java

@@ -132,4 +132,13 @@ public class LabSparseHardwareController extends BaseController {
     public ResultData remove(@PathVariable Long[] ids) {
     public ResultData remove(@PathVariable Long[] ids) {
         return ResultData.result(labSparseHardwareService.deleteLabSparseHardwareByIds(ids));
         return ResultData.result(labSparseHardwareService.deleteLabSparseHardwareByIds(ids));
     }
     }
+    /**
+     * 查询疏散硬件列表
+     */
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_SPARSEHARDWARE + PerFun.LIST)
+    @GetMapping("/selectSpeakerCount")
+    @ApiOperation(value = "查询喇叭总数")
+    public ResultData selectSpeakerCount() {
+        return ResultData.success(labSparseHardwareService.selectSpeakerCount());
+    }
 }
 }

+ 7 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSparseHardwareMapper.java

@@ -88,4 +88,11 @@ public interface LabSparseHardwareMapper
      * @return
      * @return
      */
      */
     List<String> selectCameraByFloorId(Long floorId);
     List<String> selectCameraByFloorId(Long floorId);
+
+    /**
+     * 查询喇叭总数
+     * @Param []
+     * @Return java.lang.Integer
+     **/
+    Integer selectSpeakerCount();
 }
 }

+ 3 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/service/OneMachineService.java

@@ -45,6 +45,7 @@ import javax.annotation.PostConstruct;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 一体机服务
  * 一体机服务
@@ -137,7 +138,7 @@ public class OneMachineService implements ValidationSignInPerInfo {
             //1、判断是否有安全准入资格,如没有准入资格进行提示(语音+浮层):验证失败,您需要通过小程序申请实验室准入资格后才能签到。
             //1、判断是否有安全准入资格,如没有准入资格进行提示(语音+浮层):验证失败,您需要通过小程序申请实验室准入资格后才能签到。
             if(UserConstants.USER_TYPE_STUDENT.equals(signInPerInfoVO.getSingInUser().getType())){
             if(UserConstants.USER_TYPE_STUDENT.equals(signInPerInfoVO.getSingInUser().getType())){
                 if (signInPerInfoVO.getSingInUser().getExpirationDate() != null) {
                 if (signInPerInfoVO.getSingInUser().getExpirationDate() != null) {
-                    if (!signInPerInfoVO.getSingInUser().getExpirationDate().after(DateUtils.getNowDate())) {
+                    if(signInPerInfoVO.getSingInUser().getExpirationDate().getTime() < DateUtils.dateTime(DateUtils.YYYY_MM_DD,DateUtils.getDate()).getTime()){
                         messages.add("您准入凭证已过期!您需要通过小程序重新申请实验室准入资格后才能签到。");
                         messages.add("您准入凭证已过期!您需要通过小程序重新申请实验室准入资格后才能签到。");
                     }
                     }
                 } else {
                 } else {
@@ -162,6 +163,7 @@ public class OneMachineService implements ValidationSignInPerInfo {
                     if (listapply.size()==0) {
                     if (listapply.size()==0) {
                         messages.add("您未获取准入凭证!您需要通过小程序申请实验室准入资格后才能签到。");
                         messages.add("您未获取准入凭证!您需要通过小程序申请实验室准入资格后才能签到。");
                     }
                     }
+                     listapply.stream().filter(a->a.getAuditStatus()==2).collect(Collectors.toList());
                 }
                 }
             }else if("11".equals(signInPerInfoVO.getSingInUser().getType())){
             }else if("11".equals(signInPerInfoVO.getSingInUser().getType())){
 
 

+ 7 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabSparseHardwareService.java

@@ -74,4 +74,11 @@ public interface ILabSparseHardwareService
      * @return
      * @return
      */
      */
     List<Map<String,Object>> selectSpeakerByFloorId(Long floorId, Long subId);
     List<Map<String,Object>> selectSpeakerByFloorId(Long floorId, Long subId);
+
+    /**
+     * 查询所有喇叭的数量
+     * @Param []
+     * @Return java.lang.Integer
+     **/
+    Integer selectSpeakerCount();
 }
 }

+ 9 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineServiceImpl.java

@@ -18,6 +18,7 @@ import com.zd.laboratory.domain.vo.*;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
 import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
 import com.zd.laboratory.service.ILabExitLineService;
 import com.zd.laboratory.service.ILabExitLineService;
+import com.zd.laboratory.service.ILabSparseHardwareService;
 import com.zd.laboratory.socket.command.Symbol;
 import com.zd.laboratory.socket.command.Symbol;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.CacheConstants;
@@ -64,7 +65,8 @@ public class LabExitLineServiceImpl implements ILabExitLineService
     private LabAudioSynthesisMapper labAudioSynthesisMapper;
     private LabAudioSynthesisMapper labAudioSynthesisMapper;
     @Autowired
     @Autowired
     private RemoteSpeakService remoteSpeakService;
     private RemoteSpeakService remoteSpeakService;
-
+    @Autowired
+    private ILabSparseHardwareService labSparseHardwareService;
     /**
     /**
      * 查询逃生线路主
      * 查询逃生线路主
      *
      *
@@ -367,7 +369,9 @@ public class LabExitLineServiceImpl implements ILabExitLineService
             List<LabAudioSynthesis> audioSynList = labAudioSynthesisMapper.selectLabAudioSynthesisList(audioSyn);
             List<LabAudioSynthesis> audioSynList = labAudioSynthesisMapper.selectLabAudioSynthesisList(audioSyn);
             if(audioSynList.size()>0){
             if(audioSynList.size()>0){
                 LabAudioSynthesis audioSyntheses = audioSynList.get(0);
                 LabAudioSynthesis audioSyntheses = audioSynList.get(0);
-                R deviceList = remoteSpeakService.getDeviceList(1,100,5L);
+                Integer count = labSparseHardwareService.selectSpeakerCount();
+                logger.info("查询喇叭总数:{}",count);
+                R deviceList = remoteSpeakService.getDeviceList(1,count + 10,5L);
                 if(deviceList.getCode()==200){
                 if(deviceList.getCode()==200){
                     List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
                     List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
                     List<PlayVo> playVoList = new ArrayList<>();
                     List<PlayVo> playVoList = new ArrayList<>();
@@ -521,7 +525,9 @@ public class LabExitLineServiceImpl implements ILabExitLineService
                 if(audioSynList.size()>0){
                 if(audioSynList.size()>0){
                     LabAudioSynthesis audioSyntheses = audioSynList.get(0);
                     LabAudioSynthesis audioSyntheses = audioSynList.get(0);
                     //获取喇叭列表
                     //获取喇叭列表
-                    R deviceList = remoteSpeakService.getDeviceList(1,100, 5L);
+                    Integer count = labSparseHardwareService.selectSpeakerCount();
+                    logger.info("查询喇叭总数:{}",count);
+                    R deviceList = remoteSpeakService.getDeviceList(1,count + 10, 5L);
                     if(deviceList.getCode()==200){
                     if(deviceList.getCode()==200){
                         List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
                         List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
 
 

+ 7 - 7
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java

@@ -1,16 +1,10 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
 import cn.hutool.core.date.StopWatch;
 import cn.hutool.core.date.StopWatch;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.TypeReference;
-import com.alibaba.fastjson.parser.Feature;
-import com.alibaba.nacos.shaded.org.checkerframework.checker.nullness.Opt;
 import com.zd.algorithm.api.speaker.entity.ParamVo;
 import com.zd.algorithm.api.speaker.entity.ParamVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
 import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
 import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
-import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
@@ -20,6 +14,7 @@ import com.zd.laboratory.domain.*;
 import com.zd.laboratory.domain.vo.*;
 import com.zd.laboratory.domain.vo.*;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.service.ILabExitLineVertexService;
 import com.zd.laboratory.service.ILabExitLineVertexService;
+import com.zd.laboratory.service.ILabSparseHardwareService;
 import com.zd.laboratory.socket.command.Symbol;
 import com.zd.laboratory.socket.command.Symbol;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
@@ -78,6 +73,9 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
     @Autowired
     @Autowired
     private LabHardwareStateMapper labHardwareStateMapper;
     private LabHardwareStateMapper labHardwareStateMapper;
 
 
+    @Autowired
+    private ILabSparseHardwareService labSparseHardwareService;
+
 
 
     private static final Logger log = LoggerFactory.getLogger(LabExitLineVertexServiceImpl.class);
     private static final Logger log = LoggerFactory.getLogger(LabExitLineVertexServiceImpl.class);
 
 
@@ -377,7 +375,9 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
             List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
             List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
             if(audioSyntheses.size()>0){
             if(audioSyntheses.size()>0){
                 //预案调用喇叭
                 //预案调用喇叭
-                R deviceList = remoteSpeakService.getDeviceList(1,100,labExitLineEvacuationVo.getFloorId());
+                Integer count = labSparseHardwareService.selectSpeakerCount();
+                log.info("查询喇叭总数:{}",count);
+                R deviceList = remoteSpeakService.getDeviceList(1,count + 10,labExitLineEvacuationVo.getFloorId());
                 if(deviceList.getCode()==200){
                 if(deviceList.getCode()==200){
                     List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
                     List<Map<String,Object>> mapList = (List <Map <String, Object>>) deviceList.getData();
                     for(Map<String,Object> map:mapList){
                     for(Map<String,Object> map:mapList){

+ 6 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSparseHardwareServiceImpl.java

@@ -1,12 +1,10 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
-import com.zd.model.domain.per.PerPrefix;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
+import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.StringUtils;
-import com.zd.common.core.annotation.DataScope;
-import com.zd.common.core.utils.SaveUtil;
 import com.zd.laboratory.domain.LabSparseHardware;
 import com.zd.laboratory.domain.LabSparseHardware;
 import com.zd.laboratory.mapper.LabSparseHardwareMapper;
 import com.zd.laboratory.mapper.LabSparseHardwareMapper;
 import com.zd.laboratory.service.ILabSparseHardwareService;
 import com.zd.laboratory.service.ILabSparseHardwareService;
@@ -117,4 +115,9 @@ public class LabSparseHardwareServiceImpl implements ILabSparseHardwareService {
     public List<Map<String,Object>> selectSpeakerByFloorId(Long floorId, Long subId) {
     public List<Map<String,Object>> selectSpeakerByFloorId(Long floorId, Long subId) {
         return labSparseHardwareMapper.selectListByFloorId(floorId, subId,2);
         return labSparseHardwareMapper.selectListByFloorId(floorId, subId,2);
     }
     }
+
+    @Override
+    public Integer selectSpeakerCount() {
+        return labSparseHardwareMapper.selectSpeakerCount();
+    }
 }
 }

+ 6 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSparseHardwareMapper.xml

@@ -222,4 +222,10 @@
             #{id}
             #{id}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+    <select id="selectSpeakerCount" resultType="java.lang.Integer">
+        select count(*)
+        from lab_sparse_hardware
+        where type = 2
+    </select>
 </mapper>
 </mapper>

+ 329 - 187
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml

@@ -117,38 +117,78 @@
     </resultMap>
     </resultMap>
 
 
     <sql id="selectLabSubjectVo">
     <sql id="selectLabSubjectVo">
-        select
-            id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
-            (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
-            admin_id, is_del, create_time, user_id,
-            create_by, update_time, update_by, remark, sub_dept,
-            check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
-            outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
-        (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur
-        WHERE ur.`user_id`
-        IN (
-        SELECT
-        SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
-        FROM
-        mysql.help_topic b
-        WHERE
-        b.help_topic_id &lt; (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
-        )
-        ) safeUserNames,
-            (select d.dept_name from sys_dept d where s.build_id = d.dept_id) build_name,
-            (select b.name from lab_building b where b.id = s.floor_id) floorName,
-            (SELECT l.room FROM lab_subject_layout l WHERE l.id = s.layout_id ) roomName,
-        (SELECT GROUP_CONCAT(phonenumber) FROM sys_user ur
-        WHERE ur.`user_id`
-        IN (
-        SELECT
-        SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
-        FROM
-        mysql.help_topic b
-        WHERE
-        b.help_topic_id &lt; (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
-        )
-        ) safeUserPhone
+        select id,
+               name,
+               floor_id,
+               layout_id,
+               build_id,
+               sub_dept,
+               level,
+               check_out,
+               check_in,
+               room,
+               dept_id,
+               (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
+               admin_id,
+               is_del,
+               create_time,
+               user_id,
+               create_by,
+               update_time,
+               update_by,
+               remark,
+               sub_dept,
+               check_out,
+               check_in,
+               safe_user_id,
+               safe_signs,
+               hazard_category,
+               risk_measure,
+               outfire,
+               qr_code,
+               safe_user_id,
+               skipped,
+               check_count,
+               sign_time,
+               (SELECT GROUP_CONCAT(ur.nick_name)
+                FROM sys_user ur
+                WHERE ur.`user_id`
+                          IN (
+                          SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id, ',', b.help_topic_id + 1), ',',
+                                                 -1) result
+                          FROM mysql.help_topic b
+                          WHERE b.help_topic_id &lt;
+                                (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
+                      )
+               )                                                                safeUserNames,
+               (select f.`name`
+                from lab_build_floor f
+                where f.type = 2
+                  and f.id =
+                      (select bfl.build_id
+                       from lab_build_floor_layout bfl
+                       where bfl.sub_id = s.id))                                build_name,
+               (select f.`name`
+                from lab_build_floor f
+                where f.type = 3
+                  and f.id =
+                      (select bfl.floor_id
+                       from lab_build_floor_layout bfl
+                       where bfl.sub_id = s.id))                                floorName,
+               (select bfl.room_num
+                from lab_build_floor_layout bfl
+                where bfl.sub_id = s.id)                                        roomName,
+               (SELECT GROUP_CONCAT(phonenumber)
+                FROM sys_user ur
+                WHERE ur.`user_id`
+                          IN (
+                          SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id, ',', b.help_topic_id + 1), ',',
+                                                 -1) result
+                          FROM mysql.help_topic b
+                          WHERE b.help_topic_id &lt;
+                                (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
+                      )
+               )                                                                safeUserPhone
         from lab_subject s
         from lab_subject s
     </sql>
     </sql>
     <sql id="selectLabSubjectListVo">
     <sql id="selectLabSubjectListVo">
@@ -157,7 +197,7 @@
                bfl.floor_id,
                bfl.floor_id,
                lb.room,
                lb.room,
                t.dept_id,
                t.dept_id,
-               IFNULL(su.user_id,-1) admin_id,
+               IFNULL(su.user_id, -1)                                                     admin_id,
                t.is_del,
                t.is_del,
                t.create_time,
                t.create_time,
                t.user_id,
                t.user_id,
@@ -165,37 +205,43 @@
                t.update_time,
                t.update_time,
                t.update_by,
                t.update_by,
                t.sub_dept,
                t.sub_dept,
-               bfl.id layout_id,
+               bfl.id                                                                     layout_id,
                t.build_id,
                t.build_id,
                t.remark,
                t.remark,
                t.level,
                t.level,
                t.diy_order,
                t.diy_order,
-               cf.classified_name levelName,
-               cf.classified_color fiedColor,
+               cf.classified_name                                                         levelName,
+               cf.classified_color                                                        fiedColor,
                t.type_id,
                t.type_id,
                (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
                (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
                t.mold_id,
                t.mold_id,
-               (select lm.mold_name from lab_mold lm where t.mold_id = lm.id) as moldName,
-               t.check_out, t.check_in, t.safe_user_id, t.safe_signs, t.hazard_category, t.risk_measure,
-               t.outfire, t.qr_code,
-               su.nick_name as admin_name,
-               su.phonenumber as adminPhone,
-               sd.dept_name as dept_name,
+               (select lm.mold_name from lab_mold lm where t.mold_id = lm.id) as          moldName,
+               t.check_out,
+               t.check_in,
+               t.safe_user_id,
+               t.safe_signs,
+               t.hazard_category,
+               t.risk_measure,
+               t.outfire,
+               t.qr_code,
+               su.nick_name                                                   as          admin_name,
+               su.phonenumber                                                 as          adminPhone,
+               sd.dept_name                                                   as          dept_name,
                t.skipped,
                t.skipped,
                t.check_count,
                t.check_count,
                t.sign_time,
                t.sign_time,
-               CONCAT(su.nick_name,'@',su.phonenumber) AS adminNameAndPhone,
+               CONCAT(su.nick_name, '@', su.phonenumber)                      AS          adminNameAndPhone,
 
 
-               (select d.dept_name from sys_dept d where t.build_id = d.dept_id) buildName,
-               (select b.name from lab_building b where b.id = t.floor_id) floorName,
-               (SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
+               (select d.dept_name from sys_dept d where t.build_id = d.dept_id)          buildName,
+               (select b.name from lab_building b where b.id = t.floor_id)                floorName,
+               (SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id)         roomName
 
 
         from lab_subject t
         from lab_subject t
-        left  join  sys_user su on su.user_id = t.admin_id  AND su.`del_flag`=0
-        left  join  sys_dept sd on sd.dept_id = t.dept_id
-        left  join  lab_subject_layout lb on lb.id = t.layout_id
-        left join lab_safe_classified cf on cf.id = t.level
-        LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
+                 left join sys_user su on su.user_id = t.admin_id AND su.`del_flag` = 0
+                 left join sys_dept sd on sd.dept_id = t.dept_id
+                 left join lab_subject_layout lb on lb.id = t.layout_id
+                 left join lab_safe_classified cf on cf.id = t.level
+                 LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
     </sql>
     </sql>
     <sql id="selectLabSubjectListVoIFPhone">
     <sql id="selectLabSubjectListVoIFPhone">
         select t.id,
         select t.id,
@@ -211,28 +257,34 @@
                t.update_time,
                t.update_time,
                t.update_by,
                t.update_by,
                t.sub_dept,
                t.sub_dept,
-               bfl.id layout_id,
+               bfl.id                                                                           layout_id,
                t.build_id,
                t.build_id,
                t.check_out,
                t.check_out,
                t.check_in,
                t.check_in,
                t.remark,
                t.remark,
                t.sub_dept,
                t.sub_dept,
                t.level,
                t.level,
-                t.skipped,
-                t.check_count,
-              (SELECT cf.classified_name FROM lab_safe_classified cf WHERE cf.id = t.`level`) levelName,
-              (SELECT cf.classified_color FROM lab_safe_classified cf WHERE cf.id = t.`level`) fiedColor,
-              t.type_id,
-              (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
-               t.check_out, t.check_in, t.safe_user_id, t.safe_signs, t.hazard_category, t.risk_measure,
-               t.outfire, t.qr_code,
-               su.nick_name as admin_name,
-               su.phonenumber as adminPhone,
-               sd.dept_name as dept_name
+               t.skipped,
+               t.check_count,
+               (SELECT cf.classified_name FROM lab_safe_classified cf WHERE cf.id = t.`level`)  levelName,
+               (SELECT cf.classified_color FROM lab_safe_classified cf WHERE cf.id = t.`level`) fiedColor,
+               t.type_id,
+               (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`)       typeName,
+               t.check_out,
+               t.check_in,
+               t.safe_user_id,
+               t.safe_signs,
+               t.hazard_category,
+               t.risk_measure,
+               t.outfire,
+               t.qr_code,
+               su.nick_name   as                                                                admin_name,
+               su.phonenumber as                                                                adminPhone,
+               sd.dept_name   as                                                                dept_name
         from lab_subject t
         from lab_subject t
-                 left  join  sys_user su on su.user_id = t.admin_id
-                 left  join  sys_dept sd on sd.dept_id = t.dept_id
-                 left  join  lab_subject_layout lb on lb.id = t.layout_id
+                 left join sys_user su on su.user_id = t.admin_id
+                 left join sys_dept sd on sd.dept_id = t.dept_id
+                 left join lab_subject_layout lb on lb.id = t.layout_id
                  LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
                  LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
     </sql>
     </sql>
     <select id="selectLabSubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
     <select id="selectLabSubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
@@ -252,77 +304,91 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="selectLabSubjectListSecurity" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
+    <select id="selectLabSubjectListSecurity" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResult">
         <include refid="selectLabSubjectVo"/>
         <include refid="selectLabSubjectVo"/>
         <where>
         <where>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="floorId != null "> and floor_id = #{floorId}</if>
-            <if test="room != null  and room != ''"> and room = #{room}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
-            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
-            <if test="adminId != null "> and admin_id = #{adminId}</if>
-            <if test="isDel != null "> and is_del = #{isDel}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="floorId != null ">and floor_id = #{floorId}</if>
+            <if test="room != null  and room != ''">and room = #{room}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="deptName != null  and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="adminId != null ">and admin_id = #{adminId}</if>
+            <if test="isDel != null ">and is_del = #{isDel}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
         </where>
         </where>
     </select>
     </select>
 
 
 
 
     <select id="queryUserNameBySafeUserByOnepc" parameterType="string" resultType="string">
     <select id="queryUserNameBySafeUserByOnepc" parameterType="string" resultType="string">
-        SELECT GROUP_CONCAT(CONCAT(nick_name,' ',phonenumber) SEPARATOR '、') safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
+        SELECT GROUP_CONCAT(CONCAT(nick_name, ' ', phonenumber) SEPARATOR '、') safeUserName
+        FROM sys_user
+        WHERE FIND_IN_SET(user_id, #{safeUserId})
     </select>
     </select>
 
 
     <select id="queryUserNameBySafeUserInfo" parameterType="string" resultType="string">
     <select id="queryUserNameBySafeUserInfo" parameterType="string" resultType="string">
-        SELECT GROUP_CONCAT(CONCAT(nick_name,'@',phonenumber)) safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
+        SELECT GROUP_CONCAT(CONCAT(nick_name, '@', phonenumber)) safeUserName
+        FROM sys_user
+        WHERE FIND_IN_SET(user_id, #{safeUserId})
     </select>
     </select>
 
 
     <select id="queryUserNameBySafeUserId" parameterType="string" resultType="string">
     <select id="queryUserNameBySafeUserId" parameterType="string" resultType="string">
-        SELECT GROUP_CONCAT(nick_name) safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
+        SELECT GROUP_CONCAT(nick_name) safeUserName
+        FROM sys_user
+        WHERE FIND_IN_SET(user_id, #{safeUserId})
     </select>
     </select>
 
 
     <select id="queryUserPhoneBySafeUserId" parameterType="string" resultType="string">
     <select id="queryUserPhoneBySafeUserId" parameterType="string" resultType="string">
-        SELECT GROUP_CONCAT(phonenumber) safeUserPhone FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
+        SELECT GROUP_CONCAT(phonenumber) safeUserPhone
+        FROM sys_user
+        WHERE FIND_IN_SET(user_id, #{safeUserId})
     </select>
     </select>
 
 
-    <select id="selectLabSubjectListByadminidNotnull" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
+    <select id="selectLabSubjectListByadminidNotnull" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResult">
         <include refid="selectLabSubjectVo"/>
         <include refid="selectLabSubjectVo"/>
-            where admin_id != -1
+        where admin_id != -1
         <if test="deptIds != null and deptIds.size()>0"> <!-- 部门集合id-->
         <if test="deptIds != null and deptIds.size()>0"> <!-- 部门集合id-->
             and s.dept_id in
             and s.dept_id in
             <foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
             <foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
         </if>
         </if>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="floorId != null "> and floor_id = #{floorId}</if>
-            <if test="room != null  and room != ''"> and room = #{room}</if>
-            <if test="deptId != null "> and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or dept_id = #{deptId} )</if>
-            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
-            <if test="adminId != null "> and admin_id = #{adminId}</if>
-            <if test="isDel != null "> and is_del = #{isDel}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
+        <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+        <if test="floorId != null ">and floor_id = #{floorId}</if>
+        <if test="room != null  and room != ''">and room = #{room}</if>
+        <if test="deptId != null ">and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId}
+            ,ancestors )) or dept_id = #{deptId} )
+        </if>
+        <if test="deptName != null  and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
+        <if test="adminId != null ">and admin_id = #{adminId}</if>
+        <if test="isDel != null ">and is_del = #{isDel}</if>
+        <if test="userId != null ">and user_id = #{userId}</if>
 
 
     </select>
     </select>
 
 
-    <select id="selectLabSubjectVOList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
+    <select id="selectLabSubjectVOList" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResultVO">
         <include refid="selectLabSubjectListVo"/>
         <include refid="selectLabSubjectListVo"/>
         <where>
         <where>
-            <if test="name != null  and name != ''"> and t.name like concat('%', #{name}, '%')</if>
-            <if test="adminName != null  and adminName != ''"> and su.nick_name like concat('%', #{adminName}, '%')</if>
-
-            <if test="buildId != null "> and t.build_id = #{buildId}</if>
-            <if test="deptId != null "> and t.dept_id = #{deptId}</if>
-            <if test="id != null "> and t.id = #{id}</if>
-            <if test="subIds != null and subIds != ''"> and find_in_set(t.id, #{subIds})</if>
-
-            <if test="adminId != null "> and t.admin_id = #{adminId}</if>
-            <if test="level != null "> and t.level = #{level}</if>
-            <if test="typeId != null "> and t.type_id = #{typeId}</if>
-            <if test="subDept != null and subDept != ''"> and t.sub_dept = #{subDept}</if>
+            <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>
+            <if test="adminName != null  and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>
+
+            <if test="buildId != null ">and t.build_id = #{buildId}</if>
+            <if test="deptId != null ">and t.dept_id = #{deptId}</if>
+            <if test="id != null ">and t.id = #{id}</if>
+            <if test="subIds != null and subIds != ''">and find_in_set(t.id, #{subIds})</if>
+
+            <if test="adminId != null ">and t.admin_id = #{adminId}</if>
+            <if test="level != null ">and t.level = #{level}</if>
+            <if test="typeId != null ">and t.type_id = #{typeId}</if>
+            <if test="subDept != null and subDept != ''">and t.sub_dept = #{subDept}</if>
             <!-- 数据范围过滤 -->
             <!-- 数据范围过滤 -->
             ${params.dataScope}
             ${params.dataScope}
         </where>
         </where>
         order by t.diy_order desc , t.create_time desc
         order by t.diy_order desc , t.create_time desc
     </select>
     </select>
 
 
-    <select id="selectLabSubjectVOListByPc" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
+    <select id="selectLabSubjectVOListByPc" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResultVO">
         select t.id,
         select t.id,
         t.name,
         t.name,
         t.floor_id,
         t.floor_id,
@@ -362,31 +428,31 @@
         (SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
         (SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
 
 
         from lab_subject t
         from lab_subject t
-        left  join  sys_user su on su.user_id = t.admin_id  AND su.`del_flag`=0
-        left  join  sys_dept sd on sd.dept_id = t.dept_id
-        left  join  lab_subject_layout lb on lb.id = t.layout_id
+        left join sys_user su on su.user_id = t.admin_id AND su.`del_flag`=0
+        left join sys_dept sd on sd.dept_id = t.dept_id
+        left join lab_subject_layout lb on lb.id = t.layout_id
         left join lab_safe_classified cf on cf.id = t.level
         left join lab_safe_classified cf on cf.id = t.level
         <where>
         <where>
-            <if test="name != null  and name != ''"> and t.name like concat('%', #{name}, '%')</if>
-            <if test="adminName != null  and adminName != ''"> and su.nick_name like concat('%', #{adminName}, '%')</if>
-
-            <if test="buildId != null "> and t.build_id = #{buildId}</if>
-            <if test="deptId != null "> and t.dept_id = #{deptId}</if>
-            <if test="id != null "> and t.id = #{id}</if>
-            <if test="subIds != null and subIds != ''"> and find_in_set(t.id, #{subIds})</if>
-
-            <if test="adminId != null "> and t.admin_id = #{adminId}</if>
-            <if test="level != null "> and t.level = #{level}</if>
-            <if test="typeId != null "> and t.type_id = #{typeId}</if>
-            <if test="subDept != null and subDept != ''"> and t.sub_dept = #{subDept}</if>
+            <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>
+            <if test="adminName != null  and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>
+
+            <if test="buildId != null ">and t.build_id = #{buildId}</if>
+            <if test="deptId != null ">and t.dept_id = #{deptId}</if>
+            <if test="id != null ">and t.id = #{id}</if>
+            <if test="subIds != null and subIds != ''">and find_in_set(t.id, #{subIds})</if>
+
+            <if test="adminId != null ">and t.admin_id = #{adminId}</if>
+            <if test="level != null ">and t.level = #{level}</if>
+            <if test="typeId != null ">and t.type_id = #{typeId}</if>
+            <if test="subDept != null and subDept != ''">and t.sub_dept = #{subDept}</if>
             <!-- 数据范围过滤 -->
             <!-- 数据范围过滤 -->
             ${params.dataScope}
             ${params.dataScope}
         </where>
         </where>
         order by t.diy_order desc , t.create_time desc
         order by t.diy_order desc , t.create_time desc
     </select>
     </select>
-<!--  我管理的实验室数量 管理的意思是数据权限加业务权限  -->
+    <!--  我管理的实验室数量 管理的意思是数据权限加业务权限  -->
     <select id="myAdminSubCount" parameterType="com.zd.laboratory.domain.LabSubject" resultType="int">
     <select id="myAdminSubCount" parameterType="com.zd.laboratory.domain.LabSubject" resultType="int">
-        select count(id)  from lab_subject t
+        select count(id) from lab_subject t
         <where>
         <where>
             <if test="deptId != null">
             <if test="deptId != null">
                 and dept_id = #{deptId}
                 and dept_id = #{deptId}
@@ -397,8 +463,8 @@
 
 
     </select>
     </select>
 
 
-<!--  通过实验室IDS 查询 不需要数据权限  -->
-    <select id="selectLabSubjectVOListByIds"  resultMap="LabSubjectResultVO">
+    <!--  通过实验室IDS 查询 不需要数据权限  -->
+    <select id="selectLabSubjectVOListByIds" resultMap="LabSubjectResultVO">
         <include refid="selectLabSubjectListVoIFPhone"/>
         <include refid="selectLabSubjectListVoIFPhone"/>
         where t.id in
         where t.id in
         <foreach item="id" collection="ids" open="(" separator="," close=")">
         <foreach item="id" collection="ids" open="(" separator="," close=")">
@@ -408,9 +474,9 @@
     </select>
     </select>
 
 
     <!--  通过实验室IDS 查询 安全信息 不需要数据权限  -->
     <!--  通过实验室IDS 查询 安全信息 不需要数据权限  -->
-    <select id="selectLabSubSafeInfoByIds"  resultMap="LabSubjectResultVO">
+    <select id="selectLabSubSafeInfoByIds" resultMap="LabSubjectResultVO">
         select t.id,
         select t.id,
-               t.level,
+        t.level,
         t.safe_signs, t.hazard_category, t.risk_measure,
         t.safe_signs, t.hazard_category, t.risk_measure,
         t.outfire, t.qr_code,
         t.outfire, t.qr_code,
         su.nick_name as admin_name,
         su.nick_name as admin_name,
@@ -419,11 +485,12 @@
         ,(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserName
         ,(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserName
         ,(select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserPhone,
         ,(select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserPhone,
         concat(su.nick_name,'@',su.phonenumber) adminNameAndPhone,
         concat(su.nick_name,'@',su.phonenumber) adminNameAndPhone,
-        (select GROUP_CONCAT(concat(nick_name,'@',phonenumber)) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserNameAdminPhone
+        (select GROUP_CONCAT(concat(nick_name,'@',phonenumber)) from sys_user where find_in_set(user_id,
+        t.safe_user_id)) safeUserNameAdminPhone
         from lab_subject t
         from lab_subject t
-        left  join  sys_user su on su.user_id = t.admin_id
-        left  join  sys_dept sd on sd.dept_id = t.dept_id
-        left  join  lab_subject_layout lb on lb.id = t.layout_id
+        left join sys_user su on su.user_id = t.admin_id
+        left join sys_dept sd on sd.dept_id = t.dept_id
+        left join lab_subject_layout lb on lb.id = t.layout_id
         where t.id in
         where t.id in
         <foreach item="id" collection="ids" open="(" separator="," close=")">
         <foreach item="id" collection="ids" open="(" separator="," close=")">
             #{id}
             #{id}
@@ -561,27 +628,33 @@
 
 
 
 
     <delete id="deleteLabSubjectById" parameterType="Long">
     <delete id="deleteLabSubjectById" parameterType="Long">
-        delete from lab_subject where id = #{id}
+        delete
+        from lab_subject
+        where id = #{id}
     </delete>
     </delete>
 
 
     <delete id="deleteLabSubjectByIds" parameterType="String">
     <delete id="deleteLabSubjectByIds" parameterType="String">
-        update  lab_subject  set is_del = 1  where id in
+        update lab_subject set is_del = 1 where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
             #{id}
         </foreach>
         </foreach>
     </delete>
     </delete>
     <!--    根据多层ID个 -->
     <!--    根据多层ID个 -->
-    <select id="selectLabSubjectListByIds" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
-        select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by, update_time, update_by, remark
-         from lab_subject
+    <select id="selectLabSubjectListByIds" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResultVO">
+        select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by,
+        update_time, update_by, remark
+        from lab_subject
         where floor_id in
         where floor_id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
             #{id}
         </foreach>
         </foreach>
     </select>
     </select>
     <!--  根据负责人查询  -->
     <!--  根据负责人查询  -->
-    <select id="selectLabSubjectListByAdminIds" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
-        select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by, update_time, update_by, remark from lab_subject
+    <select id="selectLabSubjectListByAdminIds" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResultVO">
+        select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by,
+        update_time, update_by, remark from lab_subject
         where admin_id in
         where admin_id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
             #{id}
@@ -591,10 +664,11 @@
     <select id="getSubjectDict" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
     <select id="getSubjectDict" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
         select s.id, s.name `name`
         select s.id, s.name `name`
         from
         from
-            lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
+        lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
         <where>
         <where>
             <if test="deptId != null ">
             <if test="deptId != null ">
-                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
+                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
+                FIND_IN_SET(#{deptId},
                 ancestors) ))
                 ancestors) ))
             </if>
             </if>
             <if test="buildId != null">
             <if test="buildId != null">
@@ -605,13 +679,15 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="getSubjectDictByViolation" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
+    <select id="getSubjectDictByViolation" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResult">
         select s.id, s.name `name`
         select s.id, s.name `name`
         from
         from
         lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
         lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
         <where>
         <where>
             <if test="deptId != null ">
             <if test="deptId != null ">
-                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
+                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
+                FIND_IN_SET(#{deptId},
                 ancestors) ))
                 ancestors) ))
             </if>
             </if>
             <if test="buildId != null">
             <if test="buildId != null">
@@ -620,21 +696,23 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="getFilterSubjectDict" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultMap="LabSubjectResult">
+    <select id="getFilterSubjectDict" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultMap="LabSubjectResult">
         select s.id, s.name `name`
         select s.id, s.name `name`
         from
         from
         lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
         lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
         <where>
         <where>
             (NOT EXISTS(SELECT fg.`subject_id` FROM lab_subject_securityconfigure fg WHERE fg.`subject_id` = s.`id`)
             (NOT EXISTS(SELECT fg.`subject_id` FROM lab_subject_securityconfigure fg WHERE fg.`subject_id` = s.`id`)
             <if test="subjectIds != null ">
             <if test="subjectIds != null ">
-            OR s.`id` IN
-            <foreach item="subId" collection="subjectIds" open="(" separator="," close=")">
-                #{subId}
-            </foreach>
+                OR s.`id` IN
+                <foreach item="subId" collection="subjectIds" open="(" separator="," close=")">
+                    #{subId}
+                </foreach>
             </if>
             </if>
             )
             )
             <if test="deptId != null ">
             <if test="deptId != null ">
-                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
+                and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
+                FIND_IN_SET(#{deptId},
                 ancestors) ))
                 ancestors) ))
             </if>
             </if>
             <if test="buildId != null">
             <if test="buildId != null">
@@ -643,7 +721,8 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="getUserRoleBySub" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
+    <select id="getUserRoleBySub" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
         SELECT s.id, s.name `name`,d.`dept_name` deptName,
         SELECT s.id, s.name `name`,d.`dept_name` deptName,
         sc.classified_name AS levelName,
         sc.classified_name AS levelName,
         st.type_name AS typeName,
         st.type_name AS typeName,
@@ -661,10 +740,10 @@
             <if test="floorId != null ">
             <if test="floorId != null ">
                 and s.floor_id = #{floorId}
                 and s.floor_id = #{floorId}
             </if>
             </if>
-<!--            <if test="searchValue != null ">-->
-<!--                and (s.name like concat('%', #{searchValue}, '%')-->
-<!--                or u.nick_name like concat('%', #{adminName}, '%'))-->
-<!--            </if>-->
+            <!--            <if test="searchValue != null ">-->
+            <!--                and (s.name like concat('%', #{searchValue}, '%')-->
+            <!--                or u.nick_name like concat('%', #{adminName}, '%'))-->
+            <!--            </if>-->
             <if test="buildId != null ">
             <if test="buildId != null ">
                 and s.build_id = #{buildId}
                 and s.build_id = #{buildId}
             </if>
             </if>
@@ -690,7 +769,8 @@
     </select>
     </select>
 
 
 
 
-    <select id="getUserRoleBySubBindRisk" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
+    <select id="getUserRoleBySubBindRisk" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
         SELECT s.id, s.name `name`,d.`dept_name` deptName,
         SELECT s.id, s.name `name`,d.`dept_name` deptName,
         sc.classified_name AS levelName,
         sc.classified_name AS levelName,
         st.type_name AS typeName,
         st.type_name AS typeName,
@@ -739,7 +819,8 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="getAllSubjectByParame" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
+    <select id="getAllSubjectByParame" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
         SELECT s.id subjectId, s.name `name`,d.`dept_name` deptName,
         SELECT s.id subjectId, s.name `name`,d.`dept_name` deptName,
         sc.classified_name AS levelName,
         sc.classified_name AS levelName,
         st.type_name AS typeName,
         st.type_name AS typeName,
@@ -773,7 +854,8 @@
                 and s.name like concat('%', #{name}, '%')
                 and s.name like concat('%', #{name}, '%')
             </if>
             </if>
             <if test="deptId != null">
             <if test="deptId != null">
-               and  ( s.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or s.dept_id = #{deptId} )
+                and ( s.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or
+                s.dept_id = #{deptId} )
             </if>
             </if>
             <if test="level != null">
             <if test="level != null">
                 and s.level = #{level}
                 and s.level = #{level}
@@ -791,27 +873,41 @@
     </select>
     </select>
 
 
     <select id="mySubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
     <select id="mySubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
-        select s.`id`,s.name,s.`room`, b.`name` build_name,d.`dept_name`,s.`sub_dept`,u.nick_name as admin_name,
+        select s.`id`,s.name,s.`room`,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 3
+        and f.id =bfl.floor_id) build_name,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =bfl.build_id) dept_name,
+        s.`sub_dept`,u.nick_name as admin_name,
         (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id=s.`type_id`) danger_name,
         (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id=s.`type_id`) danger_name,
-        IFNULL((SELECT CASE a.record_content WHEN  0 THEN 0 WHEN 4 THEN 0 ELSE 1 END FROM lab_approval a
+        IFNULL((SELECT CASE a.record_content WHEN 0 THEN 0 WHEN 4 THEN 0 ELSE 1 END FROM lab_approval a
         WHERE a.join_user_id = #{userId} AND a.subject_id = s.`id` limit 1),0) is_apply,
         WHERE a.join_user_id = #{userId} AND a.subject_id = s.`id` limit 1),0) is_apply,
         (SELECT a.record_content FROM lab_approval a
         (SELECT a.record_content FROM lab_approval a
         WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) record_content,
         WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) record_content,
         (SELECT a.id FROM lab_approval a
         (SELECT a.id FROM lab_approval a
         WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) app_id
         WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) app_id
-         from lab_subject s inner join lab_building b on s.`floor_id` = b.`id` inner join sys_dept d on b.`dept_id` = d.`dept_id`
+        from lab_subject s inner join lab_building b on s.`floor_id` = b.`id` inner join sys_dept d on b.`dept_id` =
+        d.`dept_id`
         LEFT JOIN sys_user u ON u.user_id = s.admin_id
         LEFT JOIN sys_user u ON u.user_id = s.admin_id
+        LEFT JOIN lab_build_floor_layout bfl ON bfl.sub_id=s.id
         <where>
         <where>
             <if test="deptId != null ">
             <if test="deptId != null ">
-                AND (b.dept_id = #{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
+                AND (b.dept_id = #{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
+                find_in_set(#{deptId},
                 ancestors) ))
                 ancestors) ))
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>
 
 
 
 
-    <select id="getTypeCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabClasstypeVo">
-        SELECT sc.id,sc.type_name typeName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM lab_safe_classtype sc
+    <select id="getTypeCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultType="com.zd.laboratory.domain.vo.LabClasstypeVo">
+        SELECT sc.id,sc.type_name typeName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM
+        lab_safe_classtype sc
         LEFT JOIN lab_subject st ON sc.id = st.type_id
         LEFT JOIN lab_subject st ON sc.id = st.type_id
         <where>
         <where>
             1=1
             1=1
@@ -821,8 +917,10 @@
         GROUP BY sc.id,sc.type_name
         GROUP BY sc.id,sc.type_name
     </select>
     </select>
 
 
-    <select id="getFiedCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabClassifiedVo">
-        SELECT sc.id,sc.classified_name classifiedName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM lab_safe_classified sc
+    <select id="getFiedCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
+            resultType="com.zd.laboratory.domain.vo.LabClassifiedVo">
+        SELECT sc.id,sc.classified_name classifiedName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM
+        lab_safe_classified sc
         LEFT JOIN lab_subject st ON sc.id = st.level
         LEFT JOIN lab_subject st ON sc.id = st.level
         <where>
         <where>
             1=1
             1=1
@@ -846,7 +944,7 @@
         WHERE
         WHERE
         a.id IN
         a.id IN
         <foreach item="id" collection="array" open="(" separator="," close=")">
         <foreach item="id" collection="array" open="(" separator="," close=")">
-        #{id}
+            #{id}
         </foreach>
         </foreach>
     </select>
     </select>
 
 
@@ -869,21 +967,25 @@
     </select>
     </select>
 
 
     <select id="selectLabSubjectCheckById" resultType="com.zd.laboratory.domain.LabSubject">
     <select id="selectLabSubjectCheckById" resultType="com.zd.laboratory.domain.LabSubject">
-        select s.check_in,s.skipped,s.check_count,
-         (SELECT sl.room FROM lab_subject_layout sl WHERE sl.id = s.`layout_id`) room,
-         (SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = s.`dept_id`) dept_name
-         from lab_subject s where s.id=#{id}
+        select s.check_in,
+               s.skipped,
+               s.check_count,
+               (SELECT sl.room FROM lab_subject_layout sl WHERE sl.id = s.`layout_id`) room,
+               (SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = s.`dept_id`)   dept_name
+        from lab_subject s
+        where s.id = #{id}
     </select>
     </select>
 
 
     <select id="selectSubInfoByMyGradeManageWork"
     <select id="selectSubInfoByMyGradeManageWork"
             resultType="com.zd.laboratory.api.vo.LabGradeManageWorkVO">
             resultType="com.zd.laboratory.api.vo.LabGradeManageWorkVO">
 
 
-        select s.id as subId, s.name as subName,
+        select s.id                           as subId,
+               s.name                         as subName,
                s.level,
                s.level,
                ifnull(sc.classified_name, "") as levelName,
                ifnull(sc.classified_name, "") as levelName,
-               sc.classified_color as levelColor,
-               s.type_id as typeId,
-               ifnull(st.type_name, "") as typeName,
+               sc.classified_color            as levelColor,
+               s.type_id                      as typeId,
+               ifnull(st.type_name, "")       as typeName,
                s.dept_id,
                s.dept_id,
                sd.dept_name
                sd.dept_name
         from lab_subject as s
         from lab_subject as s
@@ -899,11 +1001,13 @@
         </foreach>
         </foreach>
     </select>
     </select>
     <select id="selectSubIdByAdminId" resultType="java.lang.Long">
     <select id="selectSubIdByAdminId" resultType="java.lang.Long">
-        select id from lab_subject where admin_id = #{adminId}
+        select id
+        from lab_subject
+        where admin_id = #{adminId}
     </select>
     </select>
 
 
     <select id="selectLabAdminByIds" resultType="java.util.Map">
     <select id="selectLabAdminByIds" resultType="java.util.Map">
-        select admin_id as adminId, id as subId  from lab_subject where id in
+        select admin_id as adminId, id as subId from lab_subject where id in
         <foreach item="id" collection="list" open="(" separator="," close=")">
         <foreach item="id" collection="list" open="(" separator="," close=")">
             #{id}
             #{id}
         </foreach>
         </foreach>
@@ -937,10 +1041,12 @@
 
 
     </select>
     </select>
     <select id="selectLabSubjectListPage" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
     <select id="selectLabSubjectListPage" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
-        select * from lab_subject
+        select *
+        from lab_subject
 
 
     </select>
     </select>
-    <select id="selectLabSubjectListByLayout" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
+    <select id="selectLabSubjectListByLayout" parameterType="com.zd.laboratory.domain.LabSubject"
+            resultMap="LabSubjectResult">
         select
         select
         id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
         id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
         (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
         (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
@@ -948,11 +1054,45 @@
         create_by, update_time, update_by, remark, sub_dept,
         create_by, update_time, update_by, remark, sub_dept,
         check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
         check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
         outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
         outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
-        (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur WHERE FIND_IN_SET(ur.user_id, s.`safe_user_id`)) AS safeUserNames,
-        (select d.dept_name from sys_dept d where s.build_id = d.dept_id) build_name,
-        (select b.name from lab_building b where b.id = s.floor_id) floorName,
-        (SELECT l.room FROM lab_subject_layout l WHERE l.id = s.layout_id ) roomName,
-        (select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, s.safe_user_id)) safeUserPhone
+        (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur
+        WHERE ur.`user_id`
+        IN (
+        SELECT
+        SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
+        FROM
+        mysql.help_topic b
+        WHERE
+        b.help_topic_id &lt; (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
+        )
+        ) AS safeUserNames,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = s.id)) build_name,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 3
+        and f.id =
+        (select bfl.floor_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = s.id)) floorName,
+        (select bfl.room_num
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = s.id ) roomName,
+        (SELECT GROUP_CONCAT(phonenumber) FROM sys_user ur
+        WHERE ur.`user_id`
+        IN (
+        SELECT
+        SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
+        FROM
+        mysql.help_topic b
+        WHERE
+        b.help_topic_id &lt; (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
+        )
+        ) safeUserPhone
         from lab_subject s
         from lab_subject s
         <where>
         <where>
             s.`id` NOT IN(SELECT bfl.`sub_id` FROM lab_build_floor_layout bfl)
             s.`id` NOT IN(SELECT bfl.`sub_id` FROM lab_build_floor_layout bfl)
@@ -960,14 +1100,16 @@
                 and s.dept_id in
                 and s.dept_id in
                 <foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
                 <foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
             </if>
             </if>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="floorId != null "> and floor_id = #{floorId}</if>
-            <if test="room != null  and room != ''"> and room = #{room}</if>
-            <if test="deptId != null "> and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or dept_id = #{deptId} )</if>
-            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
-            <if test="adminId != null "> and admin_id = #{adminId}</if>
-            <if test="isDel != null "> and is_del = #{isDel}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="floorId != null ">and floor_id = #{floorId}</if>
+            <if test="room != null  and room != ''">and room = #{room}</if>
+            <if test="deptId != null ">and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId}
+                ,ancestors )) or dept_id = #{deptId} )
+            </if>
+            <if test="deptName != null  and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="adminId != null ">and admin_id = #{adminId}</if>
+            <if test="isDel != null ">and is_del = #{isDel}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
         </where>
         </where>
     </select>
     </select>
 </mapper>
 </mapper>

+ 13 - 5
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabWhiteJoinSublistMapper.xml

@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select t.id, t.white_user_id, t.subject_id, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from lab_white_join_sublist as t
         select t.id, t.white_user_id, t.subject_id, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from lab_white_join_sublist as t
     </sql>
     </sql>
     <select id="selectLabWhiteJoinSublistList" parameterType="com.zd.laboratory.domain.LabWhiteJoinSublist" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
     <select id="selectLabWhiteJoinSublistList" parameterType="com.zd.laboratory.domain.LabWhiteJoinSublist" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
-        select
+    select
         t.white_user_id,
         t.white_user_id,
         t.subject_id,
         t.subject_id,
         t.create_by,
         t.create_by,
@@ -31,19 +31,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         t.update_time,
         t.update_time,
         t.remark,
         t.remark,
         s.`name`,
         s.`name`,
-        dt.`dept_name` building,
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 2
+        and f.id =
+        (select bfl.build_id
+        from lab_build_floor_layout bfl
+        where bfl.sub_id = t.subject_id)) building,
         dpt.`dept_name`,
         dpt.`dept_name`,
         ur.`nick_name` adminName,
         ur.`nick_name` adminName,
         cfd.`classified_name` levelName,
         cfd.`classified_name` levelName,
-        bg.name buildName
+        (select f.`name`
+        from lab_build_floor f
+        where f.type = 3
+        and f.id =bfl.floor_id) buildName
         from
         from
         lab_white_join_sublist as t
         lab_white_join_sublist as t
         LEFT join lab_subject s on t.subject_id = s.`id`
         LEFT join lab_subject s on t.subject_id = s.`id`
-        LEFT join sys_dept dt on s.`build_id` = dt.`dept_id`
         LEFT join sys_dept dpt on s.`dept_id` = dpt.`dept_id`
         LEFT join sys_dept dpt on s.`dept_id` = dpt.`dept_id`
         LEFT join sys_user ur on s.`admin_id` = ur.`user_id`
         LEFT join sys_user ur on s.`admin_id` = ur.`user_id`
         LEFT join lab_safe_classified cfd on s.level = cfd.`id`
         LEFT join lab_safe_classified cfd on s.level = cfd.`id`
-        LEFT JOIN lab_building bg ON bg.id = s.floor_id
+        LEFT JOIN lab_build_floor_layout bfl ON bfl.sub_id = t.subject_id
         <where>
         <where>
             <if test="whiteUserId != null ">and t.white_user_id = #{whiteUserId}</if>
             <if test="whiteUserId != null ">and t.white_user_id = #{whiteUserId}</if>
             <if test="subjectId != null ">and t.subject_id = #{subjectId}</if>
             <if test="subjectId != null ">and t.subject_id = #{subjectId}</if>