首页 新闻 会员 周边 捐助

mybatis 返回hashMap 返回的值value是重复的

0
悬赏园豆:20 [待解决问题]

xml源码:
<select id="getAllPeriodStatisticsList" resultType="Map">
select
<foreach collection="fieldList" index="index" item="item" separator=",">
BigToInt(ifnull( sum( case when w.year = #{year} and w.number= #{item.number} then 1 else 0 end), 0)) as ${item.number}
</foreach>
from ssr_person_warning w
left join ssr_archive_person a on a.userId = w.userId
left join ssr_organization_ext ext on ext.id = a.organizationId
where a.isCurrent = 1
and w.state = 1
<if test="field != null and field !=''"> and ext.${field} = #{districtCode} </if>
</select>
java源码:
public Map<String, Integer> getAllPeriodStatisticsList(String year, String districtCode) {
Map<String, Integer> map = new HashMap<>(8);
List<Map<String, Object>> periods = PeriodService.getPeriods(year,
TemplateDetailService.PERMONTH);
if (periods == null) {
return map;
}
Map<String, Object> param = new HashMap<>(8);
param.put("fieldList", periods);
param.put("year", year);
param.put("field", StringUtils.isBlank(districtCode) ? null :
DistrictService.getTypeByCode(districtCode) + "Code");
param.put("districtCode", districtCode);
map = sqlSessionTemplate.selectOne(NS + "getAllPeriodStatisticsList", param);
return map;
}
返回的map:

日志sql直接在navicat运行:

zylong的主页 zylong | 初学一级 | 园豆:182
提问于:2019-07-23 14:47
< >
分享
所有回答(1)
0

返回的有问题,

超级火锅 | 园豆:232 (菜鸟二级) | 2019-07-23 16:59

是有问题啊,但我不知道怎么造成的啊。

支持(0) 反对(0) zylong | 园豆:182 (初学一级) | 2019-07-23 17:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册