gunshi-project-ss/src/main/java/com/gunshi/project/xyt/controller/RealRainController.java

45 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.gunshi.project.xyt.controller;
import com.gunshi.core.annotation.Post;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.so.RealRainBaseSo;
import com.gunshi.project.xyt.entity.vo.RealRainListVo;
import com.gunshi.project.xyt.service.RealRainService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/real/rain")
@Tag(name = "降雨信息查询接口")
@Data
public class RealRainController {
@Autowired
private RealRainService realRainService;
@Post(path="/list", summary = "实时雨情-降雨信息-查询接口")
public R<List<RealRainListVo>> getRealRainList(@RequestBody RealRainBaseSo realRainBaseSo) {
List<RealRainListVo> list = realRainService.getRealRainList(realRainBaseSo);
//按RealRainListVo.drp倒序排列null的排在最后面
list.sort((o1, o2) -> {
if (o1.getDrp() == null) {
return 1;
}
if (o2.getDrp() == null) {
return -1;
}
return o2.getDrp().compareTo(o1.getDrp());
});
return R.ok(list);
}
}