瀏覽代碼

'预警'

master
daixiantong 4 年之前
父節點
當前提交
32ab7f2d5c
共有 2 個檔案被更改,包括 45 行新增0 行删除
  1. +8
    -0
      src/main/java/com/taauav/admin/controller/TauvWaterWarnController.java
  2. +37
    -0
      src/main/java/com/taauav/admin/entity/TauvWaterWarn.java

+ 8
- 0
src/main/java/com/taauav/admin/controller/TauvWaterWarnController.java 查看文件

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taauav.admin.controller.BaseController;
import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.FunctionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.taauav.common.core.mps.BaseQuery;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +35,13 @@ public class TauvWaterWarnController extends BaseController {
@GetMapping("/list")
public Response list(TauvWaterWarn tauvWaterWarn, BaseQuery query) {
IPage<TauvWaterWarn> list = tauvWaterWarnService.pageData(query, tauvWaterWarn);
if (list.getRecords().size() > 0) {
for (TauvWaterWarn data : list.getRecords()) {
data.setWarnTypeText(FunctionUtils.getArrayText(data.getWarnType().toString(), data.typeList()));
data.setWarnLevelText(FunctionUtils.getArrayText(data.getWarnLevel().toString(), data.levelList()));
data.setStatusText(FunctionUtils.getArrayText(data.getStatus().toString(), data.statusList()));
}
}
return response.success(list);
}


+ 37
- 0
src/main/java/com/taauav/admin/entity/TauvWaterWarn.java 查看文件

@@ -1,5 +1,6 @@
package com.taauav.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.taauav.common.domain.Entity;
import lombok.Data;
@@ -9,6 +10,8 @@ import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigInteger;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
* 水质预警对象 tauv_water_warn
@@ -69,4 +72,38 @@ public class TauvWaterWarn extends Entity {
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date warnTime;

@TableField(exist = false)
private String warnTypeText;

@TableField(exist = false)
private String warnLevelText;

@TableField(exist = false)
private String statusText;

public Map<String, String> typeList() {
Map<String, String> map = new HashMap<>();
map.put("1", "水质富营养化");
map.put("2", "水生藻类植物");
return map;
}

public Map<String, String> levelList() {
Map<String, String> map = new HashMap<>();
map.put("1", "一级");
map.put("2", "二级");
map.put("3", "三级");
map.put("4", "四级");
map.put("5", "五级");
return map;
}

public Map<String, String> statusList() {
Map<String, String> map = new HashMap<>();
map.put("1", "待预警");
map.put("2", "已预警");
map.put("3", "已取消");
return map;
}
}

Loading…
取消
儲存