ソースを参照

pgsql适配改造

tianye 2 年 前
コミット
36b43cf0bc

+ 1 - 1
warning-web/src/main/resources/mappers-postgresql/AlarmCountMapper.xml

@@ -73,7 +73,7 @@
         <where>
         1=1
             <if test="startdate !=null and enddate !=null">
-                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+                and a.alarmdate &gt;= #{startdate} and a.alarmdate &lt;= #{enddate}
             </if>
             <if test="stationid !=null and stationid !=''">
                 and ss.stationid=#{stationid}

+ 0 - 9
warning-web/src/main/resources/mappers-postgresql/AlarmHistoryMapper.xml

@@ -150,15 +150,6 @@
             and alerttime &gt;= #{starttime,jdbcType=DATE} and alerttime &lt; #{endtime,jdbcType=DATE}
     </select>
 
-    <select id="selectAlarmSnapCount" parameterType="java.util.Map" resultType="java.lang.Integer">
-        select count(*) from ${tbName} where id = #{id}
-    </select>
-
-    <select id="selectAlarmHistory" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmHistory">
-        select * from ${tbName} where snapid = #{snapid}
-                                  and messagetype = '1'
-                                  and alerttime &gt;= #{starttime,jdbcType=DATE} and alerttime &lt; #{endtime,jdbcType=DATE}
-    </select>
 
     <select id="selectHistoryAlarmSnapAndWarning"
             resultType="com.gyee.wisdom.alarm.sharding.entity.FaultWarning">

+ 0 - 14
warning-web/src/main/resources/mappers-postgresql/AlarmPartsCountMapper.xml

@@ -1,14 +0,0 @@
-<?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.AlarmPartsCountMapper">
-
-    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
-        insert into alarmpartscount ( ID, alarmdate, parts,count,windturbineid )
-        <foreach collection="list" item="item" index="index" separator="union all" >
-            ( select
-            #{item.id}, #{item.alarmDate},#{item.parts},#{item.count},#{item.windturbineId}
-            from dual )
-        </foreach>
-    </insert>
-
-</mapper>

+ 0 - 14
warning-web/src/main/resources/mappers-postgresql/AlarmRuleCountMapper.xml

@@ -1,14 +0,0 @@
-<?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.AlarmRuleCountMapper">
-
-    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
-        insert into alarmrulecount ( ID, alarmdate, parts,rulesid,count,windturbineid)
-        <foreach collection="list" item="item" index="index" separator="union all" >
-            ( select
-            #{item.id}, #{item.alarmDate},#{item.parts},#{item.rulesId},#{item.count},#{item.windturbineId}
-            from dual )
-        </foreach>
-    </insert>
-
-</mapper>

+ 5 - 30
warning-web/src/main/resources/mappers-postgresql/Alertrule2Mapper.xml

@@ -62,7 +62,7 @@
     </resultMap>
 
     <select id="pageQueryAll" parameterType="java.util.Map" resultMap="alertRule2ResultToPostgreSql">
-        select a.*, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a
+        select a.*, (case a.enabled   WHEN 't' then 1  when 'f' then 0  else 0 end) as specialenable from ALERTRULE2 a
         left join windpowerstation w on w.id = a.station
         <where>
             1=1
@@ -90,9 +90,6 @@
                     and a.enabled = false
                 </if>
             </if>
-            <if test="relatedParts !=null and relatedParts !=''">
-                and a.relatedparts = #{relatedParts}
-            </if>
 
             <!--            and a.range = 0-->
         </where>
@@ -112,22 +109,8 @@
             </if>
         </where>
     </select>
-    <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
-            resultMap="alertRule2ResultToPostgreSql">
-        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a
-        <where>
-            1=1
-            <if test="station !=null and station !=''">
-                and a.station = #{station}
-            </if>
-            <if test="modelid !=null and modelid !=''">
-                and a.modelid = #{modelid}
-            </if>
-            and a.enabled = true
-        </where>
-    </select>
     <select id="getById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a
+        select * from ALERTRULE2 a
         <where>
             1=1
             <if test="idString !=null and idString !=''">
@@ -136,13 +119,6 @@
         </where>
     </select>
 
-    <select id="selectListAll" parameterType="java.util.Map" resultMap="alertRule2ResultToPostgreSql">
-        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a
-        <where>
-            enabled = true
-        </where>
-    </select>
-
     <select id="quertByrelatedParts" resultType="java.util.HashMap">
         select a.name from ALERTRULE2 a
         where a.relatedparts = #{relatedParts}
@@ -241,12 +217,11 @@
 
 
     <select id="selectByAlertrule2Id" resultMap="alertRule2ResultToPostgreSql">
-        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a where
-        a.id=#{id}
+        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a where a.id=#{id}
     </select>
 
     <select id="selectByNameAndSataionAndModelid" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select *, (case a.enabled WHEN 't' then 1 when 'f' then 0 else 0 end) as specialenable from ALERTRULE2 a
+        select * from alertrule2 a
         <where>
             1=1
             <if test="name !=null and name !=''">
@@ -325,4 +300,4 @@
             </foreach>
         </where>
     </sql>
-</mapper>
+</mapper>