123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?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.gyee.wisdom.alarm.sharding.mapper.AlarmSnapMapper">
- <select id="queryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ALARMSNAP a
- <where>
- 1=1
- <if test="starttime !=null and endtime !=null">
- and lastupdatetime >= #{starttime,jdbcType=DATE} and lastupdatetime <= #{endtime,jdbcType=DATE}
- </if>
- <if test="stid !=null and stid !=''">
- and a.stationid=#{stid}
- </if>
- <if test="wtid !=null and wtid !=''">
- and a.windturbineid=#{wtid}
- </if>
- <if test="category1 !=null and category1 !=''">
- and a.category1=#{category1}
- </if>
- <if test="category2 !=null and category2 !=''">
- and a.category2=#{category2}
- </if>
- <if test="rank !=null and rank !=''">
- and a.rank=#{rank}
- </if>
- <if test="modelid !=null and modelid !=''">
- and a.modelid=#{modelid}
- </if>
- <if test="isopened !=null ">
- and a.isopened=#{isopened}
- </if>
- <if test="keyword !=null and keyword !=''">
- and a.alerttext like #{keyword}
- </if>
- </where>
- order by a.lastupdatetime desc
- </select>
- <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ALARMSNAP a
- <where>
- 1=1
- <if test="starttime !=null and endtime !=null">
- and lastupdatetime >= #{starttime,jdbcType=DATE} and lastupdatetime <= #{endtime,jdbcType=DATE}
- </if>
- <if test="stid !=null and stid !=''">
- and a.stationid=#{stid}
- </if>
- <if test="wtid !=null and wtid !=''">
- and a.windturbineid=#{wtid}
- </if>
- <if test="category1 !=null and category1 !=''">
- and a.category1=#{category1}
- </if>
- <if test="category2 !=null and category2 !=''">
- and a.category2=#{category2}
- </if>
- <if test="rank !=null and rank !=''">
- and a.rank=#{rank}
- </if>
- <if test="modelid !=null and modelid !=''">
- and a.modelid=#{modelid}
- </if>
- <if test="isopened !=null ">
- and a.isopened=#{isopened}
- </if>
- <if test="keyword !=null and keyword !=''">
- and a.alerttext like #{keyword}
- </if>
- </where>
- order by a.lastupdatetime desc
- </select>
- <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
- insert into alarmsnap ( ID, STATIONID, PROJECTID, LINEID, WINDTURBINEID, ALERTVALUE, CATEGORY1, CATEGORY2, CATEGORY3, RANK, ISOPENED, LASTUPDATETIME, STATIONNAME, PROJECTNAME, LINENAME, WINDTURBINENAME, ALERTTEXT, MODELID, TESTINGPOINTKEY, DATAINFO )
- <foreach collection="list" item="item" index="index" separator="union all" >
- ( select
- #{item.id},#{item.stationId},#{item.projectId},#{item.lineId},#{item.windturbineId},
- #{item.alertValue},#{item.category1},#{item.category2},#{item.category3},#{item.rank},
- #{item.isOpened},#{item.lastUpdateTime},#{item.stationName},#{item.projectName},
- #{item.lineName},#{item.windturbineName},#{item.alertText},#{item.modelId},
- #{item.testingpointKey},#{item.dataInfo}
- from dual )
- </foreach>
- </insert>
- <!--<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">-->
- <!--INSERT ALL-->
- <!--<foreach item="item" index="index" collection="list">-->
- <!--into alarmsnap ( ID, STATIONID, PROJECTID, LINEID, WINDTURBINEID, ALERTVALUE, CATEGORY1, CATEGORY2, CATEGORY3, RANK, ISOPENED, LASTUPDATETIME, STATIONNAME, PROJECTNAME, LINENAME, WINDTURBINENAME, ALERTTEXT, MODELID, TESTINGPOINTKEY, DATAINFO )-->
- <!--values-->
- <!--( #{item.id},#{item.stationId},#{item.projectId},#{item.lineId},#{item.windturbineId},-->
- <!--#{item.alertValue},#{item.category1},#{item.category2},#{item.category3},#{item.rank},-->
- <!--#{item.isOpened},#{item.lastUpdateTime},#{item.stationName},#{item.projectName},-->
- <!--#{item.lineName},#{item.windturbineName},#{item.alertText},#{item.modelId},-->
- <!--#{item.testingpointKey},#{item.dataInfo} )-->
- <!--</foreach>-->
- <!--SELECT 1 FROM DUAL-->
- <!--</insert>-->
- <update id="batchUpdate" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
- UPDATE alarmsnap
- <set>
- ISOPENED = #{item.isOpened},
- LASTUPDATETIME = #{item.lastUpdateTime},
- CATEGORY3=#{item.category3},
- DATAINFO = #{item.dataInfo}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <select id="findByStationIdAndAlertValue" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ALARMSNAP a
- <where>
- a.stationid=#{stationid} and a.alertvalue = #{alertvalue} and rownum = 1
- </where>
- </select>
- <select id="findByWindturbineIdAndAlertValue" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ALARMSNAP a
- <where>
- a.windturbineid=#{windturbineid} and a.alertvalue = #{alertvalue} and rownum = 1
- </where>
- </select>
- <select id="findByTestingpointkey" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ALARMSNAP a
- <where>
- a.testingpointkey=#{testingpointkey} and rownum = 1
- </where>
- </select>
- <select id="getTopNumAlarm" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- select * from ( select * from alarmsnap h order by h.lastupdatetime desc)
- where category1 = #{category1} and rownum <= #{topnum}
- </select>
- <select id="getRecentAlarm" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
- SELECT * FROM alarmsnap
- WHERE category1 = #{category1} and lastupdatetime >= #{lastupdatetime}
- order by lastupdatetime desc
- </select>
- </mapper>
|