11
0

3 Revīzijas 8f0a85ef4c ... 92e0ee9947

Autors SHA1 Ziņojums Datums
  tianye 92e0ee9947 增加单点登录功能 2 gadi atpakaļ
  tianye b9902ae4f1 处理pgsql方言问题 2 gadi atpakaļ
  tianye 1c44c52c2f 处理数据传参:true,“1”,“true” 2 gadi atpakaļ

+ 60 - 52
alarm/windturbinenew/src/main/java/com/gyee/wisdom/alarm/windturbine/transport/restful/RestfulClient.java

@@ -3,13 +3,10 @@ package com.gyee.wisdom.alarm.windturbine.transport.restful;
 
 import com.gyee.wisdom.alarm.windturbine.config.Status8Properties;
 import com.gyee.wisdom.alarm.windturbine.model.TagInfo;
-import com.gyee.wisdom.alarm.windturbine.model.ThingType;
 import com.gyee.wisdom.alarm.windturbine.service.AlertSnapFactory;
 import com.gyee.wisdom.alarm.windturbine.service.CacheService;
 import com.gyee.wisdom.alarm.windturbine.service.SqlService;
-import com.gyee.wisdom.alarm.windturbine.service.WarningrecordsFactory;
 import com.gyee.wisdom.alarm.windturbine.transport.shardingclient.dto.AlarmSnap;
