Commit cd6ae552 authored by tangwei's avatar tangwei

增加指标信息

parent 47617aef
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @description:
* @author: tw
* @createDate: 2023/7/3
*/
@Data
@Accessors(chain = true)
public class MonitorFanIndicatorDto extends BaseEntity {
private String fanCode;//'设备编号',
private String gateway;// '网关',
private String indicator;//'指标名称',
private String indicatorValue;// '指标值',
private String time;// '时间',
private String isAlarm;//'是否告警指标',
private String unit;//'指标单位',
private String systemType;//所属系统
private String frontModule;//所属模块
}
package com.yeejoin.amos.boot.module.jxiop.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @description:
* @author: tw
* @createDate: 2023/7/3
*/
@Data
@Accessors(chain = true)
@TableName(value = "monitor_fan_indicator" ,autoResultMap = true)
public class MonitorFanIndicator extends BaseEntity {
@TableField("fan_code")
private String fanCode;//'设备编号',
@TableField("gateway")
private String gateway;// '网关',
@TableField("indicator")
private String indicator;//'指标名称',
@TableField("indicator_value")
private String indicatorValue;// '指标值',
@TableField("time")
private String time;// '时间',
@TableField("is_alarm")
private String isAlarm;//'是否告警指标',
@TableField("unit")
private String unit;//'指标单位',
@TableField("system_type")
private String systemType;//所属系统
@TableField("front_module")
private String frontModule;//所属模块
}
package com.yeejoin.amos.boot.module.jxiop.api.service;
/**
* @description:
* @author: tw
* @createDate: 2023/7/3
*/
public interface IMonitorFanIndicator {
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorFanIndicator;
/**
* @description:
* @author: tw
* @createDate: 2023/7/3
*/
public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import com.yeejoin.precontrol.common.entity.publics.CommonResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorFanInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanInfo;
import com.yeejoin.precontrol.common.utils.NameUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
*
*
* @author duanwei
* @date 2023-06-30
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/monitor-fan-info", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MonitorFanInfoController {
@Autowired
IMonitorFanInfoService iMonitorFanInfoService;
/**
* 新增
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveMonitorFanInfo(HttpServletRequest request, @RequestBody MonitorFanInfo monitorFanInfo){
return iMonitorFanInfoService.save(monitorFanInfo);
}
/**
* 根据id删除
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanInfoService.removeById(id);
}
/**
* 修改
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdMonitorFanInfo(HttpServletRequest request, @RequestBody MonitorFanInfo monitorFanInfo){
return iMonitorFanInfoService.updateById(monitorFanInfo);
}
/**
* 根据id查询
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public MonitorFanInfo selectById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanInfoService.getById(id);
}
/**
* 列表分页查询
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<MonitorFanInfo> listPage(String pageNum,String pageSize,
MonitorFanInfo monitorFanInfo){
Page<MonitorFanInfo> pageBean;
QueryWrapper<MonitorFanInfo> monitorFanInfoQueryWrapper = new QueryWrapper<>();
Class<? extends MonitorFanInfo> aClass = monitorFanInfo.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(monitorFanInfo);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(monitorFanInfo);
monitorFanInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(monitorFanInfo);
monitorFanInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(monitorFanInfo);
monitorFanInfoQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(monitorFanInfo);
monitorFanInfoQueryWrapper.eq(name, fileValue);
}
}
}catch (Exception e) {
}
});
IPage<MonitorFanInfo> page;
if (StringUtils.isBlank(pageNum) ||StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
}else{
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iMonitorFanInfoService.page(pageBean, monitorFanInfoQueryWrapper);
return page;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import com.yeejoin.precontrol.common.entity.publics.CommonResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorFanRealtimeMonitoringService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanRealtimeMonitoring;
import com.yeejoin.precontrol.common.utils.NameUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
*
*
* @author duanwei
* @date 2023-06-30
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/monitor-fan-realtime-monitoring", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MonitorFanRealtimeMonitoringController {
@Autowired
IMonitorFanRealtimeMonitoringService iMonitorFanRealtimeMonitoringService;
/**
* 新增
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveMonitorFanRealtimeMonitoring(HttpServletRequest request, @RequestBody MonitorFanRealtimeMonitoring monitorFanRealtimeMonitoring){
return iMonitorFanRealtimeMonitoringService.save(monitorFanRealtimeMonitoring);
}
/**
* 根据id删除
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanRealtimeMonitoringService.removeById(id);
}
/**
* 修改
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdMonitorFanRealtimeMonitoring(HttpServletRequest request, @RequestBody MonitorFanRealtimeMonitoring monitorFanRealtimeMonitoring){
return iMonitorFanRealtimeMonitoringService.updateById(monitorFanRealtimeMonitoring);
}
/**
* 根据id查询
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public MonitorFanRealtimeMonitoring selectById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanRealtimeMonitoringService.getById(id);
}
/**
* 列表分页查询
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<MonitorFanRealtimeMonitoring> listPage(String pageNum,String pageSize,
MonitorFanRealtimeMonitoring monitorFanRealtimeMonitoring){
Page<MonitorFanRealtimeMonitoring> pageBean;
QueryWrapper<MonitorFanRealtimeMonitoring> monitorFanRealtimeMonitoringQueryWrapper = new QueryWrapper<>();
Class<? extends MonitorFanRealtimeMonitoring> aClass = monitorFanRealtimeMonitoring.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(monitorFanRealtimeMonitoring);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(monitorFanRealtimeMonitoring);
monitorFanRealtimeMonitoringQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(monitorFanRealtimeMonitoring);
monitorFanRealtimeMonitoringQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(monitorFanRealtimeMonitoring);
monitorFanRealtimeMonitoringQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(monitorFanRealtimeMonitoring);
monitorFanRealtimeMonitoringQueryWrapper.eq(name, fileValue);
}
}
}catch (Exception e) {
}
});
IPage<MonitorFanRealtimeMonitoring> page;
if (StringUtils.isBlank(pageNum) ||StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
}else{
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iMonitorFanRealtimeMonitoringService.page(pageBean, monitorFanRealtimeMonitoringQueryWrapper);
return page;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import com.yeejoin.precontrol.common.entity.publics.CommonResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorFanRealtimeRunningService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanRealtimeRunning;
import com.yeejoin.precontrol.common.utils.NameUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
*
*
* @author duanwei
* @date 2023-06-30
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/monitor-fan-realtime-running", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MonitorFanRealtimeRunningController {
@Autowired
IMonitorFanRealtimeRunningService iMonitorFanRealtimeRunningService;
/**
* 新增
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveMonitorFanRealtimeRunning(HttpServletRequest request, @RequestBody MonitorFanRealtimeRunning monitorFanRealtimeRunning){
return iMonitorFanRealtimeRunningService.save(monitorFanRealtimeRunning);
}
/**
* 根据id删除
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanRealtimeRunningService.removeById(id);
}
/**
* 修改
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdMonitorFanRealtimeRunning(HttpServletRequest request, @RequestBody MonitorFanRealtimeRunning monitorFanRealtimeRunning){
return iMonitorFanRealtimeRunningService.updateById(monitorFanRealtimeRunning);
}
/**
* 根据id查询
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public MonitorFanRealtimeRunning selectById(HttpServletRequest request, @PathVariable Long id){
return iMonitorFanRealtimeRunningService.getById(id);
}
/**
* 列表分页查询
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<MonitorFanRealtimeRunning> listPage(String pageNum,String pageSize,
MonitorFanRealtimeRunning monitorFanRealtimeRunning){
Page<MonitorFanRealtimeRunning> pageBean;
QueryWrapper<MonitorFanRealtimeRunning> monitorFanRealtimeRunningQueryWrapper = new QueryWrapper<>();
Class<? extends MonitorFanRealtimeRunning> aClass = monitorFanRealtimeRunning.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(monitorFanRealtimeRunning);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(monitorFanRealtimeRunning);
monitorFanRealtimeRunningQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(monitorFanRealtimeRunning);
monitorFanRealtimeRunningQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(monitorFanRealtimeRunning);
monitorFanRealtimeRunningQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(monitorFanRealtimeRunning);
monitorFanRealtimeRunningQueryWrapper.eq(name, fileValue);
}
}
}catch (Exception e) {
}
});
IPage<MonitorFanRealtimeRunning> page;
if (StringUtils.isBlank(pageNum) ||StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
}else{
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iMonitorFanRealtimeRunningService.page(pageBean, monitorFanRealtimeRunningQueryWrapper);
return page;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import com.yeejoin.precontrol.common.entity.publics.CommonResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorPowerInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorPowerInfo;
import com.yeejoin.precontrol.common.utils.NameUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
*
*
* @author duanwei
* @date 2023-06-30
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/monitor-power-info", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MonitorPowerInfoController {
@Autowired
IMonitorPowerInfoService iMonitorPowerInfoService;
/**
* 新增
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveMonitorPowerInfo(HttpServletRequest request, @RequestBody MonitorPowerInfo monitorPowerInfo){
return iMonitorPowerInfoService.save(monitorPowerInfo);
}
/**
* 根据id删除
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iMonitorPowerInfoService.removeById(id);
}
/**
* 修改
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdMonitorPowerInfo(HttpServletRequest request, @RequestBody MonitorPowerInfo monitorPowerInfo){
return iMonitorPowerInfoService.updateById(monitorPowerInfo);
}
/**
* 根据id查询
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public MonitorPowerInfo selectById(HttpServletRequest request, @PathVariable Long id){
return iMonitorPowerInfoService.getById(id);
}
/**
* 列表分页查询
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<MonitorPowerInfo> listPage(String pageNum,String pageSize,
MonitorPowerInfo monitorPowerInfo){
Page<MonitorPowerInfo> pageBean;
QueryWrapper<MonitorPowerInfo> monitorPowerInfoQueryWrapper = new QueryWrapper<>();
Class<? extends MonitorPowerInfo> aClass = monitorPowerInfo.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(monitorPowerInfo);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(monitorPowerInfo);
monitorPowerInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(monitorPowerInfo);
monitorPowerInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(monitorPowerInfo);
monitorPowerInfoQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(monitorPowerInfo);
monitorPowerInfoQueryWrapper.eq(name, fileValue);
}
}
}catch (Exception e) {
}
});
IPage<MonitorPowerInfo> page;
if (StringUtils.isBlank(pageNum) ||StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
}else{
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iMonitorPowerInfoService.page(pageBean, monitorPowerInfoQueryWrapper);
return page;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import com.yeejoin.precontrol.common.entity.publics.CommonResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorStationInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorStationInfo;
import com.yeejoin.precontrol.common.utils.NameUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
*
*
* @author duanwei
* @date 2023-06-30
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/monitor-station-info", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MonitorStationInfoController {
@Autowired
IMonitorStationInfoService iMonitorStationInfoService;
/**
* 新增
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveMonitorStationInfo(HttpServletRequest request, @RequestBody MonitorStationInfo monitorStationInfo){
return iMonitorStationInfoService.save(monitorStationInfo);
}
/**
* 根据id删除
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iMonitorStationInfoService.removeById(id);
}
/**
* 修改
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdMonitorStationInfo(HttpServletRequest request, @RequestBody MonitorStationInfo monitorStationInfo){
return iMonitorStationInfoService.updateById(monitorStationInfo);
}
/**
* 根据id查询
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public MonitorStationInfo selectById(HttpServletRequest request, @PathVariable Long id){
return iMonitorStationInfoService.getById(id);
}
/**
* 列表分页查询
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<MonitorStationInfo> listPage(String pageNum,String pageSize,
MonitorStationInfo monitorStationInfo){
Page<MonitorStationInfo> pageBean;
QueryWrapper<MonitorStationInfo> monitorStationInfoQueryWrapper = new QueryWrapper<>();
Class<? extends MonitorStationInfo> aClass = monitorStationInfo.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(monitorStationInfo);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(monitorStationInfo);
monitorStationInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(monitorStationInfo);
monitorStationInfoQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(monitorStationInfo);
monitorStationInfoQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(monitorStationInfo);
monitorStationInfoQueryWrapper.eq(name, fileValue);
}
}
}catch (Exception e) {
}
});
IPage<MonitorStationInfo> page;
if (StringUtils.isBlank(pageNum) ||StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
}else{
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iMonitorStationInfoService.page(pageBean, monitorStationInfoQueryWrapper);
return page;
}
}
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