hanzhiwei пре 2 година
родитељ
комит
141da68492
13 измењених фајлова са 463 додато и 4 уклоњено
  1. 5 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/forward/feign/RemoteForwardService.java
  2. 7 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/forward/feign/fallback/RemoteForwardFallbackFactory.java
  3. 5 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteMessageContentService.java
  4. 8 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteMessageContentFallbackFactory.java
  5. 23 4
      zd-api/zd-system-api/src/main/java/com/zd/system/api/feign/RemoteDeptService.java
  6. 26 0
      zd-api/zd-system-api/src/main/java/com/zd/system/api/feign/factory/RemoteDeptFallbackFactory.java
  7. 66 0
      zd-common/common-core/src/main/java/com/zd/common/core/utils/BeanUtils.java
  8. 9 0
      zd-model/src/main/java/com/zd/model/entity/Algorithm.java
  9. 9 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabMessageContentController.java
  10. 87 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSubjectMapper.java
  11. 15 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabHazardSubjectRelationService.java
  12. 22 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabHazardSubjectRelationServiceImpl.java
  13. 181 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml

+ 5 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/forward/feign/RemoteForwardService.java

@@ -1,8 +1,10 @@
 package com.zd.algorithm.api.forward.feign;
 
+import com.zd.algorithm.api.forward.bo.AlgorithmWarningBo;
 import com.zd.algorithm.api.forward.feign.fallback.RemoteForwardFallbackFactory;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysFile;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -31,4 +33,7 @@ public interface RemoteForwardService {
 
     @GetMapping("/alarm/photograph")
     R<SysFile> photograph(@RequestParam("streamUrl") String streamUrl);
+
+    @PostMapping("/algorithm/warningCheck")
+    ResultData warningCheck(@RequestBody AlgorithmWarningBo bo);
 }

+ 7 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/forward/feign/fallback/RemoteForwardFallbackFactory.java

@@ -1,7 +1,9 @@
 package com.zd.algorithm.api.forward.feign.fallback;
 
+import com.zd.algorithm.api.forward.bo.AlgorithmWarningBo;
 import com.zd.algorithm.api.forward.feign.RemoteForwardService;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysFile;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,6 +43,11 @@ public class RemoteForwardFallbackFactory implements FallbackFactory<RemoteForwa
             public R<SysFile> photograph(String streamUrl) {
                 return R.fail("报警拍照服务调用失败:" + throwable.getMessage());
             }
+
+            @Override
+            public ResultData warningCheck(AlgorithmWarningBo bo) {
+                return ResultData.fail("算法服务不可用,请稍后重试");
+            }
         };
     }
 }

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

@@ -1,10 +1,12 @@
 package com.zd.laboratory.api.feign;
 
+import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.LabMessageUser;
 import com.zd.laboratory.api.feign.fallback.RemoteMessageContentFallbackFactory;
 import com.zd.laboratory.api.vo.LabMessageUserListVO;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysUser;
 import com.zd.model.page.TableDataInfo;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -72,4 +74,7 @@ public interface RemoteMessageContentService {
 
     @PostMapping("/haikang/user/updateUserFace")
     public void updateUserFace(@RequestBody SysUser user);
+
+    @PostMapping("/content/sendMessage")
+    ResultData sendMessage(@RequestBody LabMessageContent labMessageContent);
 }

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

@@ -1,9 +1,11 @@
 package com.zd.laboratory.api.feign.fallback;
 
+import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.LabMessageUser;
 import com.zd.laboratory.api.feign.RemoteMessageContentService;
 import com.zd.laboratory.api.vo.LabMessageUserListVO;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysUser;
 import com.zd.model.page.TableDataInfo;
 import org.slf4j.Logger;
@@ -119,6 +121,12 @@ public class RemoteMessageContentFallbackFactory implements FallbackFactory<Remo
             public void updateUserFace(SysUser user) {
                 log.error("更新海康用户人脸信息 失败!");
             }
+
+            @Override
+            public ResultData sendMessage(LabMessageContent labMessageContent) {
+                log.error("发送通知消息失败,{}",cause.getMessage());
+                return ResultData.fail("发送通知消息失败!"+cause.getMessage());
+            }
         };
     }
 }

