mybatis-plus的collection、association 标签传递多参数

常规示例:

<resultMap type="com.zxsl.air.business.entity.dto.PsControlo3noticeDto" id="psControlo3noticeDto">
        <id column="id" property="id"/>
        <collection  property="fileInfoDtos" select="getFileInfoDtos" column="id"
                     ofType="com.zxsl.air.platform.upload.dto.FileInfoDto" javaType="java.util.ArrayList">
        </collection >
        <collection  property="psControlo3industrys" select="getpsControlo3industrys" column="id"
                     ofType="com.zxsl.air.business.entity.dto.PsControlo3industryDto" javaType="java.util.ArrayList">
        </collection >
    </resultMap>

有些时候需要传递往collection、association 标签传递多参数,可通过如下方式:
修改column属性如column="{id=idvalue,industry=industryvalue,name=namevalue}"

<resultMap type="com.zxsl.air.business.entity.dto.PsControlo3noticeDto" id="psControlo3noticeDto">
        <id column="id" property="id"/>
        <collection  property="fileInfoDtos" select="getFileInfoDtos" column="id"
                     ofType="com.zxsl.air.platform.upload.dto.FileInfoDto" javaType="java.util.ArrayList">
        </collection >
        <collection  property="psControlo3industrys" select="getpsControlo3industrys" column="{id=id,industry=industry,name=name}"
                     ofType="com.zxsl.air.business.entity.dto.PsControlo3industryDto" javaType="java.util.ArrayList">
        </collection >
    </resultMap>

其中idvalue、industryvalue、namevalue可不声明<id column="id" property="id"/>,i但是idvalue、industryvalue、namevalue必须是sql查询的返回列,也可以是某些常量列。

<select id="getList" parameterType="com.zxsl.air.business.controller.param.QueryPsControlo3noticeParam" resultMap="psControlo3noticeDto">
select distinct pcn.*,pci.controlO3Notice_id,
queryPsControlo3noticeParam.industry as industry      
from ps_controlo3notice pcn
<select>

本文笔记到此结束。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。