监测平台系统页面接口的sql修改和新增
parent
0e2161fd0a
commit
84537fa3ad
@ -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>
|
||||
|
Loading…
Reference in New Issue