+ 23 - 4
zd-api/zd-system-api/src/main/java/com/zd/system/api/feign/RemoteDeptService.java

@@ -3,14 +3,12 @@ package com.zd.system.api.feign;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.domain.AjaxResult;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysDept;
 import com.zd.system.api.feign.factory.RemoteDeptFallbackFactory;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
@@ -42,4 +40,25 @@ public interface RemoteDeptService {
     @ApiOperation(value = "根据部门id查询部门信息")
     @GetMapping("/dept/info/{id}")
     AjaxResult getInfoById(@PathVariable("id") Long id);
+
+    @ApiOperation(value = "根据部门id查询部门信息")
+    @GetMapping("/dept/info/{deptId}")
+    AjaxResult getInfoByDeptId(@PathVariable("deptId") Long deptId);
+
+
+    @ApiOperation(value = "根据部门id查询部门信息")
+    @GetMapping("/dept/sign/{deptId}")
+    ResultData<String> getDeptBySign(@PathVariable("deptId") Long deptId);
+
+    @ApiOperation(value = "根据部门名称查询部门信息")
+    @GetMapping("/dept/findDeptByDeptName")
+    ResultData<SysDept> findDeptByDeptName(@RequestParam("deptName") String deptName);
+
+    @ApiOperation("根据部门ids查询部门")
+    @GetMapping("/dept/getDeptListByDeptIds")
+    ResultData<List<SysDept>> getDeptListByDeptIds(@RequestParam("deptIds") String deptIds);
+
+    @ApiOperation("根据部门ids查询子集部门")
+    @GetMapping("/dept/getDeptListBySubset")
+    ResultData<List<SysDept>> getDeptListBySubset(@RequestParam("deptId") Long deptId);
 }

+ 26 - 0
zd-api/zd-system-api/src/main/java/com/zd/system/api/feign/factory/RemoteDeptFallbackFactory.java

@@ -2,6 +2,7 @@ package com.zd.system.api.feign.factory;
 
 import com.zd.model.domain.AjaxResult;
 import com.zd.model.domain.R;
+import com.zd.model.domain.ResultData;
 import com.zd.model.entity.SysDept;
 import com.zd.system.api.feign.RemoteDeptService;
 import org.slf4j.Logger;
@@ -44,6 +45,31 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
             public AjaxResult getInfoById(Long id) {
                 return AjaxResult.error("查询部门信息失败:" + throwable.getMessage());
             }
+
+            @Override
+            public AjaxResult getInfoByDeptId(Long deptId) {
+                return AjaxResult.error("查询部门信息失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public ResultData getDeptBySign(Long deptId) {
+                return ResultData.fail("查询部门信息失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public ResultData<SysDept> findDeptByDeptName(String deptName) {
+                return ResultData.fail("查询部门信息失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public ResultData<List<SysDept>> getDeptListByDeptIds(String deptIds) {
+                return ResultData.fail("查询部门信息失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public ResultData <List <SysDept>> getDeptListBySubset(Long deptId) {
+                return ResultData.fail("查询部门信息失败:" + throwable.getMessage());
+            }
         };
     }
 }

+ 66 - 0
zd-common/common-core/src/main/java/com/zd/common/core/utils/BeanUtils.java

@@ -1,8 +1,13 @@
 package com.zd.common.core.utils;
 
+import cn.hutool.core.bean.BeanUtil;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.compress.utils.Lists;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.function.Supplier;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -101,4 +106,65 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
     public static boolean isMethodPropEquals(String m1, String m2) {
         return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
     }
+
+    /**
+     * copy List
+     *
+     * @param input 输入源集合
+     * @param clzz  输出目标集合类型
+     * @param <E>   输入源集合类型
+     * @param <T>   输出目标集合类型
+     * @return 返回集合
+     */
+    public static <E, T> List<T> copyList2List(List<E> input, Class<T> clzz) {
+        List<T> output = Lists.newArrayList ();
+        if (CollectionUtils.isNotEmpty (input)) {
+            for (E source : input) {
+                T target = BeanUtils.instantiateClass (clzz);
+                BeanUtil.copyProperties (source, target);
+                output.add (target);
+            }
+        }
+        return output;
+    }
+
+    /**
+     * List集合复制
+     * 使用方法:List<User> 复制到 List<UserVo>
+     * 方法调用:ZdBeanUtils.copyListProperties(userList, UserVo::new);
+     *
+     * @param sources 源集合对象
+     * @param target 目标对象
+     * @return
+     * @param <S> 源对象类型
+     * @param <T> 目标对象类型
+     */
+    public static <S, T> List<T> copyListProperties(List<S> sources, Supplier<T> target) {
+        return copyListProperties(sources, target, null);
+    }
+
+    public static <S, T> List<T> copyListProperties(List<S> sources, Supplier<T> target, ConvertCallBack<S, T> callBack) {
+        List<T> list = new ArrayList<>(sources.size());
+        for (S source : sources) {
+            T t = target.get();
+            copyProperties(source, t);
+            if (callBack != null) {
+                // 回调
+                callBack.callBack(source, t);
+            }
+            list.add(t);
+        }
+        return list;
+    }
+
+    /**
+     * 回调接口
+     *
+     * @param <S> 源对象类型
+     * @param <T> 目标对象类型
+     */
+    @FunctionalInterface
+    public interface ConvertCallBack<S, T> {
+        void callBack(S t, T s);
+    }
 }

