MYBATIS仅返回1排

时间:2014-07-20 04:28:24

标签: mybatis

我有一个问题...返回只有一行请帮助我...我不确定我的映射有什么问题....但是当我在我的sql中尝试查询时返回是6

<mapper namespace="com.rmw.lcf.entity.custom.businessrule.mapper.BusinessRuleExtendedMapper">
  <resultMap id="BaseResultMap" type="com.rmw.lcf.entity.custom.businessrule.model.BusinessRuleExtended">
    <id property="id_business_rule" column="id_business_rule" />
    <result property="business_rule_name" column="business_rule_name" />
    <result property="business_rule_description" column="business_rule_description" />
    <collection property="listHasBusinessRule" column="business_rule_id_business_rule" javaType="ArrayList" ofType="com.rmw.lcf.entity.custom.listhasbusinessrule.model.ListHasBusinessRuleExtended">
      <id property="list_idList" column="list_idList"/>
      <result property="activated" column="activated" />
      <collection property="listTable" column="list_idList" javaType="ArrayList" ofType="com.rmw.lcf.entity.list.model.ListTable">
        <id property="idList" column="idList"/>
        <result property="list_name" column="list_name" />
        <result property="activated" column="activated" />
        <result property="validated" column="validated" />
      </collection>
    </collection>
  </resultMap>

<select id="selectBusinessRuleMatrix" resultMap="BaseResultMap">
            SELECT 
                br.id_business_rule as id_business_rule,
                br.business_rule_name as business_rule_name,
                br.business_rule_description as business_rule_description,
                lhbr.List_idList,
                lhbr.business_rule_id_business_rule as business_rule_id_business_rule,
                lhbr.activated,
                ls.idList as idList,
                ls.list_name as list_name,
                ls.validated as validated,
                ls.activated as activated
            FROM business_rule br
            LEFT JOIN list_has_business_rule lhbr
            ON br.id_business_rule = lhbr.business_rule_id_business_rule
            LEFT JOIN `list` ls
            ON lhbr.List_idList = ls.idList
            WHERE ls.activated = 1 AND ls.validated = 1
              AND br.activated = 1 AND br.validated =1
              AND lhbr.validated = 1
            ORDER BY br.id_business_rule, ls.idList;
        </select>

非常感谢您的帮助

1 个答案:

答案 0 :(得分:0)

替换

<id property="idList" column="idList"/>

<result property="idList" column="idList"/>