Explorar el Código

1:不传参也能查询
2:PGSQL适配Mysql

tianye hace 2 años
padre
commit
49dddecde1

+ 2 - 3
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/HomeController.java

@@ -9,7 +9,6 @@ import com.gyee.wisdom.alarm.sharding.service.AlarmSnapService;
 import com.gyee.wisdom.alarm.sharding.service.Alertrule2Service;
 import com.gyee.wisdom.alarm.sharding.service.RiskSnapService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import com.sun.org.apache.bcel.internal.generic.ARETURN;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -64,8 +63,8 @@ public class HomeController {
     @Operation(description = "风机部件查询接口")
     @GetMapping("alertrule")
     public ResponseWrapper selectAlertrule2(
-            @RequestParam(value = "station") String station,
-            @RequestParam(value = "modelid") String modelid
+            @RequestParam(value = "station",required = false) String station,
+            @RequestParam(value = "modelid",required = false) String modelid
     ) {
 
         ResponseWrapper wrapper = null;

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

@@ -57,11 +57,28 @@
             <if test="enabled !=null and enabled !=''">
                 and a.enabled = #{enabled}
             </if>
+            <if test="relatedparts !=null and relatedparts !=''">
+                and a.enabled = #{relatedparts}
+            </if>
 <!--            and a.range = 0-->
         </where>
 
     </select>
 
+    <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
+            resultMap="Alertrule2Result">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="station !=null and station !=''">
+                and a.station = #{station}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid = #{modelid}
+            </if>
+        </where>
+    </select>
+
     <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
         select max(a.ednavalue) from  ALERTRULE2 a
     </select>