+ 9 - 0
zd-model/src/main/java/com/zd/model/entity/Algorithm.java

@@ -44,6 +44,7 @@ public class Algorithm {
 
     private Long subId;
 
+    private String subName;
 
     private int status = 0;
 
@@ -168,4 +169,12 @@ public class Algorithm {
     public Date getUpdateTime() {        return updateTime;    }
 
     public void setUpdateTime(Date updateTime) {        this.updateTime = updateTime;    }
+
+    public String getSubName() {
+        return subName;
+    }
+
+    public void setSubName(String subName) {
+        this.subName = subName;
+    }
 }

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

@@ -207,4 +207,13 @@ public class LabMessageContentController extends BaseController {
     public void readMsgContent(@RequestParam @NotNull Long id) {
         labMessageContentService.readMsgContent(id);
     }
+
+    @RequestMapping("/sendMessage")
+    public ResultData sendMessage(@RequestBody LabMessageContent labMessageContent){
+        Boolean aBoolean = labMessageContentService.sendMessage(labMessageContent);
+        if (aBoolean) {
+            return ResultData.success();
+        }
+        return ResultData.fail();
+    }
 }

+ 87 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSubjectMapper.java

@@ -1,8 +1,12 @@
 package com.zd.laboratory.mapper;
 
+import com.zd.laboratory.api.dto.CheckSubjectDto;
+import com.zd.laboratory.api.dto.QuerySubListParam;
+import com.zd.laboratory.api.vo.CollegeInfoVo;
 import com.zd.laboratory.api.vo.LabGradeManageWorkVO;
 import com.zd.laboratory.api.vo.LabSubClassVO;
 import com.zd.laboratory.domain.LabSubject;
+import com.zd.laboratory.domain.SubejctInfoBo;
 import com.zd.laboratory.domain.vo.LabClassifiedVo;
 import com.zd.laboratory.domain.vo.LabClasstypeVo;
 import com.zd.laboratory.domain.vo.LabSubjectDetailVO;
@@ -337,4 +341,87 @@ public interface LabSubjectMapper {
      */
     Integer isAdminOrSafeUser(@Param("subjectId") Long subjectId,@Param("userId") Long userId);
 
+    /**
+     * 查询实验室id列表实验室
+     * 获取实验室的信息(学院。楼栋,楼层,房间号,实验室名称,安全人员,电话号码等)
+     *
+     * @param subIds
+     * @return
+     */
+    List<CheckSubjectDto> findSubjectInfoList(@Param("subIds") Long[] subIds);
+
+    /**
+     * 根据条件查询实验室信息(分页)
+     *
+     * @Param [subejctInfoBo]
+     * @Return java.util.List<com.zd.laboratory.api.dto.CheckSubjectDto>
+     **/
+    List<CheckSubjectDto> conditionSubjectInfo(@Param("subejctInfoBo") SubejctInfoBo subejctInfoBo);
+
+    /**
+     * 根据条件查询所有学院id和name
+     *
+     * @Param [searchValue]
+     * @Return java.util.List<com.zd.laboratory.api.vo.CollegeInfoVo>
+     **/
+    List<CollegeInfoVo> conditionCollegeInfo(@Param("searchValue") String searchValue);
+
+    /**
+     * 查询学院下实验室数量
+     *
+     * @param deptId
+     * @return
+     */
+    int getCollegeSubCount(@Param("deptId") Long deptId);
+
+    /**
+     * 根根据学院ids(部门id) 查询实验室信息
+     *
+     * @Param [deptIds 学院id(部门id)]
+     * @Return java.util.List<com.zd.laboratory.api.dto.CheckSubjectDto>
+     **/
+    List<CheckSubjectDto> findSubInfoByDeptIds(@Param("querySubListParam") QuerySubListParam querySubListParam);
+
+    /**
+     * 根据实验室id查询RFID实验室详情
+     *
+     * @Param [longs]
+     * @Return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
+     **/
+    List<Map<String, Object>> getPositionBySubId(@Param("longs") Long[] longs);
+
+    /**
+     * 查询全校所有实验室数量
+     * @Param []
+     * @Return java.lang.Integer
+     **/
+    Integer getAllSubNum();
+
+    /**
+     * 存在实验室的学院数量
+     * @return
+     */
+    Integer hasSubCollegeNum();
+
+    /**
+     * 查询所有实验室ids
+     * @Return java.util.List<java.lang.Long>
+     **/
+    List<Long> getSubIds();
+
+    /**
+     * 根据学院id查询实验室ids
+     * @param deptIds
+     * @return
+     */
+    List<Long> getCollegeSubIds(@Param("deptIds") Long[] deptIds);
+
+
+    /**
+     * 根据楼栋id查询实验室列表
+     *
+     * @param labSubject 实验室
+     * @return 实验室集合
+     */
+    public List<LabSubject> buildBySub(LabSubject labSubject);
 }

+ 15 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabHazardSubjectRelationService.java

@@ -5,6 +5,7 @@ import com.zd.laboratory.domain.dto.LabHazardDTO;
 import com.zd.laboratory.domain.dto.LabHazardJoinSubDTO;
 import com.zd.laboratory.domain.vo.LabHazardSubVO;
 import com.zd.model.enums.HazardTypeEnum;
+import com.zd.system.api.entity.CommonCount;
 
 import java.util.List;
 
@@ -97,4 +98,18 @@ public interface ILabHazardSubjectRelationService {
     void addRelation(LabHazardDTO labHazard);
 
     int updateBySubId(List<LabHazardSubjectRelation> hazardRelations, Long subId);
+
+    /***
+     * 根据实验室id查询实验室下的危险源
+     * @param subjectId
+     * @return
+     */
+    List<LabHazardSubjectRelation> queryBySubjectId(Long subjectId);
+
+    /**
+     * 查询实验室危险品数量
+     * @param ids
+     * @return
+     */
+    public List<CommonCount> queryCountBySubIds(Long... ids);
 }

+ 22 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabHazardSubjectRelationServiceImpl.java

@@ -12,6 +12,7 @@ import com.zd.laboratory.mapper.LabHazardMapper;
 import com.zd.laboratory.mapper.LabHazardSubjectRelationMapper;
 import com.zd.laboratory.service.ILabHazardSubjectRelationService;
 import com.zd.model.enums.HazardTypeEnum;
+import com.zd.system.api.entity.CommonCount;
 import org.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -273,4 +274,25 @@ public class LabHazardSubjectRelationServiceImpl implements ILabHazardSubjectRel
         }
         return 1;
     }
