监测平台系统页面接口的sql修改和新增

breach-zhy
马雪伟 3 months ago
parent 0e2161fd0a
commit 84537fa3ad

@ -175,6 +175,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<update id="updateHwAlarmInfo" parameterType="HwAlarmInfo"> <update id="updateHwAlarmInfo" parameterType="HwAlarmInfo">
update hw_alarm_info update hw_alarm_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -247,6 +249,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id
where hai.alarm_time between #{startTime} and #{endTime} where hai.alarm_time between #{startTime} and #{endTime}
</select> </select>
<select id="selectAlarmInfoExport1" resultType="com.ruoyi.business.domain.VO.AlarmInfoExportVo">
select hai.monitor_unit_id,hai.alarm_info_id,
hai.alarm_time,
hmu.monitor_unit_name,
hal.alarm_level_name,
hat.alarm_type_name,
ha.area_name,
-- hmu.monitor_unit_id,
CASE hmu.monitor_unit_status when 1 then '正常' else '异常' end as monitor_unit_status,
hmu.monitor_unit_type_id,
hmut.monitor_unit_type_name
from hw_alarm_info hai
left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id = hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id = hat.alarm_type_id
left join hw_area ha on ha.area_id = hmu.area_id
left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id
where hai.alarm_time between #{startTime} and #{endTime}
and hai.monitor_unit_id = #{monitorUnitId}
</select>
<select id="selectUnitId" resultType="java.lang.Long">
select distinct monitor_unit_id monitorUnitId from hw_alarm_info
</select>
<update id="updateHwAlarmInfoAllByDevice" parameterType="HwAlarmInfo"> <update id="updateHwAlarmInfoAllByDevice" parameterType="HwAlarmInfo">
update hw_alarm_info update hw_alarm_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">

