Closed gordon-lang closed 4 weeks ago
1.5.1
我的serviceImpl里的查询代码如下: List<Map<String, Object>> maps = houseMapper.selectMaps( new MPJLambdaWrapper<ConfigHouse>() .select(ConfigHouse::getId, ConfigHouse::getName) .selectAs(ConfigBuilding::getName, "buildingName") .leftJoin(ConfigBuilding.class, ConfigBuilding::getId, ConfigHouse::getBuildingId) .eq(ConfigHouse::getId, "1846754161923682305")); 使用MPJLambdaWrapper进行连表查询,查询语句里对字段设置了“t”的别名,但是表没有给别名,不知道什么原因,然后只能SQL报错,下面控制台执行日志也打印了“SELECT t.id,t.name,t1.NAME AS buildingName FROM config_house WHERE (t.id = ?)”,令人费解;
List<Map<String, Object>> maps = houseMapper.selectMaps( new MPJLambdaWrapper<ConfigHouse>() .select(ConfigHouse::getId, ConfigHouse::getName) .selectAs(ConfigBuilding::getName, "buildingName") .leftJoin(ConfigBuilding.class, ConfigBuilding::getId, ConfigHouse::getBuildingId) .eq(ConfigHouse::getId, "1846754161923682305"));
14:49:19.895 [http-nio-8097-exec-1] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring DispatcherServlet 'dispatcherServlet' 14:49:20.546 [http-nio-8097-exec-1] DEBUG c.s.b.m.C.selectMaps - [debug,137] - ==> Preparing: SELECT t.id,t.name,t1.NAME AS buildingName FROM config_house WHERE (t.id = ?) 14:49:20.547 [http-nio-8097-exec-1] DEBUG c.s.b.m.C.selectMaps - [debug,137] - ==> Parameters: 1846754161923682305(String)
使用selectJoinMaps
确认
当前程序版本
1.5.1
问题描述
我的serviceImpl里的查询代码如下:
List<Map<String, Object>> maps = houseMapper.selectMaps( new MPJLambdaWrapper<ConfigHouse>() .select(ConfigHouse::getId, ConfigHouse::getName) .selectAs(ConfigBuilding::getName, "buildingName") .leftJoin(ConfigBuilding.class, ConfigBuilding::getId, ConfigHouse::getBuildingId) .eq(ConfigHouse::getId, "1846754161923682305"));
使用MPJLambdaWrapper进行连表查询,查询语句里对字段设置了“t”的别名,但是表没有给别名,不知道什么原因,然后只能SQL报错,下面控制台执行日志也打印了“SELECT t.id,t.name,t1.NAME AS buildingName FROM config_house WHERE (t.id = ?)”,令人费解;详细堆栈日志