105 lines
3.8 KiB
XML
105 lines
3.8 KiB
XML
<?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.central.device.mapper.WaterBoundaryMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.central.device.entity.WaterBoundary">
|
|
<id column="id" property="id" />
|
|
<result column="boundary_id" property="boundaryId" />
|
|
<result column="boundary_name" property="boundaryName" />
|
|
<result column="device_sn" property="deviceSn" />
|
|
<result column="scenic_id" property="scenicId" />
|
|
<result column="tenant_id" property="tenantId" />
|
|
<result column="boundary_type" property="boundaryType" />
|
|
<result column="polygon_data" property="polygonData" />
|
|
<result column="center_point" property="centerPoint" />
|
|
<result column="area" property="area" />
|
|
<result column="source_type" property="sourceType" />
|
|
<result column="model_id" property="modelId" />
|
|
<result column="show_in_model" property="showInModel" />
|
|
<result column="status" property="status" />
|
|
<result column="create_time" property="createTime" />
|
|
<result column="update_time" property="updateTime" />
|
|
<result column="deleted" property="deleted" />
|
|
</resultMap>
|
|
|
|
<!-- 根据边界ID查询 -->
|
|
<select id="selectByBoundaryId" resultMap="BaseResultMap">
|
|
SELECT * FROM water_boundary
|
|
WHERE boundary_id = #{boundaryId}
|
|
AND deleted = 0
|
|
</select>
|
|
|
|
<!-- 根据设备SN查询边界列表 -->
|
|
<select id="selectByDeviceSn" resultMap="BaseResultMap">
|
|
SELECT * FROM water_boundary
|
|
WHERE device_sn = #{deviceSn}
|
|
AND tenant_id = #{tenantId}
|
|
AND deleted = 0
|
|
AND status = 1
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
|
|
<!-- 根据景区ID查询边界列表 -->
|
|
<select id="selectByScenicId" resultMap="BaseResultMap">
|
|
SELECT * FROM water_boundary
|
|
WHERE scenic_id = #{scenicId}
|
|
AND tenant_id = #{tenantId}
|
|
AND deleted = 0
|
|
AND status = 1
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
|
|
<!-- 根据景区ID和边界类型查询 -->
|
|
<select id="selectByScenicIdAndType" resultMap="BaseResultMap">
|
|
SELECT * FROM water_boundary
|
|
WHERE scenic_id = #{scenicId}
|
|
AND boundary_type = #{boundaryType}
|
|
AND tenant_id = #{tenantId}
|
|
AND deleted = 0
|
|
AND status = 1
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
|
|
<!-- 更新边界状态 -->
|
|
<update id="updateStatus">
|
|
UPDATE water_boundary
|
|
SET status = #{status},
|
|
update_time = NOW()
|
|
WHERE boundary_id = #{boundaryId}
|
|
</update>
|
|
|
|
<!-- 根据设备SN重置显示标绘状态(全部不显示) -->
|
|
<update id="resetShowInModelByDeviceSn">
|
|
UPDATE water_boundary
|
|
SET show_in_model = 0,
|
|
update_time = NOW()
|
|
WHERE device_sn = #{deviceSn}
|
|
AND tenant_id = #{tenantId}
|
|
AND deleted = 0
|
|
</update>
|
|
|
|
<!-- 根据设备SN批量设置显示标绘状态(指定ID集合显示) -->
|
|
<update id="setShowInModelByBoundaryIds">
|
|
UPDATE water_boundary
|
|
SET show_in_model = 1,
|
|
update_time = NOW()
|
|
WHERE device_sn = #{deviceSn}
|
|
AND tenant_id = #{tenantId}
|
|
AND deleted = 0
|
|
AND boundary_id IN
|
|
<foreach collection="boundaryIds" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 根据3D模型ID查询关联边界 -->
|
|
<select id="selectByModelId" resultMap="BaseResultMap">
|
|
SELECT * FROM water_boundary
|
|
WHERE model_id = #{modelId}
|
|
AND deleted = 0
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
|
|
</mapper>
|