wu
2023-12-04 a93a3f1532d33849187dcd1a372c315ec4511e04
springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
New file
@@ -0,0 +1,48 @@
package com.example.springboot.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.springboot.common.Result;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.mapper.AlarmMapper;
import com.example.springboot.service.AlarmService;
import com.microsoft.schemas.office.office.STInsetMode;
@RestController
@RequestMapping("/alarm")
public class AlarmController {
  @Autowired
  AlarmMapper alarmMapper;
  @Autowired
  AlarmService alarmService;
  @GetMapping("/load")
  public Result selectAll() {// 查询当天已结束的报警信息
    Map<String, Object> map = new HashMap<>();
    List<alarmmg> storageCagelist = alarmMapper.selectAll();
    map.put("list", storageCagelist);
    return Result.success(map);
  }
  @GetMapping("/stTime")
  public Result selecttime(String shijian1, String shijian2) {// 根据日期查询报警信息
    // 将get方法传过来的参数中"#20"替换为" "
    String sj1 = shijian1.replace("#20", " ");
    String sj2 = shijian2.replace("#20", " ");
    List<alarmmg> storageCagelist = alarmMapper.selecttime(sj1, sj2);
    Map<String, Object> map = new HashMap<>();
    map.put("list", storageCagelist);
    return Result.success(map);
  }
}