离线提醒
parent
b43dca8420
commit
017d3f1377
@ -0,0 +1,61 @@
|
||||
package com.zhehekeji.web.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zhehekeji.common.util.ValidatorUtil;
|
||||
import com.zhehekeji.core.pojo.Result;
|
||||
import com.zhehekeji.web.entity.Order;
|
||||
import com.zhehekeji.web.entity.Warn;
|
||||
import com.zhehekeji.web.pojo.OrderSaveReq;
|
||||
import com.zhehekeji.web.pojo.OrderSearch;
|
||||
import com.zhehekeji.web.pojo.warn.WarnSearch;
|
||||
import com.zhehekeji.web.service.OrderService;
|
||||
import com.zhehekeji.web.service.PlcService;
|
||||
import com.zhehekeji.web.service.WarnService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(value = "Warn",tags = "告警管理")
|
||||
@RestController
|
||||
@RequestMapping("/warn")
|
||||
public class WarnController {
|
||||
|
||||
@Resource
|
||||
private WarnService warnService;
|
||||
@Resource
|
||||
private ValidatorUtil validatorUtil;
|
||||
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "查询")
|
||||
//@SessionHandler
|
||||
public Result<PageInfo<Warn>> orders(@RequestBody WarnSearch warnSearch) {
|
||||
validatorUtil.validate(warnSearch);
|
||||
return Result.success(warnService.page(warnSearch));
|
||||
}
|
||||
|
||||
@GetMapping("/media")
|
||||
//@ApiOperation(value = "视频测试")
|
||||
//@SessionHandler(userType = UserType.ACCOUNT)
|
||||
public void media() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*@GetMapping("/userCenter")
|
||||
@ApiOperation("用户中心地址")
|
||||
public Result<IndexVO> userCenter(){
|
||||
return Result.success(applicationService.userCenter());
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.zhehekeji.web.pojo.warn;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class WarnSearch {
|
||||
|
||||
@NotNull(message = "pageNum不能为空")
|
||||
private Integer pageNum;
|
||||
|
||||
@NotNull(message = "pageSize不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
private LocalDateTime startTime;
|
||||
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.zhehekeji.web.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zhehekeji.web.entity.Warn;
|
||||
import com.zhehekeji.web.mapper.WarnMapper;
|
||||
import com.zhehekeji.web.pojo.warn.WarnSearch;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WarnService {
|
||||
|
||||
@Resource
|
||||
private WarnMapper warnMapper;
|
||||
|
||||
public PageInfo<Warn> page(WarnSearch warnSearch){
|
||||
PageHelper.startPage(warnSearch.getPageNum(),warnSearch.getPageSize());
|
||||
QueryWrapper<Warn> queryWrapper = new QueryWrapper<>();
|
||||
if(warnSearch.getStartTime() != null && warnSearch.getEndTime() != null){
|
||||
queryWrapper.between("start_time",warnSearch.getStartTime(),warnSearch.getEndTime());
|
||||
}
|
||||
List<Warn> warns = warnMapper.selectList(queryWrapper);
|
||||
return new PageInfo<>(warns);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue