Переглянути джерело

1.修复windturbinenew 中清除缓存不彻底问题
2.预警产品warning-web添加postgresql支持
3.添加mapper-postgresql 外置xml

wanghs 2 роки тому
батько
коміт
591296dfab
45 змінених файлів з 2143 додано та 62 видалено
  1. 1 0
      alarm/windturbinenew/src/main/java/com/gyee/wisdom/alarm/windturbine/service/CacheService.java
  2. 3 2
      gradle.properties
  3. 5 2
      warning-web/build.gradle
  4. 47 47
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/InterceptorConfig.java
  5. 32 2
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmSnapService.java
  6. 13 9
      warning-web/src/main/resources/application.yaml
  7. 135 0
      warning-web/src/main/resources/mappers-postgresql/AlarmCountMapper.xml
  8. 227 0
      warning-web/src/main/resources/mappers-postgresql/AlarmHistoryMapper.xml
  9. 137 0
      warning-web/src/main/resources/mappers-postgresql/AlarmSnapMapper.xml
  10. 35 0
      warning-web/src/main/resources/mappers-postgresql/AlarmUserMapper.xml
  11. 9 0
      warning-web/src/main/resources/mappers-postgresql/AlertKnowledge.xml
  12. 263 0
      warning-web/src/main/resources/mappers-postgresql/Alertrule2Mapper.xml
  13. 16 0
      warning-web/src/main/resources/mappers-postgresql/DatadictionaryMapper.xml
  14. 56 0
      warning-web/src/main/resources/mappers-postgresql/DeviceFaultModeMapper.xml
  15. 10 0
      warning-web/src/main/resources/mappers-postgresql/DeviceMapper.xml
  16. 117 0
      warning-web/src/main/resources/mappers-postgresql/DeviceMetricsMapper.xml
  17. 34 0
      warning-web/src/main/resources/mappers-postgresql/DeviceModelMapper.xml
  18. 54 0
      warning-web/src/main/resources/mappers-postgresql/DeviceModelMetricsMapper.xml
  19. 48 0
      warning-web/src/main/resources/mappers-postgresql/DeviceStructureMapper.xml
  20. 18 0
      warning-web/src/main/resources/mappers-postgresql/EarlyWarnScoreMapper.xml
  21. 17 0
      warning-web/src/main/resources/mappers-postgresql/ElectricalTestingPointAIMapper.xml
  22. 17 0
      warning-web/src/main/resources/mappers-postgresql/ElectricalTestingPointDIMapper.xml
  23. 10 0
      warning-web/src/main/resources/mappers-postgresql/EquipmentmodelMapper.xml
  24. 44 0
      warning-web/src/main/resources/mappers-postgresql/FaultHistoryMapper.xml
  25. 122 0
      warning-web/src/main/resources/mappers-postgresql/FaultInfoMapper.xml
  26. 74 0
      warning-web/src/main/resources/mappers-postgresql/FaultSnapMapper.xml
  27. 35 0
      warning-web/src/main/resources/mappers-postgresql/FaultStatisticWindturbineMapper.xml
  28. 36 0
      warning-web/src/main/resources/mappers-postgresql/FeatureStatMapper.xml
  29. 15 0
      warning-web/src/main/resources/mappers-postgresql/MainBrownouts2Mapper.xml
  30. 17 0
      warning-web/src/main/resources/mappers-postgresql/RuleUpdateEvent.xml
  31. 14 0
      warning-web/src/main/resources/mappers-postgresql/RuleUpdateEventInfo.xml
  32. 29 0
      warning-web/src/main/resources/mappers-postgresql/ScadabjMapper.xml
  33. 8 0
      warning-web/src/main/resources/mappers-postgresql/ScadafaultMapper.xml
  34. 54 0
      warning-web/src/main/resources/mappers-postgresql/ShutdownEventMapper.xml
  35. 37 0
      warning-web/src/main/resources/mappers-postgresql/StopTypeMapper.xml
  36. 35 0
      warning-web/src/main/resources/mappers-postgresql/TestingPointAIMapper.xml
  37. 50 0
      warning-web/src/main/resources/mappers-postgresql/TestingPointDIMapper.xml
  38. 34 0
      warning-web/src/main/resources/mappers-postgresql/Warning2Mapper.xml
  39. 8 0
      warning-web/src/main/resources/mappers-postgresql/WarningClassify.xml
  40. 8 0
      warning-web/src/main/resources/mappers-postgresql/WarningTypeMapper.xml
  41. 29 0
      warning-web/src/main/resources/mappers-postgresql/WindPowerStationMapper.xml
  42. 34 0
      warning-web/src/main/resources/mappers-postgresql/WindTurbineTestingPointAiMapper.xml
  43. 33 0
      warning-web/src/main/resources/mappers-postgresql/WindTurbineTestingPointDiMapper.xml
  44. 114 0
      warning-web/src/main/resources/mappers-postgresql/WindturbineMapper.xml
  45. 9 0
      warning-web/src/main/resources/mappers-postgresql/WindturbinePartsMapper.xml

+ 1 - 0
alarm/windturbinenew/src/main/java/com/gyee/wisdom/alarm/windturbine/service/CacheService.java

@@ -211,6 +211,7 @@ public class CacheService {
         this.windturbineInfoMap = null;
         this.tagMap = null;
         this.keysList = null;
+        this.warningMap=null;
         log.warn("缓存数据清空!");
     }
 }

+ 3 - 2
gradle.properties

@@ -31,9 +31,10 @@ cassandraVersion=3.0.0
 hbaseVersion=1.2.0-cdh5.16.2
 hadoopVersion=2.6.0-cdh5.16.2
 mysqlConnectorVersion=8.0.28
-log4jVersion=2.17.1
+log4jVersion=2.17.2
 fastjsonVersion=1.2.58
 commonsBeanUtilsVersion=1.9.4
 alibabaDruidVersion=1.2.9
 groovyVersion=3.0.9
-openFeignVersion=11.8
+openFeignVersion=11.8
+postgresqlDriverVersion=42.4.0

+ 5 - 2
warning-web/build.gradle