-import com.gyee.wisdom.common.data.alarm.Warningrecords;
 import com.gyee.wisdom.common.data.timeseries.BooleanTsData;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,50 +85,50 @@ public class RestfulClient {
                     //List<Warningrecords> warnList = new ArrayList<>();
                     for (Map.Entry<String, HashMap<String, Object>> entry : map.entrySet()) {
 
-                            String tagId = entry.getKey();
+                        String tagId = entry.getKey();
+
+                        TagInfo tagInfo = getTagInfoMap().get(tagId);
+                        BooleanTsData tsData = getTsData(entry.getValue());
+                        if (tsData == null || tsData.getTs() == 0) {
+                            continue;
+                        }
+                        if (tsData.getBooleanValue()) {
+
+                            if (tagInfo.getLastTsData() == null || tagInfo.getLastTsData().getBooleanValue() == false) {
+                                tagInfo.setLastTsData(tsData);
 
-                            TagInfo tagInfo = getTagInfoMap().get(tagId);
-                            BooleanTsData tsData = getTsData(entry.getValue());
-                            if (tsData == null || tsData.getTs() == 0) {
-                                continue;
-                            }
-                            if (tsData.getBooleanValue()) {
-
-                                if (tagInfo.getLastTsData() == null || tagInfo.getLastTsData().getBooleanValue() == false) {
-                                    tagInfo.setLastTsData(tsData);
-
-                                    AlarmSnap snap = findAlertSnap(tagInfo.getId());
-                                    if (snap == null) {
-                                        snap = AlertSnapFactory.createAlertsnapNew(tagInfo);
-                                        mapSnap.put(snap.getTestingpointKey(), snap);
-                                    }
-                                    else {
-                                        if (snap.getIsOpened() == 1)
-                                            continue;
-                                        snap.setDataInfo("0");
-                                        snap.setCategory3("0");
-                                    }
-
-                                    snap.setIsOpened(1);
-                                    //snap.setIsConfirmed(0);
-                                    snap.setLastUpdateTime(new Date());
-                                    snapList.add(snap);
-
-                                  //  Warningrecords wrec = WarningrecordsFactory.createWarningrecords(tagInfo,"0");
-                                   // warnList.add(wrec);
-                                }
-                            } else {
                                 AlarmSnap snap = findAlertSnap(tagInfo.getId());
-                                if (snap != null && snap.getIsOpened() == 1) {
-                                    snap.setIsOpened(0);
-                                    //snap.setIsConfirmed(1);
-                                    snap.setLastUpdateTime(new Date());
-                                    snapList.add(snap);
+                                if (snap == null) {
+                                    snap = AlertSnapFactory.createAlertsnapNew(tagInfo);
+                                    mapSnap.put(snap.getTestingpointKey(), snap);
+                                }
+                                else {
+                                    if (snap.getIsOpened() == 1)
+                                        continue;
                                     snap.setDataInfo("0");
                                     snap.setCategory3("0");
                                 }
+
+                                snap.setIsOpened(1);
+                                //snap.setIsConfirmed(0);
+                                snap.setLastUpdateTime(new Date());
+                                snapList.add(snap);
+
+                                //  Warningrecords wrec = WarningrecordsFactory.createWarningrecords(tagInfo,"0");
+                                // warnList.add(wrec);
+                            }
+                        } else {
+                            AlarmSnap snap = findAlertSnap(tagInfo.getId());
+                            if (snap != null && snap.getIsOpened() == 1) {
+                                snap.setIsOpened(0);
+                                //snap.setIsConfirmed(1);
+                                snap.setLastUpdateTime(new Date());
+                                snapList.add(snap);
+                                snap.setDataInfo("0");
+                                snap.setCategory3("0");
                             }
-                            tagInfo.setLastTsData(tsData);
+                        }
+                        tagInfo.setLastTsData(tsData);
                     }
 
                     if (snapList.size() > 0) {
@@ -139,11 +136,11 @@ public class RestfulClient {
                         sqlService.saveAlarmSnaps(snapList);
                         //snapList.clear();
                     }
-                //warningrecord 不再写入
-                   //if (warnList.size() > 0) {
-                   //    sqlService.saveWarningrecordsList(warnList);
-                   //  //warnList.clear();
-                   //}
+                    //warningrecord 不再写入
+                    //if (warnList.size() > 0) {
+                    //    sqlService.saveWarningrecordsList(warnList);
+                    //  //warnList.clear();
+                    //}
                 } catch (Exception ex) {
                     log.error("----------------{}", ex.getMessage());
                 }
@@ -162,12 +159,23 @@ public class RestfulClient {
             short status = ((Integer) hmp.get("status")).shortValue();
             boolean bValue = false;
             Object bo = hmp.get("booleanValue");
-            if (bo.equals(true) ||  bo.equals(false))
-                return new BooleanTsData(ts, status, (boolean)bo);
-            else if ("true".equals(bo) || "1".equals(bo)) {
-                bValue = true;
+            if(bo==null){
+                bo = hmp.get("doubleValue");
+                if (bo.equals(1))
+                    return new BooleanTsData(ts, status, true);
+                else {
+                    return new BooleanTsData(ts, status, false);
+                }
+            }else{
+                if (bo.equals(true) ||  bo.equals(false)) {
+                    return new BooleanTsData(ts, status, (boolean) bo);
+
+                }
+                else if ("true".equals(bo) || "1".equals(bo)) {
+                    bValue = true;
+                }
             }
-            return new BooleanTsData(ts, status, bValue);
+                return new BooleanTsData(ts, status, bValue);
 
         } catch (Exception ex) {
             log.info("------------{}", ex.getMessage());
@@ -181,7 +189,7 @@ public class RestfulClient {
             return mapSnap.get(tagId);
         else {
             AlarmSnap snap = sqlService.getAlertSnap(tagId);
-                mapSnap.put(tagId, snap);
+            mapSnap.put(tagId, snap);
             return snap;
         }
     }

+ 33 - 14
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmUserController.java

@@ -41,21 +41,40 @@ public class AlarmUserController {
             String obj = requestData.getData().toString();
             String jsonData = RSAService.translateByPublicKey(obj, requestData.getPublicKey());
             AlarmUser user = JSONObject.parseObject(jsonData, AlarmUser.class);
-
-            AlarmUser dataUser = alarmUserService.login(user);
-
-            if (dataUser != null) {
-                String token = "";
-                token = TokenUtil.createJwtToken(dataUser.getUserName());
-                AlarmUser data = new AlarmUser();
-                data.setChineseName(dataUser.getChineseName());
-                data.setUserName(dataUser.getUserName());
-                data.setId(dataUser.getId());
-                data.setIdentity(dataUser.getIdentity());
-                wrapper = ResponseWrapper.success("登陆成功", data);
-                wrapper.setToken(token);
+            if (StringUtil.isNotBlank(user.getMark())) {
+                AlarmUser dbUser = alarmUserService.singleLogin(user);      //单点登录
+                //单点登录
+                if (dbUser!=null) {
+                    String token = "";
+                    token = TokenUtil.createJwtToken(user.getUserName());
+                    AlarmUser data = new AlarmUser();
+                    data.setChineseName(dbUser.getChineseName());
+                    data.setUserName(dbUser.getUserName());
+                    data.setId(dbUser.getId());
+                    data.setIdentity(dbUser.getIdentity());
+
+                    wrapper = ResponseWrapper.success("登陆成功", data);
+                    wrapper.setToken(token);
+                } else {
+                    wrapper = ResponseWrapper.error("身份不合法");
+                }
             } else {
-                wrapper = ResponseWrapper.error("用户名或密码错误");
+
+                AlarmUser dataUser = alarmUserService.login(user);
+
+                if (dataUser != null) {
+                    String token = "";
+                    token = TokenUtil.createJwtToken(dataUser.getUserName());
+                    AlarmUser data = new AlarmUser();
+                    data.setChineseName(dataUser.getChineseName());
+                    data.setUserName(dataUser.getUserName());
+                    data.setId(dataUser.getId());
+                    data.setIdentity(dataUser.getIdentity());
+                    wrapper = ResponseWrapper.success("登陆成功", data);
+                    wrapper.setToken(token);
+                } else {
+                    wrapper = ResponseWrapper.error("用户名或密码错误");
+                }
             }
 
         } catch (Exception ex) {

+ 2 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/AlarmUser.java

@@ -34,4 +34,6 @@ public class AlarmUser implements Serializable {
     private int enabled;
     @TableField("IDENTITY")
     private String identity;
+    @TableField(exist = false)
+    private  String mark;
 }

+ 23 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmUserService.java

@@ -58,6 +58,29 @@ public class AlarmUserService {
 
     }
 
+    //单点登录
+    public AlarmUser singleLogin(AlarmUser user) {
+
+        if (StringUtil.isBlank(user.getUserName()))
+            return null;
+        else {
+            String md5str = DigestUtils.md5Hex(user.getUserName() + "gyee_alarm");
+            if (md5str.equals(user.getMark())) {
+                String userName = user.getUserName();
+                List<AlarmUser> dbUserList = alarmUserMapper.getUserByUserName(userName);
+                if (dbUserList.size() > 0 ) {
+                    return dbUserList.get(0);
+                } else {
+                    return null;
+                }
+
+            } else {
+                return null;
+            }
+
+        }
+    }
+
     public AlarmUser login2(AlarmUser user) {
 
 

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

@@ -5,15 +5,15 @@
     <insert id="singleInsert" >
         insert into alarmcount (id, alarmdate, snapid, count)
         values
-        (#{item.id}, #{item.alarmdate}, #{item.snapId}, #{item.count})
+        (#{item.id}, cast(#{item.alarmDate} as  timestamp), #{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 )
+            #{item.id}, cast(#{item.alarmDate} as  timestamp), #{item.snapId}, #{item.count} ,#{item.time}
+            )
         </foreach>
     </insert>
 
@@ -29,7 +29,7 @@
 
     <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
+            select snapid, sum(count) as count,sum(time) as 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}
@@ -73,7 +73,7 @@
         <where>
         1=1
             <if test="startdate !=null and enddate !=null">
-                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+                and a.alarmdate &gt;= #{startdate} and a.alarmdate &lt;= #{enddate}
             </if>
             <if test="stationid !=null and stationid !=''">
                 and ss.stationid=#{stationid}

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

@@ -5,14 +5,14 @@
     <insert id="singleInsert" >
         insert into ${tbName} (id, alerttime, messagetype,snapid, datainfo)
         values
-        (#{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo})
+        (#{item.id}, cast(#{item.alertTime} as  timestamp), #{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}
+            #{item.id}, cast(#{item.alertTime} as  timestamp), #{item.messageType},#{item.snapId},#{item.dataInfo},#{item.alertTextLast}
             from dual )
         </foreach>
     </insert>
@@ -181,19 +181,19 @@
 
     <update id="timedCreatTable">
         CREATE TABLE alarmhistory_${stationname}_${yearmonth} (
-        "id"            numeric(20) not null
-        constraint pk_alarmhistory_${stationname}_${yearmonth}
-        primary key,
-        "alerttime"     timestamp   not null,
-        "messagetype"   char        not null,
-        "snapid"        numeric(20) not null,
-        "datainfo"      varchar(20),
-        "alerttextlast" varchar(50)
+            "id"            numeric(20) not null
+            constraint pk_alarmhistory_${stationname}_${yearmonth}
+            primary key,
+            "alerttime"     timestamp   not null,
+            "messagetype"   char        not null,
+            "snapid"        numeric(20) not null,
+            "datainfo"      varchar(20),
+            "alerttextlast" varchar(50)
         )
     </update>
     <update id="timedAlterTable">
         alter table alarmhistory_${stationname}_${yearmonth}
-        owner to gdprod
+            owner to gdprod
     </update>
     <update id="timedCreatAlerttimeIndex">
         create index IX_AH_${stationname}_${yearmonth}_alerttime on alarmhistory_${stationname}_${yearmonth} ("alerttime")

+ 52 - 89
warning-web/src/main/resources/mappers-postgresql/Alertrule2Mapper.xml

@@ -6,75 +6,47 @@
           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"/>
+        <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"/>
+        <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>
-
-    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.Alertrule2" id="alertRule2ResultToPostgreSql">
-        <result property="id" column="id"/>
-        <result property="name" column="name"/>
-        <result property="description" column="description"/>
-        <result property="expression" column="expression"/>
-        <result property="tag" column="tag"/>
-        <result property="rank" column="rank"/>
-        <result property="enabled" column="specialenable"/>
-        <result property="modelId" column="modelid"/>
-        <result property="ednaValue" column="ednavalue"/>
-        <result property="category" column="category"/>
-        <result property="range" column="range"/>
-        <result property="station" column="station"/>
-        <result property="windturbine" column="windturbine"/>
-        <result property="line" column="line"/>
-        <result property="project" column="project"/>
-        <result property="electrical" column="electrical"/>
-        <result property="taskstart" column="taskstart"/>
-        <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="alertRule2ResultToPostgreSql">
-        select a.*, (case a.enabled   WHEN 't' then 1  when 'f' then 0  else 0 end) as specialenable from ALERTRULE2 a
+    <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}%'
+                and a.name like  '%${name}%'
             </if>
             <if test="station !=null and station !=''">
-                and a.station like '%${station}%'
+                and a.station like  '%${station}%'
             </if>
             <if test="modelId !=null and modelId !=''">
-                and a.modelid like '%${modelId}%'
+                and a.modelid like  '%${modelId}%'
             </if>
             <if test="rank !=null and rank !=''">
                 and a.rank = #{rank}
@@ -83,34 +55,27 @@
                 and a.category = #{category}
             </if>
             <if test="enabled !=null and enabled !=''">
-                <if test="enabled ='1'">
-                    and a.enabled = true
-                </if>
-                <if test="enabled ='0'">
-                    and a.enabled = false
-                </if>
+                and a.enabled = #{enabled}
             </if>
-
-            <!--            and a.range = 0-->
+<!--            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 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
+    <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}%'
+                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
+        select * from  ALERTRULE2 a
         <where>
             1=1
             <if test="idString !=null and idString !=''">
@@ -119,13 +84,13 @@
         </where>
     </select>
 
-    <select id="quertByrelatedParts" resultType="java.util.HashMap">
-        select a.name from ALERTRULE2 a
+    <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 id="queryTree" resultMap="Alertrule2Result" >
         select distinct a.relatedparts,a.name,d.name from alertrule2 a
         left join DATADICTIONARY d
         on d.code = a.relatedparts
@@ -135,14 +100,13 @@
 
     <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
+            (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 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>
@@ -189,7 +153,7 @@
     </insert>
     <update id="updateByAlertrule2Id" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
         update alertrule2 a
-        <set>
+        <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>
@@ -213,12 +177,13 @@
     </update>
 
 
+
     <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select * from alertrule2 a where a.id=#{id}
+        select * from  alertrule2 a where a.id=#{id}
     </select>
 
     <select id="selectByNameAndSataionAndModelid" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select * from alertrule2 a
+        select * from  alertrule2 a
         <where>
             1=1
             <if test="name !=null and name !=''">
@@ -233,8 +198,7 @@
         </where>
     </select>
 
-    <select id="selectByExample" parameterType="com.gyee.wisdom.alarm.sharding.model.Alertrule2Example"
-            resultMap="BaseResultMap">
+    <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.
@@ -244,10 +208,10 @@
             distinct
         </if>
         *
-        <!--        <include refid="Base_Column_List" />-->
+<!--        <include refid="Base_Column_List" />-->
         from ALERTRULE2
         <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
+            <include refid="Example_Where_Clause" />
         </if>
         <if test="orderByClause != null">
             order by ${orderByClause}
@@ -285,8 +249,7 @@
                                 </when>
                                 <when test="criterion.listValue">
                                     and ${criterion.condition}
-                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
-                                             separator=",">
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                                         #{listItem}
                                     </foreach>
                                 </when>

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

@@ -10,9 +10,10 @@
             <if test="windturbineid !=null and windturbineid !=''">
                 and e.windturbineid = #{windturbineid}
             </if>
-            and e.statdate =DATE_SUB(curdate(),INTERVAL 1 day)
+            and e.statdate >= current_date-1 and e.statdate &lt; current_date;
         </where>
     </select>
 
 
+
 </mapper>

+ 3 - 24
warning-web/src/main/resources/mappers-postgresql/ScadabjMapper.xml

@@ -2,24 +2,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">
 
-
-    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.Scadabj" id="scadabjResultToPostgreSql">
-        <result property="id" column="id"/>
-        <result property="pointKey" column="pointkey"/>
-        <result property="description" column="description"/>
-        <result property="category1" column="category1"/>
-        <result property="category2" column="category2"/>
-        <result property="category3" column="category3"/>
-        <result property="category4" column="category4"/>
-        <result property="stationId" column="stationid"/>
-        <result property="deviceId" column="deviceid"/>
-        <result property="rank" column="rank"/>
-        <result property="enabled" column="specialenable"/>
-        <result property="alarmType" column="alarmtype"/>
-    </resultMap>
-
-    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="scadabjResultToPostgreSql">
-        select a.*,(case a.enabled   WHEN 't' then 1  when 'f' then 0  else 0 end) as specialenable from  SCADABJ a
+    <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 !=''">
@@ -29,12 +13,7 @@
                 and a.stationId=#{stationId}
             </if>
             <if test="enable !=null and enable !=''">
-                <if test="enable ='1'">
-                    and a.enabled = true
-                </if>
-                <if test="enable ='0'">
-                    and a.enabled = false
-                </if>
+                and a.enabled=#{enable}
             </if>
             <if test="description !=null and description !=''">
                 and a.description like  '%${description}%'

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

@@ -3,7 +3,7 @@
 <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
+        select * from  windturbinetestingpointnew a
         <where>
             1=1
             <if test="wtId !=null and wtId !=''">
@@ -16,7 +16,7 @@
     </select>
 
     <select id="getPointList" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.WindTurbineTestingPointAi">
-        select * from  windturbinetestingpointai a
+        select * from  windturbinetestingpointnew a
         <where>
             1=1
             <if test="uniformCodeList  !=null and uniformCodeList.size > 0 ">