@ -446,7 +446,7 @@ select a.device_mode_name,sum(a.sum) sum from (select
</select> </select>
<select id="getDeviceByModel" resultType="com.ruoyi.business.domain.HwDevice" <select id="getDeviceByModel" resultType="com.ruoyi.business.domain.HwDevice"
parameterType="java.lang.Long"> parameterType="java.lang.Long">
select * from hw_device where device_mode_id = #{deviceModeId} select * from hw_device where device_mode_id = #{modeId}
</select> </select>
<select id="selectDeviceList" resultMap="TreeDeviceVoResult"> <select id="selectDeviceList" resultMap="TreeDeviceVoResult">

@ -60,4 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{targetId} #{targetId}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteHwFenceTargetByFenceId" parameterType="java.lang.Long">
delete from hw_fence_target where electronic_fence_id in
<foreach item="electronicFenceId" collection="array" open="(" separator="," close=")">
#{electronicFenceId}
</foreach>
</delete>
</mapper> </mapper>

@ -0,0 +1,193 @@
<?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.business.mapper.HwMonitorUnitAttributeDao">
<resultMap type="com.ruoyi.business.domain.HwMonitorUnitAttribute" id="HwMonitorUnitAttributeMap">
<result property="attributeId" column="attribute_id" jdbcType="INTEGER"/>
<result property="monitorUnitId" column="monitor_unit_id" jdbcType="INTEGER"/>
<result property="attributeName" column="attribute_name" jdbcType="VARCHAR"/>
<result property="attributeValue" column="attribute_value" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="HwMonitorUnitAttributeMap">
select
attribute_id, monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time
from hw_monitor_unit_attribute
where attribute_id = #{attributeId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="HwMonitorUnitAttributeMap">
select
attribute_id, monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time
from hw_monitor_unit_attribute
<where>
<if test="attributeId != null">
and attribute_id = #{attributeId}
</if>
<if test="monitorUnitId != null">
and monitor_unit_id = #{monitorUnitId}
</if>
<if test="attributeName != null and attributeName != ''">
and attribute_name = #{attributeName}
</if>
<if test="attributeValue != null and attributeValue != ''">
and attribute_value = #{attributeValue}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from hw_monitor_unit_attribute
<where>
<if test="attributeId != null">
and attribute_id = #{attributeId}
</if>
<if test="monitorUnitId != null">
and monitor_unit_id = #{monitorUnitId}
</if>
<if test="attributeName != null and attributeName != ''">
and attribute_name = #{attributeName}
</if>
<if test="attributeValue != null and attributeValue != ''">
and attribute_value = #{attributeValue}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
</select>
<select id="selectAttributeByUnitId" resultType="com.ruoyi.business.domain.HwMonitorUnitAttribute"
parameterType="java.lang.Long">
select * from hw_monitor_unit_attribute where monitor_unit_id = #{monitorUnitId}
</select>
<select id="selectAttributes" resultType="com.ruoyi.business.domain.HwMonitorUnitAttribute"
parameterType="java.lang.Long">
select * from hw_monitor_unit_attribute where monitor_unit_id = #{unitId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="attributeId" useGeneratedKeys="true">
insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time)
values (#{monitorUnitId}, #{attributeName}, #{attributeValue}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
</insert>
<insert id="insertBatch" keyProperty="attributeId" useGeneratedKeys="true">
insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.monitorUnitId}, #{entity.attributeName}, #{entity.attributeValue}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="attributeId" useGeneratedKeys="true">
insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.monitorUnitId}, #{entity.attributeName}, #{entity.attributeValue}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
on duplicate key update
monitor_unit_id = values(monitor_unit_id),
attribute_name = values(attribute_name),
attribute_value = values(attribute_value),
create_by = values(create_by),
create_time = values(create_time),
update_by = values(update_by),
update_time = values(update_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update hw_monitor_unit_attribute
<set>
<if test="monitorUnitId != null">
monitor_unit_id = #{monitorUnitId},
</if>
<if test="attributeName != null and attributeName != ''">
attribute_name = #{attributeName},
</if>
<if test="attributeValue != null and attributeValue != ''">
attribute_value = #{attributeValue},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where attribute_id = #{attributeId}
</update>
<update id="updateAttributeByUniitId" parameterType="com.ruoyi.business.domain.HwMonitorUnitAttribute">
update hw_monitor_unit_attribute
<set>
<if test="monitorUnitId != null">
monitor_unit_id = #{monitorUnitId},
</if>
<if test="attributeName != null and attributeName != ''">
attribute_name = #{attributeName},
</if>
<if test="attributeValue != null and attributeValue != ''">
attribute_value = #{attributeValue},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where attribute_id = #{attributeId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from hw_monitor_unit_attribute where attribute_id = #{attributeId}
</delete>
<delete id="deleteAttributeByUniitId" parameterType="java.lang.Long">
delete from hw_monitor_unit_attribute where attribute_id = #{attributeId}
</delete>
</mapper>

@ -239,6 +239,11 @@
<if test="monitorUnitField != null">#{monitorUnitField},</if> <if test="monitorUnitField != null">#{monitorUnitField},</if>
</trim> </trim>
</insert> </insert>
<update id="addAttribute">
update hw_monitor_unit
set attribute = #{attribute}
where monitor_unit_id = #{monitorUnitId}
</update>
<update id="updateHwMonitorUnit" parameterType="HwMonitorUnit"> <update id="updateHwMonitorUnit" parameterType="HwMonitorUnit">
update hw_monitor_unit update hw_monitor_unit
@ -347,7 +352,7 @@
select * from hw_monitor_unit select * from hw_monitor_unit
<where> <where>
and monitor_unit_status !=9 and monitor_unit_status !=9
and area_id is not null -- and area_id is not null
<if test="tenantId != null and tenantId != ''"> and tenant_id=#{tenantId}</if> <if test="tenantId != null and tenantId != ''"> and tenant_id=#{tenantId}</if>
</where> </where>
</select> </select>

Loading…
Cancel
Save