@@ -22,7 +22,11 @@ dependencies {
 
     implementation project(":common:utils")
 
-    //implementation fileTree(dir: "src/main/lib", include: "*.jar")
+    implementation fileTree(dir: "src/main/lib", include: "*.jar")
+    //implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+    //implementation ("org.postgresql:postgresql:$postgresqlDriverVersion")
+
+
     implementation("org.apache.commons:commons-lang3:$commonsLang3Version")
     implementation("$bootGroup:spring-boot-starter-web"){
         exclude group:"org.springframework.boot:spring-boot-starter-json"
@@ -34,7 +38,6 @@ dependencies {
     implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
     implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
     implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
-    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
     implementation ("com.alibaba:druid:$alibabaDruidVersion")
     implementation ("com.alibaba:fastjson:$fastjsonVersion")
 

+ 47 - 47
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/InterceptorConfig.java

@@ -1,47 +1,47 @@
-//package com.gyee.wisdom.alarm.sharding.config;
-//
-//import com.gyee.wisdom.alarm.sharding.filter.LoginInterceptor;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.web.bind.annotation.ControllerAdvice;
-//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-//
-///**
-// * @descrition:
-// * @author:Wanghs
-// * @date:2020-05-21
-// */
-//@Configuration
-//public class InterceptorConfig implements WebMvcConfigurer {
-//
-//    @Bean
-//    LoginInterceptor loginInterceptor() {
-//        return new LoginInterceptor();
-//    }
-//
-//    /**
-//     * @Function: 配置生成器:添加一个拦截器,拦截路径为login以后的路径
-//     * @author: YangXueFeng
-//     * @Date: 2019/4/14 13:10
-//     */
-//    @Override
-//    public void addInterceptors(InterceptorRegistry registry) {
-//        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login",
-//                "/register",
-//                "/static",
-//                "/swagger**/**",
-//                "/swagger-ui.html",
-//                "/swagger-ui/**",
-//                "/swagger-resources/**",
-//                "/v2/api-docs",
-//                "/v3/api-docs",
-//                "/v3/api-docs/swagger-config",
-//                "/webjars/**",
-//                "/doc.html",
-//                "/**/api-docs/**"
-//        );
-//
-//    }
-//
-//}
+package com.gyee.wisdom.alarm.sharding.config;
+
+import com.gyee.wisdom.alarm.sharding.filter.LoginInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2020-05-21
+ */
+@Configuration
+public class InterceptorConfig implements WebMvcConfigurer {
+
+    @Bean
+    LoginInterceptor loginInterceptor() {
+        return new LoginInterceptor();
+    }
+
+    /**
+     * @Function: 配置生成器:添加一个拦截器,拦截路径为login以后的路径
+     * @author: YangXueFeng
+     * @Date: 2019/4/14 13:10
+     */
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login",
+                "/register",
+                "/static",
+                "/swagger**/**",
+                "/swagger-ui.html",
+                "/swagger-ui/**",
+                "/swagger-resources/**",
+                "/v2/api-docs",
+                "/v3/api-docs",
+                "/v3/api-docs/swagger-config",
+                "/webjars/**",
+                "/doc.html",
+                "/**/api-docs/**"
+        );
+
+    }
+
+}

+ 32 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmSnapService.java

@@ -416,7 +416,7 @@ public class AlarmSnapService extends ServiceImpl<AlarmSnapMapper, AlarmSnap> {
 
                     //以当前时间向前推14天
                     Date dtEnd = new Date();
-                    Date dtStart = DateUtil.addDays(dtEnd, -14);
+                    Date dtStart = DateUtil.addDays(dtEnd, -3);
                     List<String> yearMonthList = tableNameService.getYearAndMonthList(dtStart, dtEnd);
 
 
@@ -444,7 +444,37 @@ public class AlarmSnapService extends ServiceImpl<AlarmSnapMapper, AlarmSnap> {
                                 list.add(alarmHistory);
                             }
                         }
-                    }
+
+
+                        }
+//
+//                    List<AlarmHistory> historyList=new ArrayList<>();
+//
+//                    Map<String, List<AlarmSnap>> collectMap = collect.stream().collect(Collectors.groupingBy(AlarmSnap::getStationId));
+//                    if(yearMonthList.size()>1){
+//                        for (int j = 0; j < yearMonthList.size(); j++) {
+//                            for (Map.Entry<String,List<AlarmSnap>> entry:
+//                                 collectMap.entrySet()) {
+//                                String tbName = "ALARMHISTORY_" + entry.getValue().get(0).getStationId().split("_")[0] + "_" + yearMonthList.get(j);
+//                                List<Long> snapIdList = entry.getValue().stream().map(s -> s.getId()).collect(Collectors.toList());
+//                                //获取触发的历史流水 messageType=1
+//                                List<AlarmHistory> lst = alarmHisotryMapper.getlatestAlarmHistory(tbName, snapIdList, "1", dtStart, dtEnd);
+//                                list.addAll(lst);
+//                            }
+//
+//
+//                        }
+//
+//                    }else{
+//                        for (Map.Entry<String,List<AlarmSnap>> entry:
+//                                collectMap.entrySet()) {
+//                            String tbName = "ALARMHISTORY_" + entry.getValue().get(0).getStationId().split("_")[0] + "_" + yearMonthList.get(0);
+//                            List<Long> snapIdList = entry.getValue().stream().map(s -> s.getId()).collect(Collectors.toList());
+//                            //获取触发的历史流水 messageType=1
+//                            List<AlarmHistory> lst = alarmHisotryMapper.getlatestAlarmHistory(tbName, snapIdList, "1", dtStart, dtEnd);
+//                            list.addAll(lst);
+//                        }
+//                    }
                     for (AlarmHistory history :
                             list) {
                         Optional<AlarmSnap> first = topNumAlarm.stream().filter(s -> s.getId().equals(history.getSnapId())).findFirst();

+ 13 - 9
warning-web/src/main/resources/application.yaml

@@ -16,14 +16,18 @@ spring:
       charset: UTF-8
       enabled: true
   datasource:
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
-    username: root
-    password: gyeepd@123
-#    driver-class-name: oracle.jdbc.OracleDriver
-#    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
-#    username: nxfdprod
-#    password: gdnxfd123
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+#    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
+#    username: root
+#    password: gyeepd@123
+#    driver-class-name: org.postgresql.Driver
+#    url: jdbc:postgresql://123.60.219.66:5432/wisdom_cs
+#    username: postgres
+#    password: gyeepd@123
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@10.83.68.165:1521:gdsj
+    username: gdprod
+    password: gd123
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       max-active: 20
@@ -67,7 +71,7 @@ mybatis-plus:
   configuration:
     #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
     map-underscore-to-camel-case: true
-    cache-enabled: false
+    cache-enabled: true
     #配置JdbcTypeForNull, oracle数据库必须配置
     jdbc-type-for-null: 'null'
     callSettersOnNulls: true

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

@@ -0,0 +1,135 @@
+<?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.AlarmCountMapper">
+
+    <insert id="singleInsert" >
+        insert into alarmcount (id, alarmdate, snapid, count)
+        values
+        (#{item.id}, #{item.alarmdate}, #{item.snapId}, #{item.count})
+    </insert>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into alarmcount ( ID, alarmdate, snapid, count,time )
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alarmDate}, #{item.snapId}, #{item.count} ,#{item.time}
+            from dual )
+        </foreach>
+    </insert>
+
+
+
+    <select id="selectAlarmHistoryBySnapid" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmHistory"  >
+             select * from ${alarmhistory} where snapid = #{snapid}
+             and alerttime &gt;= #{startdate,jdbcType=DATE} and alerttime &lt; #{enddate,jdbcType=DATE} order by alerttime asc
+    </select>
+
+
+
+
+    <select id="statAlarmCount1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1"  >
+        select t.*, s.stationid, s.windturbineid, s.alerttext from (
+            select snapid, sum(count) as count,sum(time) time from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+            where ss.stationid = #{stationid} and ss.windturbineid is not null
+            and alarmdate &gt;= #{startdate,jdbcType=DATE} and alarmdate &lt; #{enddate,jdbcType=DATE}
+            group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCount5" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1"  >
+        select * from alarmcount a
+            LEFT JOIN alarmsnap s on a.snapid = s.id
+        <where>
+            1=1
+            <if test="startdate !=null and enddate !=null">
+                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+            </if>
+            <if test="stationid !=null and stationid !=''">
+                and s.stationid=#{stationid}
+            </if>
+            <if test="windturbineid !=null and windturbineid !=''">
+                and s.windturbineid=#{windturbineid}
+            </if>
+        </where>
+    </select>
+
+    <select id="statAlarmCount" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.snapid, t.count as sum, t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+        select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+        left join alarmsnap ss on a.snapid = ss.id
+        where ss.stationid = #{stationid} and ss.windturbineid is not null
+        and alarmdate >= #{startdate,jdbcType=DATE} and alarmdate &lt;= #{enddate,jdbcType=DATE}
+        group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCount3" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.snapid, t.count as sum, t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+            select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+        <where>
+        1=1
+            <if test="startdate !=null and enddate !=null">
+                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+            </if>
+            <if test="stationid !=null and stationid !=''">
+                and ss.stationid=#{stationid}
+            </if>
+            <if test="windturbineid !=null and windturbineid !=''">
+                and ss.windturbineid=#{windturbineid}
+            </if>
+        </where>
+            group by snapid ) t
+            left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCountByName" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.count as sum,t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+        select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+        left join alarmsnap ss on a.snapid = ss.id
+        where ss.alerttext=#{name} and ss.stationid = #{stationid} and ss.windturbineid is not null
+        and alarmdate >= #{startdate,jdbcType=DATE} and alarmdate &lt;= #{enddate,jdbcType=DATE}
+        group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="selectAlertRuleNames" resultType="com.gyee.wisdom.alarm.sharding.model.CodeValue" >
+        select name as code, description as value from alertrule2 group by name, description
+    </select>
+
+
+    <select id="statAlarmCount2" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1">
+        select t.*, s.stationid, s.windturbineid, s.alerttext from (
+            select snapid, sum(count) as count,sum(time) time from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+            where
+            ss.windturbineid is not null
+            and a.alarmdate &gt;= #{currentDate,jdbcType=DATE}
+            <if test="stationid !=null and stationid !=''">
+                and  ss.stationid = #{stationid}
+            </if>
+            group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="getAlarmCountInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmCountInfo">
+        SELECT
+            a.id, a.alarmdate,a.snapid,a.count, a.time,
+            s.ALERTTEXT, s.WINDTURBINEID, s.RANK,
+            r.id as alertruleid, r.relatedParts, r.PROJECT
+        FROM
+            alarmcount a
+        LEFT JOIN alarmsnap s ON a.snapid = s.id
+        LEFT JOIN alertrule2 r ON s.ALERTVALUE = r.ednaValue
+        WHERE
+            a.alarmdate = #{currentDate}
+        AND s.windturbineid = #{windturbineid}
+    </select>
+
+</mapper>

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

@@ -0,0 +1,227 @@
+<?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.AlarmHisotryMapper">
+
+    <insert id="singleInsert" >
+        insert into ${tbName} (id, alerttime, messagetype,snapid, datainfo)
+        values
+        (#{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo})
+    </insert>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into ${tbName} ( ID, ALERTTIME, MESSAGETYPE, SNAPID, DATAINFO,ALERTTEXTLAST)
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo},#{item.alertTextLast}
+            from dual )
+        </foreach>
+    </insert>
+
+    <!--<insert id="batchInsert" useGeneratedKeys="false">-->
+        <!--INSERT ALL-->
+        <!--<foreach item="item" index="index" collection="list">-->
+            <!--into ${tbName}-->
+            <!--values-->
+            <!--(#{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo})-->
+        <!--</foreach>-->
+        <!--SELECT 1 FROM DUAL-->
+    <!--</insert>-->
+
+    <!-- 单表查询 -->
+    <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        select a.*,
+        b.stationid,
+        b.windturbineid,
+        b.projectid,
+        b.lineid,
+        b.alertvalue,
+        b.category1,
+        b.category2,
+        b.category3,
+        b.rank,
+        b.stationname,
+        b.projectname,
+        b.linename,
+        b.windturbinename,
+        b.alerttext,
+        b.modelid
+        from ${tbName} a
+        left join alarmsnap b on a.snapid = b.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime} and a.alerttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and b.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and b.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and b.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and b.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and b.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and b.modelid=#{modelid}
+            </if>
+            <if test="snapid !=null ">
+                and a.snapid=#{snapid}
+            </if>
+            <if test="messagetype !=null ">
+                and a.messagetype=#{messagetype}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and b.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.alerttime  desc
+    </select>
+
+
+    <!-- 联合查询 -->
+    <select id="pageQueryAll2" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        select a.*,
+        b.stationid,
+        b.windturbineid,
+        b.projectid,
+        b.lineid,
+        b.alertvalue,
+        b.category1,
+        b.category2,
+        b.category3,
+        b.rank,
+        b.stationname,
+        b.projectname,
+        b.linename,
+        b.windturbinename,
+        b.alerttext,
+        b.modelid
+        from (
+        <foreach collection="simpleStationIdList" item="station" index="index" separator="union">
+            select * from alarmhistory_${station}_${yearmonth}
+        </foreach>
+        ) a
+        left join alarmsnap b on a.snapid = b.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime,jdbcType=DATE} and a.alerttime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and b.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and b.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and b.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and b.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and b.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and b.modelid=#{modelid}
+            </if>
+            <if test="snapid !=null ">
+                and a.snapid=#{snapid}
+            </if>
+            <if test="messagetype !=null ">
+                and a.messagetype=#{messagetype}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and b.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.alerttime  desc
+    </select>
+
+    <select id="selectSnapCount" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select count(*) 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">
+
+        select h.id,
+        a.stationid,
+        h.snapid,
+        a.windturbineid,
+        a.windturbinename,
+        a.lastupdatetime,
+        w.ednavalue,
+        h.alerttime,
+        w.warningtypeid
+        from ${tbName} h
+        left join alarmsnap a on h.snapid = a.id
+        left join warning2 w on a.alertvalue = w.ednavalue
+        and a.modelid = w.modelid
+        <where>
+            and a.category1 = 'windturbine'
+            and h.messagetype = '1'
+            and
+            <if test="starttime !=null and endtime !=null">
+                h.alerttime  &gt;= #{starttime,jdbcType=DATE} and h.alerttime  &lt; #{endtime,jdbcType=DATE}
+            </if>
+        </where>
+
+
+    </select>
+
+    <update id="timedCreatTable">
+        CREATE TABLE alarmhistory_${stationname}_${yearmonth} (
+                                                   `ID` decimal(65,0) NOT NULL,
+                                                   `ALERTTIME` datetime(6) NOT NULL,
+                                                   `MESSAGETYPE` char(1) NOT NULL,
+                                                   `SNAPID` decimal(65,0) NOT NULL,
+                                                   `DATAINFO` text,
+                                                   `ALERTTEXTLAST` varchar(50)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+    </update>
+    <update id="timedAlterTable">
+        alter table alarmhistory_${stationname}_${yearmonth}
+            add primary key (`id`)
+    </update>
+    <update id="timedCreatAlerttimeIndex">
+        create index IX_AH_${stationname}_${yearmonth}_ALARMTIME on alarmhistory_${stationname}_${yearmonth} (alerttime)
+    </update>
+    <update id="timedCreatSnapidIndex">
+        create index IX_AH_${stationname}_${yearmonth}_SNAPID on alarmhistory_${stationname}_${yearmonth} (snapid)
+    </update>
+    <select id="isHasTable" resultType="java.lang.Integer">
+        select count(*) from information_schema.TABLES where table_name =upper('ALARMHISTORY_${stationname}_${yearmonth}')
+    </select>
+
+    <select id="getlatestAlarmHistory" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        SELECT * FROM  ${tbName} a
+        <where>
+<!--            <if test="snapId !=null and snapId !=''">-->
+<!--                and a.SNAPID=#{snapId}-->
+<!--            </if>-->
+            <if test="snapIdList!=null and snapIdList.size()>0">
+                a.SNAPID in
+                <foreach item="item" index="index" collection="snapIdList" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="messageType !=null and messageType !=''">
+                and a.MESSAGETYPE=#{messageType}
+            </if>
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime,jdbcType=DATE} and a.alerttime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+        </where>
+        order by a.ALERTTIME DESC LIMIT 0 OFFSET 1
+    </select>
+</mapper>

+ 137 - 0
warning-web/src/main/resources/mappers-postgresql/AlarmSnapMapper.xml

@@ -0,0 +1,137 @@
+<?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 &gt;= #{starttime,jdbcType=DATE} and lastupdatetime &lt;= #{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 &gt;= #{starttime,jdbcType=DATE} and lastupdatetime &lt;= #{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>
+
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            UPDATE ALARMSNAP
+            <set>
+                <if test="item.isOpened != null">ISOPENED = #{item.isOpened}</if>
+                <if test="item.lastUpdateTime != null">,LASTUPDATETIME = #{item.lastUpdateTime}</if>
+                <if test="item.category3 != null">,CATEGORY3 = #{item.category3}</if>
+                <if test="item.dataInfo != null">,DATAINFO = #{item.dataInfo}</if>
+            </set>
+            <where>
+                <if test="item.id != null">
+                    and id = #{item.id}
+                </if>
+            </where>
+        </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}  limit 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}  limit  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}  limit  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) t
+        where t.category1 = #{category1}  limit 0 OFFSET #{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>

+ 35 - 0
warning-web/src/main/resources/mappers-postgresql/AlarmUserMapper.xml

@@ -0,0 +1,35 @@
+<?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.AlarmUserMapper">
+
+    <select id="login" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+        <where>
+            1=1
+            <if test="userName !=null and userName !=''">
+                and a.username=#{userName}
+            </if>
+            <if test="passWord !=null and passWord !=''">
+                and a.password=#{passWord}
+            </if>
+        </where>
+    </select>
+
+    <select id="getUserByUserName" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+        <where>
+            1=1
+            <if test="userName !=null and userName !=''">
+                and a.username=#{userName}
+            </if>
+
+        </where>
+    </select>
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+    </select>
+
+    <delete id="deleteByIds" parameterType="String">
+        delete from ALARM_USER where id = #{id}
+    </delete>
+</mapper>

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

@@ -0,0 +1,9 @@
+<?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.AlertKnowledgeMapper">
+
+
+    <select id="searchAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlertKnowledge">
+        select * from  ALERT_KNOWLEDGE a
+    </select>
+</mapper>

+ 263 - 0
warning-web/src/main/resources/mappers-postgresql/Alertrule2Mapper.xml

@@ -0,0 +1,263 @@
+<?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.Alertrule2Mapper">
+    <resultMap id="BaseResultMap" type="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        <id column="id" property="id" />
+        <result column="name"  property="name" />
+        <result column="description"  property="description" />
+        <result column="expression"  property="expression" />
+        <result column="rank"  property="rank" />
+        <result column="rank"  property="rank" />
+        <result column="enabled"  property="enabled" />
+        <result column="modelId"  property="modelId" />
+        <result column="ednaValue"  property="ednaValue" />
+        <result column="category"  property="category" />
+        <result column="range"  property="range" />
+        <result column="station"  property="station" />
+        <result column="windturbine"  property="windturbine" />
+        <result column="line"  property="line" />
+        <result column="project"  property="project" />
+        <result column="electrical"  property="electrical" />
+        <result column="taskstart"  property="taskstart" />
+        <result column="relatedParts"  property="relatedParts" />
+    </resultMap>
+    <resultMap type="Alertrule2" id="Alertrule2Result">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="station"    column="station"    />
+        <result property="relatedParts"    column="relatedParts"    />
+        <association  property="windPowerStation"  column="station"     javaType="WindPowerStation"  select="com.gyee.wisdom.alarm.sharding.mapper.WindPowerStationMapper.selectByid"/>
+        <association  property="datadictionary"  column="relatedParts"     javaType="Datadictionary"  select="com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper.selectBycode"/>
+    </resultMap>
+    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="Alertrule2Result">
+        select a.* from  ALERTRULE2 a
+        left join windpowerstation w on w.id = a.station
+        <where>
+            1=1
+
+            <if test="name !=null and name !=''">
+                and a.name like  '%${name}%'
+            </if>
+            <if test="station !=null and station !=''">
+                and a.station like  '%${station}%'
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.modelid like  '%${modelId}%'
+            </if>
+            <if test="rank !=null and rank !=''">
+                and a.rank = #{rank}
+            </if>
+            <if test="category !=null and category !=''">
+                and a.category = #{category}
+            </if>
+            <if test="enabled !=null and enabled !=''">
+                and a.enabled = #{enabled}
+            </if>
+<!--            and a.range = 0-->
+        </where>
+        order by a.createtime desc
+    </select>
+
+    <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select max(a.ednavalue) from  ALERTRULE2 a
+    </select>
+    <select id="getAllByStationIdAndModelId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="idString !=null and idString !=''">
+                and a.id like  '%${idString}%'
+            </if>
+        </where>
+    </select>
+    <select id="getById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="idString !=null and idString !=''">
+                and a.id = #{idString}
+            </if>
+        </where>
+    </select>
+
+    <select id="quertByrelatedParts"  resultType="java.util.HashMap">
+        select a.name from  ALERTRULE2 a
+        where a.relatedparts = #{relatedParts}
+        group by a.name
+    </select>
+
+    <select id="queryTree" resultMap="Alertrule2Result" >
+        select distinct a.relatedparts,a.name,d.name from alertrule2 a
+        left join DATADICTIONARY d
+        on d.code = a.relatedparts
+        where
+        relatedparts is not null
+    </select>
+
+    <select id="queryMap" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select t.relatedparts,d.name from
+            (select a.relatedparts from alertrule2 a
+             where relatedparts  is not null
+             group by a.relatedparts) t
+        left join DATADICTIONARY d
+        on d.code = t.relatedparts
+    </select>
+    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2" useGeneratedKeys="true" keyProperty="id">
+        insert into alertrule2
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">Name,</if>
+            <if test="description != null">description,</if>
+            <if test="expression != null">expression,</if>
+            <if test="tag != null">tag,</if>
+            <if test="rank != null">rank,</if>
+            <if test="enabled != null">enabled,</if>
+            <if test="modelId != null">modelId,</if>
+            <if test="ednaValue != null">ednaValue,</if>
+            <if test="category != null">category,</if>
+            <if test="range != null">`range`,</if>
+            <if test="station != null">station,</if>
+            <if test="windturbine != null">windturbine,</if>
+            <if test="line != null">line,</if>
+            <if test="project != null">project,</if>
+            <if test="electrical != null">electrical,</if>
+            <if test="taskstart != null">taskstart,</if>
+            <if test="relatedParts != null">relatedParts,</if>
+            <if test="createtime != null">createtime</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="description != null">#{description},</if>
+            <if test="expression != null">#{expression},</if>
+            <if test="tag != null">#{tag},</if>
+            <if test="rank != null">#{rank},</if>
+            <if test="enabled != null">#{enabled},</if>
+            <if test="modelId != null">#{modelId},</if>
+            <if test="ednaValue != null">#{ednaValue},</if>
+            <if test="category != null">#{category},</if>
+            <if test="range != null">#{range},</if>
+            <if test="station != null">#{station},</if>
+            <if test="windturbine != null">#{windturbine},</if>
+            <if test="line != null">#{line},</if>
+            <if test="project != null">#{project},</if>
+            <if test="electrical != null">#{electrical},</if>
+            <if test="taskstart != null">#{taskstart},</if>
+            <if test="relatedParts != null">#{relatedParts},</if>
+            <if test="createtime != null">#{createtime}</if>
+        </trim>
+    </insert>
+    <update id="updateByAlertrule2Id" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        update alertrule2 a
+        <set >
+            <if test="name != null">a.name = #{name},</if>
+            <if test="description != null">a.description = #{description},</if>
+            <if test="expression != null">a.expression = #{expression},</if>
+            <if test="tag != null">a.tag = #{tag},</if>
+            <if test="rank != null">a.rank = #{rank},</if>
+            <if test="enabled != null">a.enabled = #{enabled},</if>
+            <if test="modelId != null">a.modelId = #{modelId},</if>
+            <if test="ednaValue != null and ednaValue!=0">a.ednaValue = #{ednaValue},</if>
+            <if test="category != null">a.category = #{category},</if>
+            <if test="range != null">a.range = #{range},</if>
+            <if test="station != null">a.station = #{station},</if>
+            <if test="windturbine != null">a.windturbine = #{windturbine},</if>
+            <if test="line != null">a.line = #{line},</if>
+            <if test="project != null">a.project = #{project},</if>
+            <if test="electrical != null">a.electrical = #{electrical},</if>
+            <if test="taskstart != null">a.taskstart = #{taskstart},</if>
+            <if test="relatedParts != null">a.relatedParts = #{relatedParts},</if>
+            <if test="createtime != null">a.createtime = #{createtime}</if>
+        </set>
+        where a.id = #{id}
+    </update>
+
+
+
+    <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  alertrule2 a where a.id=#{id}
+    </select>
+
+    <select id="selectByNameAndSataionAndModelid" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  alertrule2 a
+        <where>
+            1=1
+            <if test="name !=null and name !=''">
+                and a.name = #{name}
+            </if>
+            <if test="station !=null and station !=''">
+                and a.station = #{station}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid = #{modelid}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByExample" parameterType="com.gyee.wisdom.alarm.sharding.model.Alertrule2Example" resultMap="BaseResultMap">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        *
+<!--        <include refid="Base_Column_List" />-->
+        from ALERTRULE2
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause" />
+        </if>
+        <if test="orderByClause != null">
+            order by ${orderByClause}
+        </if>
+    </select>
+
+    <sql id="Base_Column_List">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        id, name, description, expression, tag, rank, enabled, modelid, ednavalue, category,
+        range, station, windturbine, line, project, electrical, taskstart, relatedparts
+    </sql>
+
+    <sql id="Example_Where_Clause">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        <where>
+            <foreach collection="oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                                        #{listItem}
+                                    </foreach>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
+            </foreach>
+        </where>
+    </sql>
+</mapper>

+ 16 - 0
warning-web/src/main/resources/mappers-postgresql/DatadictionaryMapper.xml

@@ -0,0 +1,16 @@
+<?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.DatadictionaryMapper">
+
+
+    <select id="selectBycode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Datadictionary">
+        select * from Datadictionary where code = #{relatedParts}
+    </select>
+
+
+    <select id="getAllDatadictionary" resultType="com.gyee.wisdom.alarm.sharding.entity.Datadictionary" >
+        select * from Datadictionary a
+        where category = 'early_category'
+    </select>
+
+</mapper>

+ 56 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceFaultModeMapper.xml

@@ -0,0 +1,56 @@
+<?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.DeviceFaultModeMapper">
+
+    <select id="getDeviceFaultModeByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeByStructureCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="structureCode !=null and structureCode !=''">
+                    and a.structurecode like '${structureCode}%'
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="code !=null and code !=''">
+                    and a.code=#{code}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeTree" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.code=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <delete id="deleteDeviceFaultMode" parameterType="Long">
+        delete from device_fault_mode where id = #{id}
+    </delete>
+</mapper>

+ 10 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceMapper.xml

@@ -0,0 +1,10 @@
+<?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.DeviceMapper">
+
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Device">
+        select * from  Device a
+    </select>
+
+</mapper>

+ 117 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceMetricsMapper.xml

@@ -0,0 +1,117 @@
+<?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.DeviceMetricsMapper">
+    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics" id="deviceModelMetricsResult">
+        <result property="id"    column="id"    />
+        <result property="deviceid"    column="deviceid"    />
+        <result property="structurecode"    column="structurecode"    />
+        <result property="metriccode"    column="metriccode"    />
+        <collection  property="deviceModelMetrics"  column="metriccode"      javaType="java.util.List"  select="com.gyee.wisdom.alarm.sharding.mapper.DeviceModelMetricsMapper.getDeviceModelMetricsById"/>
+    </resultMap>
+    <update id="updateByMetricsId" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        update device_metrics
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deviceid != null">deviceid = #{deviceid},</if>
+            <if test="structurecode != null">structurecode = #{structurecode},</if>
+            <if test="metriccode != null">metriccode = #{metriccode},</if>
+            <if test="name != null">name = #{name},</if>
+            <if test="enname != null">enname = #{enname},</if>
+            <if test="unitname != null">unitname = #{unitname},</if>
+            <if test="unitnamecn != null">unitnamecn = #{unitnamecn},</if>
+            <if test="categorydata != null">categorydata = #{categorydata},</if>
+            <if test="categorysci != null">categorysci = #{categorysci},</if>
+            <if test="categorysys != null">categorysys = #{categorysys},</if>
+            <if test="categoryres1 != null">categoryres1 = #{categoryres1},</if>
+            <if test="categoryres2 != null">categoryres2 = #{categoryres2},</if>
+            <if test="categoryres3 != null">categoryres3 = #{categoryres3},</if>
+            <if test="categoryres4 != null">categoryres4 = #{categoryres4},</if>
+            <if test="categoryres5 != null">categoryres5 = #{categoryres5},</if>
+            <if test="description != null">description = #{description},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <insert id="insertByMetrics" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics" useGeneratedKeys="true">
+        insert into device_metrics(id, deviceid, structurecode, metriccode, name, enname,
+                                   unitname,unitnamecn,categorydata,categorysci,categorysys,categoryres1,categoryres2,categoryres3,categoryres4,categoryres5,description)
+        values (#{id}, #{deviceid}, #{structurecode},
+                #{metriccode}, #{name}, #{enname},#{unitname}, #{unitnamecn}, #{categorydata},#{categorysci},#{categorysys}, #{categoryres1}, #{categoryres2},#{categoryres3}, #{categoryres4}, #{categoryres5},#{description})
+    </insert>
+
+
+
+    <select id="getDeviceMetricsByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+        order by metriccode
+    </select>
+
+    <select id="getDeviceMetricsByStructureCode" parameterType="java.util.Map" resultMap="deviceModelMetricsResult">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="structureCode !=null and structureCode !=''">
+                    and a.structurecode like '${structureCode}%'
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="deviceModelMetricsResult">
+        select m.* from  device_metrics m
+        <if test="model !=null and model !=''">
+            inner join device_model_metrics mm ON mm.METRICCODE = m.METRICCODE
+        </if>
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and m.deviceId=#{deviceId}
+            </if>
+            <if test="categorydata !=null and categorydata !=''">
+                and m.categorydata=#{categorydata}
+            </if>
+            <if test="model !=null and model !=''">
+                and mm.devicemodel=#{model}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and m.name like '%${keyword}%'
+            </if>
+            <if test="structureCode !=null and structureCode !=''">
+                and m.structurecode like '${structureCode}%'
+            </if>
+        </where>
+
+        order by m.metriccode  asc
+    </select>
+
+    <select id="getDeviceMetricsByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="metricCode !=null and metricCode !=''">
+                    and a.metricCode=#{metricCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+    <select id="selectByMetricsId" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select id,deviceid,structurecode,metriccode,name,enname,unitname,unitnamecn,categorydata,categorysci,categorysys,categoryres1,categoryres2,
+               categoryres3,categoryres4,categoryres5,description from device_metrics where id=#{id}
+    </select>
+
+    <select id="selectByMetriccode" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics where metriccode=#{metriccode}
+    </select>
+
+</mapper>

+ 34 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceModelMapper.xml

@@ -0,0 +1,34 @@
+<?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.DeviceModelMapper">
+
+
+    <select id="getDeviceModelsById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from device_model a
+        <where>
+            1=1
+            <if test="_parameter !=null and _parameter !=''">
+                and a.orderno=#{_parameter}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceModelByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from device_model a
+        <where>
+            1=1
+            <if test="deviceid !=null and deviceid !=''">
+                and a.deviceid=#{deviceid}
+                <if test="code !=null and code !=''">
+                    and a.code=#{code}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from  device_model a
+    </select>
+
+</mapper>

+ 54 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceModelMetricsMapper.xml

@@ -0,0 +1,54 @@
+<?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.DeviceModelMetricsMapper">
+
+
+    <select id="getDeviceModelMetricsById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from device_model_metrics a
+        <where>
+            1=1
+            <if test="_parameter  !=null and _parameter  !=''">
+                and a.metriccode=#{_parameter }
+            </if>
+        </where>
+    </select>
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from  device_model_metrics a
+    </select>
+    <select id="selectModelMetricsById" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from  device_model_metrics a where a.id=#{id}
+    </select>
+    <update id="updateModelMetricsById" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        update device_model_metrics
+        <set >
+            <if test="deviceid != null">deviceid = #{deviceid},</if>
+            <if test="devicemodel != null">devicemodel = #{devicemodel},</if>
+            <if test="metriccode != null">metriccode = #{metriccode},</if>
+            <if test="uniformcode != null">uniformcode = #{uniformcode},</if>
+            <if test="multiplier != null">multiplier = #{multiplier}</if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <insert id="insertModelMetrics" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics" useGeneratedKeys="true">
+        insert into device_model_metrics(id, deviceid, devicemodel, metriccode, uniformcode,multiplier)
+        values (#{id}, #{deviceid}, #{devicemodel},#{metriccode}, #{uniformcode},#{multiplier})
+    </insert>
+
+    <select id="getDeviceModelMetrics" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from device_model_metrics a
+        <where>
+            1=1
+            <if test="modelId  !=null and modelId  !=''">
+                and a.devicemodel =#{modelId}
+            </if>
+            <if test="metricCodeList !=null and metricCodeList.size > 0">
+                and a.metriccode in
+                <foreach collection="metricCodeList" item="metricCode" index="index" open="(" close=")" separator=",">
+                    #{metricCode}
+                </foreach>
+            </if>
+        </where>
+    </select>
+</mapper>

+ 48 - 0
warning-web/src/main/resources/mappers-postgresql/DeviceStructureMapper.xml

@@ -0,0 +1,48 @@
+<?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.DeviceStructureMapper">
+
+
+    <select id="getAllDeviceStructure" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+    </select>
+
+    <select id="getDeviceStructureByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceStructureChildNode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.parentCode=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getDeviceStructureByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.code=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+</mapper>

+ 18 - 0
warning-web/src/main/resources/mappers-postgresql/EarlyWarnScoreMapper.xml

@@ -0,0 +1,18 @@
+<?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.EarlyWarnScoreMapper">
+
+
+    <select id="getListEarlyWarnScore" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.EarlyWarnScore">
+        select * from earlywarnscore e
+        <where>
+            1=1
+            <if test="windturbineid !=null and windturbineid !=''">
+                and e.windturbineid = #{windturbineid}
+            </if>
+            and e.statdate =DATE_SUB(curdate(),INTERVAL 1 day)
+        </where>
+    </select>
+
+
+</mapper>

+ 17 - 0
warning-web/src/main/resources/mappers-postgresql/ElectricalTestingPointAIMapper.xml

@@ -0,0 +1,17 @@
+<?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.ElectricalTestingPointAIMapper">
+
+    <select id="selectPointByStation" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.ElectricalTestingPointAI">
+        select * from  ELECTRICALTESTINGPOINTAI a
+        <where>
+            1=1
+            <if test="stationId !=null and stationId !=''">
+                and a.windpowerstationid = #{stationId}
+            </if>
+        </where>
+    </select>
+
+
+
+</mapper>

+ 17 - 0
warning-web/src/main/resources/mappers-postgresql/ElectricalTestingPointDIMapper.xml

@@ -0,0 +1,17 @@
+<?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.ElectricalTestingPointDIMapper">
+
+    <select id="selectPointByStation" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.ElectricalTestingPointDI">
+        select * from  ELECTRICALTESTINGPOINTDI a
+        <where>
+            1=1
+            <if test="stationId !=null and stationId !=''">
+                and a.windpowerstationid = #{stationId}
+            </if>
+        </where>
+    </select>
+
+
+
+</mapper>

+ 10 - 0
warning-web/src/main/resources/mappers-postgresql/EquipmentmodelMapper.xml

@@ -0,0 +1,10 @@
+<?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.EquipmentmodelMapper">
+
+
+    <select id="getAllEquipmentmodel" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Equipmentmodel">
+        select * from Equipmentmodel a
+    </select>
+
+</mapper>

+ 44 - 0
warning-web/src/main/resources/mappers-postgresql/FaultHistoryMapper.xml

@@ -0,0 +1,44 @@
+<?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.FaultHisotryMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into faulthistory (id, faulttime, operator, snapid,confirmtype, confirmtime, confirmperson,messagetype,alerttextlast)
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.faultTime}, #{item.operator},#{item.snapId},#{item.confirmType},#{item.confirmTime},#{item.confirmPerson},#{item.messageType},#{item.alertTextLast}
+            from dual )
+        </foreach>
+    </insert>
+
+
+
+    <select id="queryFaultHistoryById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultHistory">
+        SELECT * FROM faulthistory
+        <where>
+            id=#{historyid}
+        </where>
+    </select>
+
+    <update id="faultClear" parameterType="java.util.Map">
+        UPDATE faulthistory  SET  CONFIRMTYPE=1   where FAULTTIME > #{startTime} AND FAULTTIME <![CDATA[ <= ]]>#{endTime}
+    </update>
+
+
+    <update id="batchConfirm" parameterType="java.util.Map">
+            UPDATE faulthistory  SET  CONFIRMTYPE=#{confirmType} ,CONFIRMPERSON=#{userName},ALERTSNAPID=#{alarmSnpaId},CONFIRMTIME=now()  where SNAPID = #{faultSnapId} and CONFIRMTYPE=0
+    </update>
+
+
+    <update id="updateHistoryById" parameterType="com.gyee.wisdom.alarm.sharding.entity.FaultHistory">
+        UPDATE
+        faulthistory
+        SET
+            CONFIRMTYPE = #{confirmType} ,
+            CONFIRMPERSON = #{confirmPerson} ,
+            ALERTSNAPID = #{alertSnapId} ,
+            CONFIRMTIME = #{confirmTime}
+        WHERE SNAPID = #{snapId}
+    </update>
+
+</mapper>

