4670101279
2 years ago
14 changed files with 147 additions and 12 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.api.app; |
||||
|
||||
import com.ruoyi.api.controller.AbstractApiController; |
||||
import com.ruoyi.api.params.AlarmDataParams; |
||||
import com.ruoyi.api.params.WaterDataParams; |
||||
import com.ruoyi.api.service.AlarmDataApiService; |
||||
import com.ruoyi.api.service.WaterDataApiService; |
||||
import com.ruoyi.code.warning.service.IWaAlarmService; |
||||
import com.ruoyi.common.core.page.R; |
||||
import com.ruoyi.common.validator.ValidatorUtils; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
|
||||
/** |
||||
* 系统对外接口-检测信息 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/api") |
||||
@Slf4j |
||||
public class AlarmDataApiController extends AbstractApiController { |
||||
|
||||
@Resource |
||||
private AlarmDataApiService alarmDataApiService; |
||||
/** |
||||
* 预警数据查询 |
||||
* |
||||
* @param params |
||||
* @return |
||||
*/ |
||||
@PostMapping("v1/alarm_data/query") |
||||
public R query(@RequestBody AlarmDataParams params) { |
||||
log.info("[预警数据查询接口查询参数为{}]", params); |
||||
ValidatorUtils.validateV2(params); |
||||
return alarmDataApiService.query(params); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.api.params; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
@Data |
||||
public class AlarmDataParams { |
||||
|
||||
private Long stnmId; |
||||
|
||||
private String startTime; |
||||
|
||||
private String endTime; |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.api.service; |
||||
|
||||
import com.ruoyi.api.params.AlarmDataParams; |
||||
import com.ruoyi.api.params.WaterDataParams; |
||||
import com.ruoyi.code.warning.domain.WaAlarm; |
||||
import com.ruoyi.code.warning.service.IWaAlarmService; |
||||
import com.ruoyi.common.core.page.R; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public class AlarmDataApiService { |
||||
|
||||
@Resource |
||||
private IWaAlarmService waAlarmService; |
||||
|
||||
public R query(AlarmDataParams params) { |
||||
Map<String,Object> map = new HashMap<>(); |
||||
map.put("stnmId",params.getStnmId()); |
||||
map.put("startTime",params.getStartTime()); |
||||
map.put("endTime",params.getEndTime()); |
||||
|
||||
List<WaAlarm> list = waAlarmService.queryAlarm(map); |
||||
return R.ok().put("data", list); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<?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.ruoyi.code.warning.mapper.WaAlarmMapper"> |
||||
|
||||
<select id="queryAlarm" resultType="com.ruoyi.code.warning.domain.WaAlarm"> |
||||
select a.*,b.stnm from wa_alarm a |
||||
left join sc_station_info b on a.stnm_id=b.id |
||||
where a.deleted=0 |
||||
<if test="params.stnmId != null and params.stnmId !=''"> |
||||
and a.stnm_id = #{stnmId} |
||||
</if> |
||||
<if test="params.startTime != null and params.startTime !=''"> |
||||
and a.alarm_time >= #{params.startTime } |
||||
</if> |
||||
<if test="params.endTime != null and params.endTime !=''"> |
||||
and a.alarm_time <= #{params.endTime} |
||||
</if> |
||||
order by alarm_time desc |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue