forked from dyf/fys-Multi-tenant
feat(equipment): 新增高德轨迹服务相关功能与设备终端管理
- 新增 AmapTrackUtil 工具类,封装高德猎鹰轨迹服务 API 调用 - 在 Device 实体中增加高德服务、终端、轨迹 ID 字段(sid, tid, trid) - 新增设备终端分页查询接口 /pageTerminal 及对应实现 - 新增围栏与设备关联实体 DeviceFenceTerminal 及 Mapper - 扩展 DeviceGeoFence 相关注入高德服务及围栏 ID 字段 - 新增添加/删除围栏终端绑定接口及业务逻辑 - 新增轨迹服务模块(TrackService)包括 Controller、Service、BO、DTO 等完整结构 - 在 DeviceMapper.xml 中补充终端相关字段查询及筛选条件 - 新增 TerminalDeviceBo、TerminalDelBo、TerminalQueryBo 等数据传输对象 - 补充设备查询条件支持高德终端状态及服务 ID 过滤 - 新增围栏终端关联表 device_fence_terminal 并注册至菜单配置 - 完善设备分配逻辑以兼容角色权限判断及终端信息展示
This commit is contained in:
@ -43,7 +43,7 @@
|
||||
SELECT
|
||||
da.id AS id, d.id AS deviceId, d.device_name, d.bluetooth_name, d.group_id,
|
||||
d.pub_topic, d.sub_topic, d.device_pic,d.online_status,
|
||||
d.device_mac, d.device_sn, d.update_by,
|
||||
d.device_mac, d.device_sn, d.update_by,d.sid,d.tid,d.trid,
|
||||
d.device_imei, d.update_time, dg.id AS device_type,
|
||||
d.remark, d.binding_status, t.type_name AS typeName,
|
||||
da.assignee_id AS customerId, da.assignee_name AS customerName,
|
||||
@ -86,6 +86,15 @@
|
||||
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||
and da.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||
</if>
|
||||
<if test="criteria.sid != null">
|
||||
and d.sid = #{criteria.sid}
|
||||
</if>
|
||||
<if test="criteria.isTid == true">
|
||||
and d.tid is not null
|
||||
</if>
|
||||
<if test="criteria.isTid == false">
|
||||
and d.tid is null
|
||||
</if>
|
||||
<!-- 管理员可以查看所有设备,普通用户只能查看自己的设备 -->
|
||||
<if test="criteria.isAdmin != true">
|
||||
AND da.assignee_id = #{criteria.currentOwnerId}
|
||||
@ -97,6 +106,46 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 分页查询设备终端 -->
|
||||
<select id="findAllTerminal" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
da.id AS id, d.id AS deviceId, d.device_name, d.bluetooth_name, d.group_id,
|
||||
d.pub_topic, d.sub_topic, d.device_pic,d.online_status,
|
||||
d.device_mac, d.device_sn, d.update_by,d.sid,d.tid,d.trid,
|
||||
d.device_imei, d.update_time, dg.id AS device_type,
|
||||
d.remark, d.binding_status, t.type_name AS typeName, da.create_time AS create_time,
|
||||
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY da.create_time DESC) AS rn
|
||||
FROM device d
|
||||
LEFT JOIN device_type t ON d.device_type = t.id
|
||||
LEFT JOIN device_type_grants dg ON dg.device_type_id = t.id
|
||||
LEFT JOIN device_assignments da ON da.device_id = d.id
|
||||
LEFT JOIN device_fence_terminal dft ON dft.device_id = d.id
|
||||
where d.sid = #{criteria.sid}
|
||||
<!-- 时间范围等其他条件保持原样 -->
|
||||
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
|
||||
and d.device_name like concat('%', TRIM(#{criteria.deviceName}), '%')
|
||||
</if>
|
||||
<if test="criteria.deviceImei != null and criteria.deviceImei.trim() != ''">
|
||||
and d.device_imei like concat('%', TRIM(#{criteria.deviceImei}), '%')
|
||||
</if>
|
||||
<if test="criteria.isTid == true">
|
||||
and dft.fence_id = #{criteria.fenceId}
|
||||
</if>
|
||||
<if test="criteria.isTid == false">
|
||||
and (dft.fence_id is null or dft.fence_id != #{criteria.fenceId})
|
||||
</if>
|
||||
<!-- 管理员可以查看所有设备,普通用户只能查看自己的设备 -->
|
||||
<if test="criteria.isAdmin != true">
|
||||
AND da.assignee_id = #{criteria.currentOwnerId}
|
||||
AND dg.customer_id = #{criteria.currentOwnerId}
|
||||
</if>
|
||||
) AS ranked
|
||||
WHERE rn = 1
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findAllDevices" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
select
|
||||
@ -266,7 +315,7 @@
|
||||
d.binding_status,
|
||||
d.online_status,
|
||||
c.binding_time,
|
||||
d.create_time,
|
||||
d.create_time,d.sid,d.tid,d.trid,
|
||||
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY d.id) AS row_num
|
||||
from device d
|
||||
inner join device_type dt on d.device_type = dt.id
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?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.fuyuanshen.equipment.mapper.DeviceGeoFenceMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user