63 lines
2.1 KiB
Java
63 lines
2.1 KiB
Java
|
|
package com.gunshi.project.xyt.controller;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
|
import com.gunshi.core.result.R;
|
||
|
|
import com.gunshi.project.xyt.model.*;
|
||
|
|
import com.gunshi.project.xyt.model.StRsvrRAutoDao;
|
||
|
|
import com.gunshi.project.xyt.model.StStbprpBAutoMapper;
|
||
|
|
import com.gunshi.project.xyt.so.RtuDataSo;
|
||
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||
|
|
import org.apache.commons.lang3.StringUtils;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
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 java.util.ArrayList;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 水位数据接口
|
||
|
|
*
|
||
|
|
* @author lyf
|
||
|
|
* @version 1.0.0
|
||
|
|
* @since 2024-01-26
|
||
|
|
*/
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/rcv/rsvrr")
|
||
|
|
@Tag(name = "统一接收-水位数据")
|
||
|
|
public class StRsvrRController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private StRsvrRAutoDao dao;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private StStbprpBAutoMapper stbprpDao;
|
||
|
|
|
||
|
|
@Schema(description = "分页查询")
|
||
|
|
@PostMapping("/page")
|
||
|
|
public R<Page<StRsvrR>> page(@RequestBody RtuDataSo so) {
|
||
|
|
List<String> stcds = new ArrayList<>();
|
||
|
|
if (StringUtils.isNotEmpty(so.getStcd())) {
|
||
|
|
stcds.add(so.getStcd());
|
||
|
|
} else if (StringUtils.isNotEmpty(so.getStnm())) {
|
||
|
|
stcds.addAll(stbprpDao.selectList(
|
||
|
|
new LambdaQueryWrapper<StStbprpB>().like(StStbprpB::getStnm, so.getStnm())
|
||
|
|
).stream().map(StStbprpB::getStcd).toList());
|
||
|
|
}
|
||
|
|
|
||
|
|
Page<StRsvrR> page;
|
||
|
|
if (!stcds.isEmpty()) {
|
||
|
|
LambdaQueryWrapper<StRsvrR> query = new LambdaQueryWrapper<StRsvrR>().in(StRsvrR::getStcd, stcds);
|
||
|
|
page = dao.page(so.getPageSo().toPage(), query);
|
||
|
|
} else {
|
||
|
|
page = dao.page(so.getPageSo().toPage());
|
||
|
|
}
|
||
|
|
|
||
|
|
return R.ok(page);
|
||
|
|
}
|
||
|
|
}
|