|
@@ -3,7 +3,7 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.ems.mapper.EmsDeviceMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="com.ruoyi.ems.domain.EmsDevice" id="EmsDeviceResult">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="deviceCode" column="device_code" />
|
|
@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectEmsDeviceList" parameterType="com.ruoyi.ems.domain.EmsDevice" resultMap="EmsDeviceResult">
|
|
|
<include refid="selectEmsDeviceVo"/>
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="deviceCode != null and deviceCode != ''"> and d.`device_code` = #{deviceCode}</if>
|
|
|
<if test="deviceName != null and deviceName != ''"> and d.`device_name` like concat('%', #{deviceName}, '%')</if>
|
|
|
<if test="deviceType != null "> and d.`device_type` = #{deviceType}</if>
|
|
@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</where>
|
|
|
ORDER BY d.`area_type`, d.`ref_area`
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectEmsDeviceById" parameterType="Long" resultMap="EmsDeviceResult">
|
|
|
<include refid="selectEmsDeviceVo"/>
|
|
|
where d.`id` = #{id}
|
|
@@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="selectEmsDeviceVo"/>
|
|
|
where d.`device_code` = #{code}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertEmsDevice" parameterType="com.ruoyi.ems.domain.EmsDevice" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into adm_ems_device
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -107,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="subsystemCode != null">subsystem_code,</if>
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="areaAncestors !=null">area_ancestors,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
|
@@ -119,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="subsystemCode != null">#{subsystemCode},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="areaAncestors !=null">#{areaAncestors},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -135,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="subsystemCode != null">subsystem_code = #{subsystemCode},</if>
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="areaAncestors !=null">area_ancestors = #{areaAncestors},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
@@ -144,9 +147,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteEmsDeviceByIds" parameterType="String">
|
|
|
- delete from adm_ems_device where id in
|
|
|
+ delete from adm_ems_device where id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-</mapper>
|
|
|
+
|
|
|
+ <select id="selectDevicePath" resultType="String">
|
|
|
+ SELECT
|
|
|
+ <if test="areaType == 'Area'">
|
|
|
+ area.area_code path
|
|
|
+ </if>
|
|
|
+ <if test="areaType == 'Building'">
|
|
|
+ CONCAT( area.area_code, ',', building.bldg_code) path
|
|
|
+ </if>
|
|
|
+ <if test="areaType == 'Zoning'">
|
|
|
+ CONCAT( area.area_code, ',', building.bldg_code, ',', zone.zoning_code ) path
|
|
|
+ </if>
|
|
|
+ FROM
|
|
|
+ adm_service_area area
|
|
|
+ <if test="areaType == 'Building' or areaType == 'Zoning'">
|
|
|
+ INNER JOIN adm_area_building building ON area.area_code = building.area_code
|
|
|
+ </if>
|
|
|
+ <if test="areaType == 'Zoning'">
|
|
|
+ INNER JOIN adm_area_building_zoning zone ON building.bldg_code = zone.bldg_code
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="areaType == 'Area'">
|
|
|
+ area.area_code = #{refArea}
|
|
|
+ </if>
|
|
|
+ <if test="areaType == 'Building'">
|
|
|
+ building.bldg_code = #{refArea}
|
|
|
+ </if>
|
|
|
+ <if test="areaType == 'Zoning'">
|
|
|
+ zone.zoning_code = #{refArea}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+</mapper>
|