<typeAlias alias="zonedetail" type="org.model.zone.ZoneDetail" /><resultMap id="zonedetailMap" class="zonedetail">
<result property="id" column="id"/>
<result property="zoneName" column="zone_name"/>
<result property="zoneStyle" column="zone_style"/>
<result property="num" column="num" />
</resultMap><select id="listMyADDZoneByUserId" resultMap="zonedetailMap" >
<![CDATA[
select tbzd.id as id ,tbzd.zone_name as zoneName ,tbzd.zone_style as zoneStyle 
,count(jbzd.user_id) as num
from jnt_bz_zone_detail jbzd left join 
tbl_bz_zone_detail tbzd on jbzd.zone_id=tbzd.id 
left join jnt_bz_zone_member jbzm on tbzd.id = 
jbzm.zone_id 
where jbzm.member_id is not null and jbzd.user_id = #user_id# and jbzd.type=1
group by tbzd.id, tbzd.zone_name, tbzd.zone_style 
]]>
</select>
ZoneDetail.java private String zoneName; private String zoneLogo; private String descs; private int zoneStyle; private int joinMethod;private int articleMethod;private int num;省略setter /getter 
问题:SQL语句是多表查询。三个主表,两个中间表。select 语句在数据库中查询是值 的, 但在程序中确查不出来。。 
求高手帮忙解决下

解决方案 »

  1.   

    debug在action中看看结果有没有,如果有的话就是页面上的属性写错了
      

  2.   

    不加这个 试试:<![CDATA[
      

  3.   

    你试过这SQL脚本直接在数据库中运行能有结果?
      

  4.   

    映射错了,sql语句中的别名和column对应
      

  5.   

    select tbzd.id as id ,tbzd.zone_name as zoneName ,tbzd.zone_style as zoneStyle 
    ,count(jbzd.user_id) as num4楼说的对,as后面的应该与配置文件里面的column对应,这里少了下划线。
      

  6.   

    楼上有道理.
    你直接用resultClass="zonedetail" 得了,不用定义resultMap了.
    只要sql中的字段与model中的相对应就ok了