1、Controller:
@GetMapping("/pisplanstatus") public Result pisPlanStatus(String queryType) { Station station = getStation(); List<GuideScreenTest> pisplanstatus = (List<GuideScreenTest>) planBriService.pisplanstatus(queryType, station.getStationName()); for (GuideScreenTest guideScreenTest : pisplanstatus) { String ledName = guideScreenTest.getLedName(); int indx = ledName.indexOf("台"); String substring = ledName.substring(0,indx+1); guideScreenTest.setRegion(substring); } return Result.ok(pisplanstatus); } 2、service:
Object pisplanstatus(String queryType, String stationName); 3、serviceImpl: @Override public Object pisplanstatus(String queryType, String stationName) { // String sql = "SELECT device_name,ip,station,`status`,fault_state_code,device_address as region,modify_time "+ // "FROM `guide_screen_monitoring` WHERE station=:stationName ORDER BY modify_time DESC "; String sql = "SELECT gsm.device_name,gsm.ip,gsm.station,gsm.`status`,gsm.fault_state_code,gsm.device_address AS region,gsm.modify_time,rd.s_device_id "+ " FROM guide_screen_monitoring gsm LEFT JOIN rec_device rd on gsm.ip = rd.s_ip WHERE station=:stationName ORDER BY modify_time DESC "; Map<String, Object> param = new HashMap<>(); param.put("stationName", stationName); List<GuideScreenTest> listBySql = planBrightnessDao.findListBySql(GuideScreenTest.class, sql, param);
return listBySql; }