+ 122 - 0
warning-web/src/main/resources/mappers-postgresql/FaultInfoMapper.xml

@@ -0,0 +1,122 @@
+<?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.FaultInfoMapper">
+
+    <select id="queryFaultInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and s.stationid=#{stid}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and s.alerttext like #{keyword}
+            </if>
+            <if test="messageType !=null and messageType !=''">
+                and h.messagetype = #{messageType}
+            </if>
+            <if test="likeString !=null and likeString !=''">
+                and (s.alerttext like '%故障停机状态%'  or s.alerttext like '%总故障%')
+            </if>
+
+        </where>
+        order by h.faultTime desc
+    </select>
+
+    <select id="getFaultInfoByIds" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+            where h.id in
+        <foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
+            #{ids}
+        </foreach>
+        order by h.faultTime desc
+    </select>
+
+    <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        WHERE
+        h.confirmType = 0
+        AND s.isopened = 1
+        AND h.messageType = 1
+        AND h.faultTime >= #{faulttime}
+        order by h.faultTime desc
+    </select>
+    <select id="getRecentFault_bak" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        s.lastupdatetime as faultTime , s.isopened as messageType, s.id as snapID, '0' as confirmType,s.lastupdatetime as confirmTime, '' as confirmPerson,
+        s.id,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faultsnap s
+        WHERE
+        s.lastupdatetime >= #{faulttime}
+        order by s.lastupdatetime asc limit 0 OFFSET 16
+    </select>
+
+
+    <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        select * from (
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+       (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        order by h.faultTime desc)
+         where limit 0 OFFSET #{topnum}
+    </select>
+
+    <select id="queryFaultInfo1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and s.stationid=#{stid}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and s.alerttext like #{keyword}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and s.category1=#{category1}
+            </if>
+            <if test="isopened !=null ">
+                and s.isopened=#{isopened}
+            </if>
+        </where>
+        order by h.faultTime desc
+    </select>
+
+</mapper>

+ 74 - 0
warning-web/src/main/resources/mappers-postgresql/FaultSnapMapper.xml

@@ -0,0 +1,74 @@
+<?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.FaultSnapMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into faultsnap ( ID, STATIONID, PROJECTID, LINEID, WINDTURBINEID, ALERTVALUE, CATEGORY1, CATEGORY2, CATEGORY3, RANK, ISOPENED, LASTUPDATETIME, STATIONNAME, PROJECTNAME, LINENAME, WINDTURBINENAME, ALERTTEXT, MODELID, TESTINGPOINTKEY,ALARMSNAPID )
+        <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.alarmSnapId}
+            from dual )
+        </foreach>
+    </insert>
+
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            UPDATE faultsnap
+            <set>
+                <if test="item.isOpened != null">ISOPENED = #{item.isOpened},</if>
+                <if test="item.lastUpdateTime != null">LASTUPDATETIME = #{item.lastUpdateTime},</if>
+                <if test="item.alertText != null">ALERTTEXT = #{item.alertText},</if>
+            </set>
+            <where>
+                <if test="item.id != null">
+                    and id = #{item.id}
+                </if>
+            </where>
+        </foreach>
+    </update>
+
+    <select id="findByAlarmSnapId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.alarmsnapid=#{alarmSnapId}  limit 1
+        </where>
+    </select>
+
+
+
+    <select id="queryMultiFaultSnap" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select  ID,STATIONID,PROJECTID,LINEID,WINDTURBINEID,ALERTVALUE,CATEGORY1,CATEGORY2,CATEGORY3,RANK,ISOPENED,LASTUPDATETIME,LASTUPDATEPERSON,STATIONNAME,PROJECTNAME,LINENAME,WINDTURBINENAME,ALERTTEXT,MODELID,TESTINGPOINTKEY,ALARMSNAPID
+        from  FAULTSNAP a where a.id in
+        <foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+
+    <select id="queryByTagId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.testingpointkey=#{tagId} limit 1
+        </where>
+    </select>
+
+    <select id="queryByTimeAndStation"  resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.LASTUPDATETIME &gt;= #{startTime}
+            and a.LASTUPDATETIME &lt;= #{endTime}
+            and a.STATIONID = #{stationId}
+            and a.CATEGORY1 = 'FJ'
+        </where>
+    </select>
+
+    <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from ( select * from faultsnap h order by h.lastupdatetime desc) t
+         limit 0 OFFSET #{topnum}
+    </select>
+
+</mapper>

+ 35 - 0
warning-web/src/main/resources/mappers-postgresql/FaultStatisticWindturbineMapper.xml

@@ -0,0 +1,35 @@
+<?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.FaultStatisticWindturbineMapper">
+
+
+    <select id="selectFaultStatisticWindturbineByyearandmonth"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.FaultStatisticWindturbine">
+
+        select *
+        from FaultStatisticWindturbine
+        <where>
+
+            <if test="year !=null and year !=''">
+                and year = #{year}
+            </if>
+
+            <if test="month !=null and month !=''">
+                and month = #{month}
+            </if>
+
+            <if test="warningtype !=null and warningtype !=''">
+                and warningtype =#{warningtype}
+            </if>
+            <if test="windturbineId !=null and windturbineId !=''">
+                and windturbineId = #{windturbineId}
+            </if>
+
+            <if test="stationid !=null and stationid !=''">
+                and windpowerstationid = #{stationid}
+            </if>
+
+        </where>
+
+    </select>
+</mapper>

+ 36 - 0
warning-web/src/main/resources/mappers-postgresql/FeatureStatMapper.xml

@@ -0,0 +1,36 @@
+<?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.FeatureStatMapper">
+
+    <select id="searchByCondition" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+        select * from  FEATURE_STAT a
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and statdate &gt;= #{starttime,jdbcType=DATE} and statdate &lt; #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stationId !=null and stationId !=''">
+                and a.stationid=#{stationId}
+            </if>
+        </where>
+        order by a.id  desc
+    </select>
+    <select id="searchAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+        select * from  FEATURE_STAT a   order by a.id  desc
+    </select>
+
+    <select id="searchByCondition2" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+
+        select * from  FEATURE_STAT a
+        <where>
+            and statdate &gt;= #{currentDate,jdbcType=DATE}
+            <if test="stationId !=null and stationId !=''">
+                and a.stationid=#{stationId}
+            </if>
+        </where>
+        order by a.id  desc
+
+    </select>
+
+
+</mapper>

+ 15 - 0
warning-web/src/main/resources/mappers-postgresql/MainBrownouts2Mapper.xml

@@ -0,0 +1,15 @@
+<?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.MainBrownoutsMapper">
+
+    <select id="queryMainBrownouts2Count" resultType="java.util.Map">
+
+                        select count(t.id) count
+          from mainbrownouts2 t
+         where t.stoptime >=  #{currentDate,jdbcType=DATE}
+         order by t.stoptime desc
+
+
+    </select>
+</mapper>
+

+ 17 - 0
warning-web/src/main/resources/mappers-postgresql/RuleUpdateEvent.xml

@@ -0,0 +1,17 @@
+<?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.RuleUpdateEventMapper">
+    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEvent" id="ruleUpdateEventResult">
+        <result property="id" column="ID"/>
+        <result property="ruleType" column="RULETYPE"/>
+        <result property="ruleName" column="RULENAME"/>
+        <result property="ruleId" column="RULEID"/>
+        <result property="updateTime" column="UPDATETIME"/>
+        <result property="updateType" column="UPDATETYPE"/>
+        <result property="updateUser" column="UPDATEUSER"/>
+        <collection property="infoList" column="ID" javaType="java.util.List"
+                    ofType="com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEventInfo"
+                    select="com.gyee.wisdom.alarm.sharding.mapper.RuleUpdateEventInfoMapper.getInfoByEventId"/>
+    </resultMap>
+
+</mapper>

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

@@ -0,0 +1,14 @@
+<?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.RuleUpdateEventInfoMapper">
+
+    <select id="getInfoByEventId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEventInfo">
+        select * from RULEUPDATEEVENTINFO a
+        <where>
+            1=1
+            <if test="_parameter  !=null and _parameter  !=''">
+                and a.EVENTID=#{_parameter}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 29 - 0
warning-web/src/main/resources/mappers-postgresql/ScadabjMapper.xml

@@ -0,0 +1,29 @@
+<?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.ScadabjMapper">
+
+    <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Scadabj">
+        select * from  SCADABJ a
+        <where>
+            1=1
+            <if test="pointKey !=null and pointKey !=''">
+                and a.pointKey like '%${pointKey}%'
+            </if>
+            <if test="stationId !=null and stationId !=''">
+                and a.stationId=#{stationId}
+            </if>
+            <if test="enable !=null and enable !=''">
+                and a.enabled=#{enable}
+            </if>
+            <if test="description !=null and description !=''">
+                and a.description like  '%${description}%'
+            </if>
+        </where>
+    </select>
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Scadabj">
+        select * from  SCADABJ a
+
+    </select>
+
+</mapper>

+ 8 - 0
warning-web/src/main/resources/mappers-postgresql/ScadafaultMapper.xml

@@ -0,0 +1,8 @@
+<?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.ScadafaultMapper">
+
+    <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Scadafault">
+        select * from  SCADAFAULT a
+    </select>
+</mapper>

+ 54 - 0
warning-web/src/main/resources/mappers-postgresql/ShutdownEventMapper.xml

@@ -0,0 +1,54 @@
+<?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.ShutdownEventMapper">
+
+
+    <select id="queryShutdownEventList"  resultType="com.gyee.wisdom.alarm.sharding.entity.ShutdownEvent">
+        SELECT
+            *
+        FROM
+        Shutdownevent s
+        LEFT JOIN Warning2 w ON s.warningid = w.id
+        <where>
+            s.windpowerstationid = #{stId}
+            and s.statuscode = '2'
+            and s.stoptypeid in (select id from stoptype where parentid= 'gz' and id != 'gzbmq')
+            and s.windpowerstationid is not null
+            and s.stoptime &lt;= #{startdate,jdbcType=DATE}
+            and s.stoptime &gt; #{edtend,jdbcType=DATE}
+        </where>
+    </select>
+    <select id="queryShutdownEventCurrentDate"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.ShutdownEvent">
+
+        SELECT
+        *
+        FROM
+        Shutdownevent s
+        <where>
+            and s.stoptime &gt;= #{currentDate,jdbcType=DATE}
+            and s.statuscode = '2'
+            and s.stoptypeid in (select id from stoptype where parentid= 'gz' and id != 'gzbmq')
+            and s.windpowerstationid is not null
+            <if test="stId !=null and stId !=''">
+                and  s.windpowerstationid = #{stId}
+            </if>
+
+        </where>
+
+
+    </select>
+
+
+    <select id="queryTodayCount" resultType="java.util.Map">
+
+            SELECT count(s.id) as count
+              FROM Shutdownevent s
+             where s.stoptime >= #{currentDate,jdbcType=DATE}
+               and s.statuscode = '2'
+               and s.stoptypeid in (select id from stoptype where parentid = 'gz')
+               and s.windpowerstationid is not null
+
+    </select>
+
+</mapper>

+ 37 - 0
warning-web/src/main/resources/mappers-postgresql/StopTypeMapper.xml

@@ -0,0 +1,37 @@
+<?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.StopTypeMapper">
+
+    <select id="queryStopTypeList" resultType="com.gyee.wisdom.alarm.sharding.entity.StopType">
+        select * from stoptype
+        <where>
+            <if test="parentid !=null and parentid !=''">
+                and parentid = #{parentid}
+            </if>
+                and id != 'gzbmq'
+        </where>
+
+    </select>
+    <select id="queryStopTypeById" resultType="com.gyee.wisdom.alarm.sharding.entity.StopType">
+
+        select * from stoptype
+        <where>
+            <if test="id !=null and id !=''">
+                id = #{id}
+            </if>
+        </where>
+
+    </select>
+    <select id="queryStopTypeRoot" resultType="com.gyee.wisdom.alarm.sharding.entity.StopType">
+        select * from stoptype where parentid = '' or parentid is null
+    </select>
+    <select id="queryStopTypeParent" resultType="java.util.Map">
+        select id as lable,name as value from stoptype
+        <where>
+            <if test="parentid !=null and parentid !=''">
+                parentid = #{parentid}
+            </if>
+        </where>
+
+    </select>
+</mapper>

+ 35 - 0
warning-web/src/main/resources/mappers-postgresql/TestingPointAIMapper.xml

@@ -0,0 +1,35 @@
+<?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.TestingPointAIMapper">
+    <select id="selectByStationAndModel" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.TestingPointAI"  >
+        select * from testingpointai2 a
+        <where>
+            1=1
+            <if test="station !=null and station !=''">
+                and a.modelid  like  '%${station}%'
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.model like '%${modelId}%'
+            </if>
+        </where>
+    </select>
+    <select id="selectByUniformCodeAndModel" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.TestingPointAI">
+        select * from testingpointai2 a
+        <where>
+            1=1
+            <if test="uniformcodeList  !=null and uniformcodeList.size > 0 ">
+                and a.uniformcode in
+                <foreach collection="uniformcodeList" item="uniformcode" index="index" open="(" close=")" separator=",">
+                    #{uniformcode}
+                </foreach>
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.model=#{modelId}
+            </if>
+            <if test="stationSimpleName !=null and stationSimpleName !=''">
+                and a.modelid  like  '%${stationSimpleName}'
+            </if>
+        </where>
+    </select>
+</mapper>

+ 50 - 0
warning-web/src/main/resources/mappers-postgresql/TestingPointDIMapper.xml

@@ -0,0 +1,50 @@
+<?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.TestingPointDIMapper">
+    <select id="selectByStationAndModel" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.TestingPointDI"  >
+        select * from testingpointdi2 a
+        <where>
+            1=1
+            <if test="station !=null and station !=''">
+                and a.modelid  like  '%${station}%'
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.model like '%${modelId}%'
+            </if>
+        </where>
+    </select>
+    <select id="selectByUniformCodeAndModel" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.TestingPointDI">
+        select * from testingpointdi2 a
+        <where>
+            1=1
+            <if test="uniformcodeList  !=null and uniformcodeList.size > 0 ">
+                and a.uniformcode in
+                <foreach collection="uniformcodeList" item="uniformcode" index="index" open="(" close=")" separator=",">
+                    #{uniformcode}
+                </foreach>
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.model=#{modelId}
+            </if>
+            <if test="stationSimpleName !=null and stationSimpleName !=''">
+                and a.modelid  like  '%${stationSimpleName}'
+            </if>
+        </where>
+    </select>
+
+    <select id="getModel" parameterType="java.util.Map"
+            resultType="String">
+        select DISTINCT(MODELID) from testingpointdi2 a
+    </select>
+    <select id="getPointByMinModel" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.TestingPointDI">
+        select * from testingpointdi2 a
+        <where>
+            1=1
+            <if test="minModel !=null and minModel !=''">
+                and a.MODELID=#{minModel}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 34 - 0
warning-web/src/main/resources/mappers-postgresql/Warning2Mapper.xml

