对数据库中某字段的数据进行截取
2022/4/18 19:12:42
本文主要是介绍对数据库中某字段的数据进行截取,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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; }
这篇关于对数据库中某字段的数据进行截取的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-16Maven资料入门指南
- 2024-11-16Maven资料入门教程
- 2024-11-16MyBatis Plus资料:新手入门教程与实践指南
- 2024-11-16MyBatis-Plus资料入门教程:快速上手指南
- 2024-11-16Mybatis资料入门教程:新手必看指南
- 2024-11-16MyBatis资料详解:新手入门与初级实战指南
- 2024-11-16MyBatisPlus资料:初学者入门指南与实用教程
- 2024-11-16MybatisPlus资料详解:初学者入门指南
- 2024-11-16MyBatisX资料:新手入门与初级教程
- 2024-11-16RESTful接口资料详解:新手入门指南