mybatisplus返回string的有哪些方法
MyBatis Plus返回String的方法有多种,取决于你想要在甚么情况下使用。
String result = mapper.selectOne(queryWrapper).toString();
List<String> resultList = mapper.selectList(queryWrapper).stream().map(Object::toString).collect(Collectors.toList());
List<Map<String, Object>> resultMapList = mapper.selectMaps(queryWrapper);
List<String> resultList = resultMapList.stream().map(map -> map.get("columnName").toString()).collect(Collectors.toList());
这些只是一些常见的用法示例,根据你的具体需求可能会有其他更合适的方法。
TOP