@@ -0,0 +1,34 @@
+<?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.Warning2Mapper">
+
+    <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Warning2">
+        select * from WARNING2 a
+        <where>
+            1=1
+            <if test="modelId !=null and modelId !=''">
+                and a.MODELID like '%${modelId}%'
+            </if>
+            <if test="name !=null and name !=''">
+                and a.CHINESETEXT like '%${name}%'
+            </if>
+            <if test="isLeaf !=null and isLeaf !=''">
+                and a.ISLEAF = #{isLeaf}
+            </if>
+        </where>
+    </select>
+    <select id="getMaxIdByModelId" parameterType="java.util.Map" resultType="java.lang.String">
+        select Max(ID) from WARNING2 a
+        <where>
+            1=1
+            <if test="modelId !=null and modelId !=''">
+                and a.ID like '%${modelId}%'
+            </if>
+
+        </where>
+    </select>
+
+    <select id="selectGroupType" resultType="java.lang.String">
+         select warningtypeid  as type from   warning2  group by warningtypeid
+    </select>
+</mapper>

+ 8 - 0
warning-web/src/main/resources/mappers-postgresql/WarningClassify.xml

@@ -0,0 +1,8 @@
+<?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.WarningClassifyMapper">
+
+    <select id="getAll"  resultType="com.gyee.wisdom.alarm.sharding.entity.WarningClassify">
+        select * from WARNINGCLASSIFY a
+    </select>
+</mapper>

+ 8 - 0
warning-web/src/main/resources/mappers-postgresql/WarningTypeMapper.xml

@@ -0,0 +1,8 @@
+<?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.WarningTypeMapper">
+
+    <select id="getAll"  resultType="com.gyee.wisdom.alarm.sharding.entity.WarningType">
+        select * from WARNINGTYPE a
+    </select>
+</mapper>

+ 29 - 0
warning-web/src/main/resources/mappers-postgresql/WindPowerStationMapper.xml

@@ -0,0 +1,29 @@
+<?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.WindPowerStationMapper">
+
+    <select id="getStationAll" resultType="com.gyee.wisdom.alarm.sharding.entity.WindPowerStation" >
+        select * from windpowerstation a
+        <where>
+            1=1
+            <if test="idString !=null and idString !=''">
+                and a.id like '%${idString}%'
+            </if>
+        </where>
+    </select>
+
+    <select id="getStationByid" resultType="com.gyee.wisdom.alarm.sharding.entity.WindPowerStation" >
+        select * from windpowerstation a
+        <where>
+            1=1
+            <if test="id !=null and id !=''">
+                and a.id =#{id}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByid" resultType="com.gyee.wisdom.alarm.sharding.entity.WindPowerStation">
+        select * from  windpowerstation a where a.id=#{station}
+    </select>
+
+</mapper>

+ 34 - 0
warning-web/src/main/resources/mappers-postgresql/WindTurbineTestingPointAiMapper.xml

@@ -0,0 +1,34 @@
+<?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.WindTurbineTestingPointAiMapper">
+
+    <select id="getWindTurbineTestingPointAi" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindTurbineTestingPointAi">
+        select * from  windturbinetestingpointai a
+        <where>
+            1=1
+            <if test="wtId !=null and wtId !=''">
+                and a.windturbineid = #{wtId}
+            </if>
+            <if test="unicode !=null and unicode !=''">
+                and a.code = #{unicode}
+            </if>
+        </where>
+    </select>
+
+    <select id="getPointList" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindTurbineTestingPointAi">
+        select * from  windturbinetestingpointai a
+        <where>
+            1=1
+            <if test="uniformCodeList  !=null and uniformCodeList.size > 0 ">
+                and a.uniformcode in
+                <foreach collection="uniformCodeList" item="uniformcode" index="index" open="(" close=")" separator=",">
+                    #{uniformcode}
+                </foreach>
+            </if>
+            <if test="windturbineId !=null and windturbineId !=''">
+                and a.windturbineid = #{windturbineId}
+            </if>
+        </where>
+    </select>
+
+</mapper>

+ 33 - 0
warning-web/src/main/resources/mappers-postgresql/WindTurbineTestingPointDiMapper.xml

@@ -0,0 +1,33 @@
+<?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.WindTurbineTestingPointDiMapper">
+
+    <select id="getWindTurbineTestingPointDi" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindTurbineTestingPointDi">
+        select * from  windturbinetestingpointdi a
+        <where>
+            1=1
+            <if test="wtId !=null and wtId !=''">
+                and a.windturbineid = #{wtId}
+            </if>
+            <if test="unicode !=null and unicode !=''">
+                and a.code = #{unicode}
+            </if>
+        </where>
+    </select>
+    <select id="getPointList" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindTurbineTestingPointDi">
+        select * from  windturbinetestingpointdi a
+        <where>
+            1=1
+            <if test="uniformCodeList  !=null and uniformCodeList.size > 0 ">
+                and a.uniformcode in
+                <foreach collection="uniformCodeList" item="uniformcode" index="index" open="(" close=")" separator=",">
+                    #{uniformcode}
+                </foreach>
+            </if>
+            <if test="windturbineId !=null and windturbineId !=''">
+                and a.windturbineid = #{windturbineId}
+            </if>
+        </where>
+    </select>
+
+</mapper>

+ 114 - 0
warning-web/src/main/resources/mappers-postgresql/WindturbineMapper.xml

@@ -0,0 +1,114 @@
+<?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.WindturbineMapper">
+    <resultMap id="BaseResultMap" type="com.gyee.wisdom.alarm.sharding.entity.Windturbine">
+        <result column="id" jdbcType="VARCHAR" property="id" />
+        <result column="code" jdbcType="VARCHAR" property="code" />
+        <result column="windpowerstationid" jdbcType="VARCHAR" property="windpowerstationid" />
+        <result column="longitude" jdbcType="DECIMAL" property="longitude" />
+        <result column="latitude" jdbcType="DECIMAL" property="latitude" />
+        <result column="modelid" jdbcType="VARCHAR" property="modelid" />
+        <result column="status" jdbcType="VARCHAR" property="status" />
+        <result column="projectid" jdbcType="VARCHAR" property="projectid" />
+        <result column="lineid" jdbcType="VARCHAR" property="lineid" />
+        <result column="firstintegratedtime" jdbcType="TIMESTAMP" property="firstintegratedtime" />
+        <result column="photo" jdbcType="VARCHAR" property="photo" />
+        <result column="name" jdbcType="VARCHAR" property="name" />
+        <result column="standardid" jdbcType="INTEGER" property="standardid" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,
+       	  	      	code,
+       	  	      	windpowerstationid,
+       	  	      	longitude,
+       	  	      	latitude,
+       	  	      	modelid,
+       	  	      	status,
+       	  	      	projectid,
+       	  	      	lineid,
+       	  	      	firstintegratedtime,
+       	  	      	photo,
+       	  	      	name,
+       	  	    	  	standardid
+    </sql>
+
+    <select id="selectWindturbines" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Windturbine"  >
+        select * from windturbine
+    </select>
+
+    <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from windturbine
+        where id = #{id,jdbcType=VARCHAR}
+    </select>
+
+    <select id="selectWindturbineByCondition" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Windturbine"  >
+        select * from windturbine a
+
+        <where>
+            1=1
+            <if test="stationId !=null and stationId !=''">
+                and a.windpowerstationid = #{stationId}
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.modelId = #{modelId}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectWindturbineByCondition2" parameterType="java.util.Map"  resultType="com.gyee.wisdom.alarm.sharding.entity.Windturbine"  >
+        select * from windturbine a
+        <where>
+            <if test="stationId !=null and stationId !=''">
+                 a.windpowerstationid = #{stationId}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByExample" parameterType="com.gyee.wisdom.alarm.sharding.model.WindturbineExample" resultMap="BaseResultMap">
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        <include refid="Base_Column_List" />
+        from windturbine
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause" />
+        </if>
+        <if test="orderByClause != null">
+            order by ${orderByClause}
+        </if>
+    </select>
+
+    <sql id="Example_Where_Clause">
+        <where>
+            <foreach collection="oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                                        #{listItem}
+                                    </foreach>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
+            </foreach>
+        </where>
+    </sql>
+</mapper>

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

@@ -0,0 +1,9 @@
+<?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.WindturbinePartsMapper">
+
+
+    <select id="selectAllWindturbineParts" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindturbineParts"  >
+        select * from windturbine_parts
+    </select>
+</mapper>