mybatis collection association 联合查询 中column 传入多个参数

下面是本人使用,红色为需要注意的地方

<resultMap id="ResultStatisticsPrincipals" type="cn.xxx.clue.pojo.StatisticsPrincipals">
        <result column="uploadCount" property="uploadCount" jdbcType="INTEGER" />
        <result column="market_cathedra_code" property="marketCathedraCode" jdbcType="VARCHAR" />
        <result column="principals" property="principal" jdbcType="VARCHAR" />
        <result column="form_id" property="formId" jdbcType="VARCHAR" />
        <result column="dataWillDepartmentBM" property="dataWillDepartmentBM" jdbcType="VARCHAR" />
        <result column="dataWillDepartmentYLB" property="dataWillDepartmentYLB" jdbcType="VARCHAR" />
        <collection property="listClueDatas" select="selectClueDataBMarketCathedraCode"  column="{marketCathedraCode=market_cathedra_code,select_channel=channel}"
                    javaType="java.util.ArrayList"
                    ofType="cn.xdf.clue.pojo.ClueDataWithBLOBs" extend="com.xxx.RoleBean">

        </collection>

上段代码column="{marketCathedraCode=market_cathedra_code,select_channel=channel}"

中的marketCathedraCode、select_channel 都是随便起的名字,后面market_cathedra_code、channel 对应的是外层查询的字段(column)名

 <select id="selectClueDataBMarketCathedraCode" resultMap="ResultMapWithBLOBs" parameterType="java.util.Map"  >
        select
        <include refid="Base_Column_List" />,
        <include refid="Blob_Column_List" />
        from clue_data
        where market_cathedra_code = #{marketCathedraCode,jdbcType=VARCHAR}
        <if test="channel != null and channel != ''">
            and cd.channel = #{select_channel,jdbcType=VARCHAR}
        </if>
        AND principals is not null and principals  <![CDATA[ <> ]]>   ''  and  principals  <![CDATA[ <> ]]>   '0'
        and data_available = '1'
    </select>

注:上面parameterType="java.util.Map"一定要用map,这个地方是根据上面的key去取传入的参数

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值