association與collection多column傳遞

<resultMap id="QueryMonthPageVO" type="com.wx.cspl.mip.model.vo.SuperviseTaskMonthReportVO">
        <result column="id" property="id"/>
        <result column="orgseq" property="orgSeq"/>
        <result column="yearParticular" property="year"/>
        <result column="monthParticular" property="month"/>
        <result column="task_name" property="taskName"/>
        <result column="report" property="monthDetail"/>
        <result column="complete_status" property="finishCode"/>
        <result column="finish_rate" property="progressBar"/>
        <result column="question" property="question"/>
        <result column="measures" property="measures"/>
        <result column="update_time" property="updateTime"/>
        <result column="year_plan_id" property="yearPlanId"/>
        <result column="season" property="season"/>
        <!-- 級聯(lián)查詢季度 -->
        <association property="quarterTarget" column="{yearPlanId= year_plan_id, season = season}"
                     select="com.wx.cspl.mip.dao.QuarterMapper.getQuarter" />
    </resultMap>

其中
<association property="quarterTarget" column="{yearPlanId= year_plan_id, season = season}"
select="com.wx.cspl.mip.dao.QuarterMapper.getQuarter" />

以key:value的形式傳遞值

value = year_plan_id與value = season對應(yīng)resultMap里面的column字段 <result column="year_plan_id" property="yearPlanId"/>
<result column="season" property="season"/>

以map的形式傳值

/** 根據(jù)yearPlanId與Season查詢季度目標 */
    Quarter getQuarter(Map<String,Object> map);

year_plan_id = #{yearPlanId} and season = #{season}
#{yearPlanId}與#{season} 對應(yīng)map的key
parameterType="java.util.Map"
注意參數(shù)類型為map

<!-- 根據(jù)yearPlanId與Season查詢季度目標 -->
    <select id="getQuarter" resultType="com.wx.cspl.mip.model.entity.Quarter" parameterType="java.util.Map">
      select * from t_quarter where year_plan_id = #{yearPlanId} and season = #{season}
    </select>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類: pyspark.sql...
    mpro閱讀 9,920評論 0 13
  • 19.6.171、ibatis.binding.BindingException: Invalid bound s...
    靜心安分讀書閱讀 510評論 1 1
  • 最近做項目用到springboot整合mybatis,security。將其中遇到的問題做一個總結(jié) 注:本項目全程...
    huoyl0410閱讀 841評論 1 2
  • 1. 簡介 1.1 什么是 MyBatis ? MyBatis 是支持定制化 SQL、存儲過程以及高級映射的優(yōu)秀的...
    笨鳥慢飛閱讀 6,248評論 0 4
  • 從心理的角度分析,父母婚姻幸福,孩子內(nèi)心的恐懼,焦慮,沖突就比較少,孩子內(nèi)心會比較平靜,從而更能夠在學業(yè)中取...
    靜待花開_a060閱讀 374評論 1 3

友情鏈接更多精彩內(nèi)容