2024-09-03 22:09:21 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.ruoyi.project.oil.mapper.ThDeviceMapper">
|
|
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.ruoyi.project.oil.domain.monitor.ThDevice">
|
|
|
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
|
|
<result property="sn" column="sn" jdbcType="VARCHAR"/>
|
|
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
|
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
|
|
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
|
|
|
<result property="note" column="note" jdbcType="VARCHAR"/>
|
|
|
|
<result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
|
|
|
|
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
|
|
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
|
|
<result property="address" column="address" jdbcType="VARCHAR"/>
|
|
|
|
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
|
|
|
<result property="longitude" column="longitude" jdbcType="VARCHAR"/>
|
|
|
|
<result property="latitude" column="latitude" jdbcType="VARCHAR"/>
|
|
|
|
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
|
2024-09-09 17:22:18 +08:00
|
|
|
<result property="gangqu" column="gangqu" jdbcType="VARCHAR"/>
|
2024-09-03 22:09:21 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
select d.id,
|
|
|
|
d.sn,
|
|
|
|
d.name,
|
|
|
|
d.create_by,
|
|
|
|
d.create_time,
|
|
|
|
d.status,
|
|
|
|
d.note,
|
|
|
|
d.file_url,
|
|
|
|
d.update_by,
|
|
|
|
d.update_time,
|
|
|
|
d.address,
|
|
|
|
d.dept_id,
|
|
|
|
d.longitude,
|
|
|
|
d.latitude,
|
2024-09-09 17:22:18 +08:00
|
|
|
p.dept_name,
|
|
|
|
pp.dept_name as "gangqu"
|
2024-09-03 22:09:21 +08:00
|
|
|
from th_device d
|
|
|
|
left join sys_dept p on d.dept_id = p.dept_id
|
2024-09-09 17:22:18 +08:00
|
|
|
left join sys_dept pp on p.parent_id = pp.dept_id
|
2024-09-03 22:09:21 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectDeviceListByDeptId" parameterType="long" resultMap="BaseResultMap">
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
where d.dept_id = #{deptId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectAllDeviceListByDeptId" parameterType="long" resultMap="BaseResultMap">
|
|
|
|
WITH dept_hierarchy (dept_id) AS (
|
2024-09-04 23:15:56 +08:00
|
|
|
SELECT dept_id
|
|
|
|
FROM sys_dept
|
|
|
|
WHERE dept_id = #{deptId}
|
|
|
|
UNION ALL
|
|
|
|
SELECT d.dept_id
|
|
|
|
FROM sys_dept d
|
|
|
|
INNER JOIN dept_hierarchy dh ON d.parent_id = dh.dept_id
|
2024-09-03 22:09:21 +08:00
|
|
|
)
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
INNER JOIN dept_hierarchy dh ON d.dept_id = dh.dept_id
|
|
|
|
ORDER BY d.dept_id DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectDeviceListByDeptIdList" parameterType="java.util.List" resultMap="BaseResultMap">
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
where d.dept_id in
|
|
|
|
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
|
|
|
|
#{deptId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
</mapper>
|