select sum(case conclusion when 'N' then 1 else 0 end) warning_count,warning_level,
sum(case conclusion when 'Y' then 1 else 0 end) normal_count,
(case warning_level when '1' then '提示' when '2' then '报警' when '3' then '严重' when '4' then '致命' else '' end) warn_name
<isNotNull property="module_code">
,module_name as module_name
</isNotNull>
from td_state_run t1,td_config_checkrule t2,td_module t3
where t1.module_code = t2.module_code
and t1.checkrule_content = t2.checkrule_content
and t1.only_unit_code = t2.only_unit_code
<isNotNull prepend="and" property="module_code">
t1.module_code = t3.module_code
and t1.module_code = #module_code#
</isNotNull>
group by warning_level
<isNotNull property="module_code">
,module_name
</isNotNull>
order by warning_level
module_code 不为空时,按理说应该能取得 module_name
并且 ibatis 生成的 sql 中也有了 module_name 这个字段
不过ibatis返回的结果集中 只有 warning_count,warning_level,normal_count,warn_name四个字段
而生成的sql 在 查询分析器中执行 是有 module_name 字段的
不知道 why ?
本文探讨了一个关于IBATIS SQL查询中模块名称(module_name)字段未能正确返回的问题。尽管SQL语句中包含了该字段,但在结果集中并未出现。通过对SQL语句和配置的分析,尝试找出问题所在。
1万+

被折叠的 条评论
为什么被折叠?



