|
@@ -1261,4 +1261,185 @@
|
|
|
<select id="isAdminOrSafeUser" resultType="java.lang.Integer">
|
|
<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 COUNT(*) FROM lab_subject WHERE id=#{subjectId} AND (admin_id=#{userId} OR LOCATE(#{userId},safe_user_id)>0)
|
|
|
</select>
|
|
</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>
|
|
</mapper>
|