+
+    /***
+     * 根据实验室id查询实验室下的危险源
+     * @param subjectId
+     * @return
+     */
+    @Override
+    public List<LabHazardSubjectRelation> queryBySubjectId(Long subjectId) {
+        return labHazardSubjectRelationMapper.queryBySubjectId(subjectId);
+    }
+
+    /**
+     * 查询实验室危险品数量
+     *
+     * @param ids
+     * @return
+     */
+    @Override
+    public List<CommonCount> queryCountBySubIds(Long... ids) {
+        return labHazardSubjectRelationMapper.queryCountBySubIds(ids);
+    }
 }

+ 181 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml

@@ -1261,4 +1261,185 @@
     <select id="isAdminOrSafeUser" resultType="java.lang.Integer">
             SELECT  COUNT(*)  FROM  lab_subject WHERE id=#{subjectId} AND (admin_id=#{userId} OR LOCATE(#{userId},safe_user_id)>0)
     </select>
+    <select id="findSubjectInfoList" resultType="com.zd.laboratory.api.dto.CheckSubjectDto">
+        SELECT
+            ls.id subId,
+            ls.name subjectName,
+            ls.room roomNumber,
+            ls.dept_id deptId,
+            ls.build_id buildId,
+            ls.floor_id floorId,
+            lsct.id typeId,
+            lsct.type_name,
+            lscf.id level,
+            lscf.classified_name levelName,
+            (SELECT sd.dept_name FROM sys_dept sd WHERE ls.dept_id = sd.dept_id) collegeName,
+            (select f.name from lab_build_floor f where f.id = ls.build_id) buildName,
+            (SELECT f.name FROM lab_build_floor f WHERE f.id = ls.floor_id) floorName,
+            ls.admin_id adminId,
+			(SELECT su.phonenumber FROM sys_user su WHERE ls.admin_id = su.user_id) adminPhone,
+            ls.safe_user_id safeUserId,
+			(SELECT GROUP_CONCAT(su.phonenumber) FROM sys_user su WHERE FIND_IN_SET( su.user_id,ls.safe_user_id))  safeUserPhone
+        FROM
+        `lab_subject` ls LEFT JOIN lab_safe_classtype lsct ON ls.type_id = lsct.id
+				LEFT JOIN lab_safe_classified lscf ON ls.level = lscf.id
+        <where>
+            <if test="subIds != null and subIds.length != 0">
+                <foreach collection="subIds" item="id" open=" and ls.id in(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="conditionSubjectInfo" resultType="com.zd.laboratory.api.dto.CheckSubjectDto">
+         SELECT
+            ls.id subId,
+            ls.name subjectName,
+            ls.room roomNumber,
+            ls.dept_id deptId,
+            ls.level,
+            ls.type_id typeId,
+            (SELECT sd.dept_name FROM sys_dept sd WHERE ls.dept_id = sd.dept_id) collegeName,
+            (select f.name from lab_build_floor f where f.id = ls.build_id) buildName,
+            (SELECT f.name FROM lab_build_floor f WHERE f.id = ls.floor_id) floorName
+        FROM
+        `lab_subject` ls
+        <where>
+            <if test="subejctInfoBo.subIds != null and subejctInfoBo.subIds.length != 0">
+                <foreach item="id" collection="subejctInfoBo.subIds" open=" and ls.id in( " separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="subejctInfoBo.selectedSubIds != null and subejctInfoBo.selectedSubIds.length != 0 ">
+                <foreach collection="subejctInfoBo.selectedSubIds" item="id" open=" and ls.id not in(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <!-- 过滤类型 不查询数据 -->
+            <if test="(subejctInfoBo.subIds == null or subejctInfoBo.subIds.length == 0) and subejctInfoBo.filtType == 2">
+                and ls.id  = -999999
+            </if>
+            <if test="subejctInfoBo.typeId != null">
+                and ls.type_id = #{subejctInfoBo.typeId}
+            </if>
+            <if test="subejctInfoBo.level != null">
+                and ls.level = #{subejctInfoBo.level}
+            </if>
+            <if test="subejctInfoBo.deptId != null ">
+                and ls.dept_id = #{subejctInfoBo.deptId}
+            </if>
+            <if test="subejctInfoBo.searchValue != null and subejctInfoBo.searchValue !=''">
+                and (ls.name like CONCAT('%',#{subejctInfoBo.searchValue},'%') or ls.room like CONCAT('%',#{subejctInfoBo.searchValue},'%'))
+            </if>
+        </where>
+    </select>
+
+    <select id="conditionCollegeInfo" resultType="com.zd.laboratory.api.vo.CollegeInfoVo">
+        SELECT
+            sd.dept_id,sd.dept_name
+        FROM
+            sys_dept sd
+        <where>
+            sd.del_flag = '0' and sd.dept_type = 1
+            <if test="searchValue != null and searchValue != ''">
+                and sd.dept_name like CONCAT('%',#{searchValue},'%')
+            </if>
+        </where>
+    </select>
+
+    <select id="getCollegeSubCount" resultType="java.lang.Integer">
+        select count(*)
+        from lab_subject
+        where dept_id = #{deptId}
+    </select>
+    <select id="findSubInfoByDeptIds" resultType="com.zd.laboratory.api.dto.CheckSubjectDto">
+        select
+            ls.id subId,
+            ls.name subjectName,
+            ls.room roomNumber,
+            ls.dept_id deptId,
+            ls.level,
+            ls.type_id typeId,
+            (SELECT sd.dept_name FROM sys_dept sd WHERE ls.dept_id = sd.dept_id) collegeName,
+            (select f.name from lab_build_floor f where f.id = ls.build_id) buildName,
+            (SELECT f.name FROM lab_build_floor f WHERE f.id = ls.floor_id) floorName
+        from lab_subject ls
+        <where>
+            <if test="querySubListParam.deptIds != null and querySubListParam.deptIds.length != 0">
+                <foreach collection="querySubListParam.deptIds" item="id" open=" and dept_id in(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+           <if test="querySubListParam.deptIds != null and querySubListParam.deptIds.length != 0">
+                <foreach collection="querySubListParam.deptIds" item="id" open=" and dept_id in(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+             <if test="querySubListParam.typeId != null">
+                and ls.type_id = #{querySubListParam.typeId}
+            </if>
+            <if test="querySubListParam.level != null">
+                and ls.level = #{querySubListParam.level}
+            </if>
+            <if test="querySubListParam.searchValue != null and querySubListParam.searchValue != ''">
+                and (ls.name like concat('%',#{querySubListParam.searchValue},'%')
+                     or ls.room like concat('%',#{querySubListParam.searchValue},'%'))
+            </if>
+        </where>
+    </select>
+    <select id="getPositionBySubId" resultType="java.util.Map">
+        select
+            ls.id subId,
+            CONCAT((select f.name from lab_build_floor f where f.id = ls.build_id),'-',
+            (SELECT f.name FROM lab_build_floor f WHERE f.id = ls.floor_id),'-',ls.name) position,
+            (SELECT sd.dept_name FROM sys_dept sd WHERE ls.dept_id = sd.dept_id) deptName
+        from lab_subject ls
+        <where>
+            <if test="longs != null  and longs.length != 0">
+               <foreach collection="longs" item="id" open=" and ls.id in(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </select>
+    <select id="getAllSubNum" resultType="java.lang.Integer">
+        select COUNT(*)
+        from lab_subject ls
+    </select>
+
+    <select id="hasSubCollegeNum" resultType="java.lang.Integer">
+        select count(DISTINCT dept_id) FROM lab_subject
+    </select>
+    <select id="getSubIds" resultType="java.lang.Long">
+        select id
+        from lab_subject
+    </select>
+    <select id="getCollegeSubIds" resultType="java.lang.Long">
+        select id
+        from lab_subject
+        <where>
+            <if test="deptIds != null and deptIds.length != 0">
+                <foreach collection="deptIds" item="dept_id" open="and dept_id in(" separator="," close=")">
+                    #{dept_id}
+                </foreach>
+             </if>
+        </where>
+     </select>
+    <select id="buildBySub" resultType="com.zd.laboratory.domain.LabSubject">
+
+        select s.id,s.name,s.dept_id deptId,s.build_id buildId,s.room from lab_subject s
+        <where>
+            <if test="buildId != null ">and s.build_id = #{buildId}</if>
+            <if test="searchValue != null and searchValue !=''">
+                and (s.name like concat('%', #{searchValue}, '%')
+                or s.room like concat('%',#{searchValue},'%'))
+            </if>
+            <if test="deptId != null and 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>
+        </where>
+        <!-- 数据范围过滤 -->
+    </select>
 </mapper>