TbNewAreaTier tier = new TbNewAreaTier(); tier.setLv(tbUserInfo.getLv()); tier.setName(tbUserInfo.getCity()); tier.setSuperiorid(tier.getId()); List<TbNewAreaTier>tierList = tbNewAreaTierService.findList(tier); // List<Map<String, Object>> tierCity = tbNewAreaTierService.findCustom("select * from TB_NEW_AREA_TIER where lv = 1 and name=#{p[0]}", new Object[]{tbUserInfo.getCity()}); // List<Map<String, Object>> qxCity = tbNewAreaTierService.findCustom("select * from TB_NEW_AREA_TIER where superiorId = #{p[0]}", new Object[]{tierCity.get(0).get("ID")}); for (Map<String, Object> qx: tierList) { qx.put("xz", tbNewAreaTierService.findCustom("select * from TB_NEW_AREA_TIER where lv = 3 and superiorId= #{p[0]}", new Object[]{qx.get("ID")})); } json.fluentPut("gsqxs", qxCity); TbNewAreaTier tier = new TbNewAreaTier(); tier.setLv(1); tier.setName(tbUserInfo.getCity()); List<TbNewAreaTier>findListTierCity = tbNewAreaTierService.findList(tier); json.fluentPut("tier",findListTierCity.get(0));怎么改,不要Custom要list
时间: 2024-04-18 17:31:09 浏览: 76
CCP.zip_givingnx5_tier1_tier1开发
根据您的要求,以下是修改后的代码,将 `findCustom` 替换为 `findList` :
```java
TbNewAreaTier tier = new TbNewAreaTier();
tier.setLv(tbUserInfo.getLv());
tier.setName(tbUserInfo.getCity());
tier.setSuperiorid(tier.getId());
List<TbNewAreaTier> tierList = tbNewAreaTierService.findList(tier);
for (TbNewAreaTier qx : tierList) {
TbNewAreaTier xz = new TbNewAreaTier();
xz.setLv(3);
xz.setSuperiorid(qx.getId());
List<TbNewAreaTier> xzList = tbNewAreaTierService.findList(xz);
qx.setXz(xzList);
}
TbNewAreaTier tierCity = new TbNewAreaTier();
tierCity.setLv(1);
tierCity.setName(tbUserInfo.getCity());
List<TbNewAreaTier> findListTierCity = tbNewAreaTierService.findList(tierCity);
json.fluentPut("gsqxs", findListTierCity);
json.fluentPut("tier", findListTierCity.get(0));
```
在这个修改后的代码中,我做了以下更改:
- 在 `for` 循环中,使用了 `tbNewAreaTierService.findList` 代替了 `tbNewAreaTierService.findCustom`。
- 创建了一个新的 `TbNewAreaTier` 对象 `xz`,并设置了它的 `lv` 和 `superiorid` 属性,并使用 `tbNewAreaTierService.findList` 查询并设置了 `qx` 的 `xz` 属性。
- 使用 `tbNewAreaTierService.findList` 查询并设置了 `findListTierCity`。
请注意,这只是根据您提供的代码片段进行的修改,可能还有其他上下文和变量信息未提供。请根据您的实际需求进行适当调整。
阅读全文