添加了根据街道查询设备信息的功能模块

This commit is contained in:
XinYi Song 2022-02-18 11:30:12 +08:00
parent ca53051967
commit 8b78e05d27
2 changed files with 25 additions and 0 deletions

View File

@ -177,4 +177,19 @@ public class EquipmentController {
String data = jsonNode.get("data").asText(); String data = jsonNode.get("data").asText();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,data,locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,data,locale);
} }
/**
* 根据街道查询相应的设备信息
* @param street
* @return
*/
@GetMapping("/selectEquipmentByStreet")
public String selectEquipmentByStreet(@RequestParam("street") String street){
List<Map<String, Object>> maps = equipmentDao.selectEquipmentByStreet(street);
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该街道的设备信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
}
} }

View File

@ -78,4 +78,14 @@ public interface EquipmentDao extends JpaRepository<Equipment,Long> {
"from equipment e,fire f where f.alarm_date BETWEEN ?1 AND ?2 " + "from equipment e,fire f where f.alarm_date BETWEEN ?1 AND ?2 " +
"AND e.equipment_code = f.device_code GROUP BY LEFT(f.alarm_date,7),e.street",nativeQuery = true) "AND e.equipment_code = f.device_code GROUP BY LEFT(f.alarm_date,7),e.street",nativeQuery = true)
List<Map<String,Object>> selectEveryMonthCount(String beginTime, String endTime); List<Map<String,Object>> selectEveryMonthCount(String beginTime, String endTime);
/**
* 根据街道查询设备信息
* @param street
* @return
*/
@Query(value = "select equipment_code equipmentcode,equipment_name equipmentname,equipment_type equipmenttype," +
"equipment_status equipmentstatus,equipment_longitude equipmentlongitude," +
"equipment_latitude equipmentlatitude,installation_time installationtime,street from equipment where street = ?",nativeQuery = true)
List<Map<String,Object>> selectEquipmentByStreet(String street);
} }