Commit f15244d2 authored by kiritoausna's avatar kiritoausna

2022-6.20 水质历史数据

parent 818632d2
......@@ -8,6 +8,7 @@ import me.zhengjie.gemho.service.data.SzDataService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.RealVo;
import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -52,5 +53,18 @@ public class SzDataController {
return new ResponseEntity<>(new RealVo().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ApiOperation(value = "分页查看")
@GetMapping("history")
public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
try {
HashMap<String, Object> map = szDataService.pageall(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
package me.zhengjie.gemho.entity.data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -39,7 +40,8 @@ public class SzData implements Serializable {
*/
@ApiModelProperty(value = "设备编号(外键)")
public String sensorid;
@TableField(exist = false)
public String sensorname;
/**
* 测量时间
*/
......@@ -75,7 +77,8 @@ public class SzData implements Serializable {
*/
@ApiModelProperty(value = "创建时间", hidden = true)
public Date createtime;
@TableField(exist = false)
public String Danwei;
/**
* 修改时间
*/
......
......@@ -3,6 +3,7 @@ package me.zhengjie.gemho.service.data;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.SzData;
import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
......@@ -61,15 +62,9 @@ public interface SzDataService extends IService<SzData> {
/**
* 分页历史记录
*
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param datasource
* @param dataQueryCriteria
* @param request
* @return
*/
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource);
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
}
......@@ -12,6 +12,7 @@ import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -30,15 +32,14 @@ import java.util.HashMap;
*/
@Service
public class SzDataServiceImpl extends ServiceImpl<SzDataMapper, SzData> implements SzDataService {
private static String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH");
@Autowired
private SzDataMapper szDataMapper;
@Autowired
private DrybeachequipinforMapper drybeachequipinforMapper;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH");
private static String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
@Override
public DataVo day(String date, String values, String deviceid, String subitem) {
......@@ -105,14 +106,25 @@ public class SzDataServiceImpl extends ServiceImpl<SzDataMapper, SzData> impleme
}
@Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
HashMap<String, Object> map = new HashMap<>();
QueryWrapper<SzData> szDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(szDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource);
ServiceUtil.dbquery(szDataQueryWrapper, dataQueryCriteria, request);
Page<SzData> szDataPage = new Page<>(page + 1, size);
szDataPage = szDataMapper.selectPage(szDataPage, szDataQueryWrapper);
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("list", szDataPage.getRecords());
hashMap.put("total", szDataPage.getTotal());
return hashMap;
List<SzData> records = szDataPage.getRecords();
//获取设备编码 名称 map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
HashMap<String, String> noDan = ServiceUtil.getNoDan(request);
for (SzData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
record.setDanwei(noDan.get(record.getSensorid()));
}
map.put("list", records);
map.put("total", szDataPage.getTotal());
return map;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment