mybatis和model关联

<select id="getSubCreditLogBySubCreditId" parameterType="long"
        resultType="com.credit.model.SubcreditStatusLog">
        SELECT 
        sl.status,
        ui.realName as loginName,
        sl.checkReason,
        sl.creditScore,
        sl.reserveAmountRate,
        sl.addTime
        FROM 
        subcredit_statuslog sl
        LEFT JOIN
        user_info ui on
        ui.userId=sl.userId        
        WHERE sl.subCreditId = #{subCreditId} and sl.status > 2
    </select>
ui.realName as loginName,
ui.realName 是 user_info 对应的model的属性 realName
loginName 是subcredit_statuslog 对应的model属性 如果不加 as subcredit_statuslog 对应的model 的属性也应该叫 realName

posted on 2015-12-24 11:11  weiguoyuan  阅读(475)  评论(0编辑  收藏  举报

导航