Browse Source

修改自定义预警规则查询接口

tianye 2 years ago
parent
commit
da45900427
1 changed files with 59 additions and 49 deletions
  1. 59 49
      warning-web/src/main/resources/mappers-oracle/Alertrule2Mapper.xml

+ 59 - 49
warning-web/src/main/resources/mappers-oracle/Alertrule2Mapper.xml

@@ -6,47 +6,49 @@
           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>
     <select id="pageQueryAll" parameterType="java.util.Map" resultMap="Alertrule2Result">
-        select a.* from  ALERTRULE2 a
+        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}
@@ -57,13 +59,16 @@
             <if test="enabled !=null and enabled !=''">
                 and a.enabled = #{enabled}
             </if>
-<!--            and a.range = 0-->
+            <if test="relatedparts !=null and relatedparts !=''">
+                and a.relatedparts = #{relatedparts}
+            </if>
+            <!--            and a.range = 0-->
         </where>
 
     </select>
     <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
             resultMap="Alertrule2Result">
-        select * from  ALERTRULE2 a
+        select * from ALERTRULE2 a
         <where>
             1=1
             <if test="station !=null and station !=''">
@@ -72,22 +77,24 @@
             <if test="modelid !=null and modelid !=''">
                 and a.modelid = #{modelid}
             </if>
+            and a.enabled = 1
         </where>
     </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
+    <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 !=''">
@@ -96,13 +103,13 @@
         </where>
     </select>
 
-    <select id="quertByrelatedParts"  resultType="java.util.HashMap">
+    <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
@@ -121,7 +128,7 @@
 
     <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>
@@ -144,7 +151,8 @@
         where a.id = #{id}
     </update>
 
-    <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>
@@ -190,20 +198,21 @@
         </trim>
     </insert>
 
-<!--    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">-->
-<!--        insert into alertrule2 a(a.id, a.Name, a.description, a.expression, a.tag, a.rank,-->
-<!--                               a.enabled,a.modelId,a.ednaValue,a.category,a.range,a.station,a.windturbine,a.line,a.project,a.electrical,-->
-<!--                               a.taskstart,a.relatedParts,a.createtime)-->
-<!--        values (#{id}, #{Name}, #{description},#{expression},-->
-<!--                #{tag}, #{rank}, #{enabled},#{modelId}, #{ednaValue}, #{category},#{range},#{station}, #{windturbine}, #{line},-->
-<!--                #{project}, #{electrical}, #{taskstart},#{relatedParts},#{createtime})-->
-<!--    </insert>-->
+    <!--    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">-->
+    <!--        insert into alertrule2 a(a.id, a.Name, a.description, a.expression, a.tag, a.rank,-->
+    <!--                               a.enabled,a.modelId,a.ednaValue,a.category,a.range,a.station,a.windturbine,a.line,a.project,a.electrical,-->
+    <!--                               a.taskstart,a.relatedParts,a.createtime)-->
+    <!--        values (#{id}, #{Name}, #{description},#{expression},-->
+    <!--                #{tag}, #{rank}, #{enabled},#{modelId}, #{ednaValue}, #{category},#{range},#{station}, #{windturbine}, #{line},-->
+    <!--                #{project}, #{electrical}, #{taskstart},#{relatedParts},#{createtime})-->
+    <!--    </insert>-->
 
     <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
         select * from  alertrule2 a where a.id=#{id}
     </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.
@@ -216,7 +225,7 @@
         <!--        <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}
@@ -254,7 +263,8 @@
                                 </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>