mybatis list映射

mybatis list映射

<resultMap id="QueryResultMap" type="com.kxdzc.push.domain.entity.vo.PushTemplateVo">
        <id column="id" property="id"/>
        <result column="channel" property="channel"/>
        <result column="key" property="key"/>
        <result column="title" property="title"/>
        <result column="desc" property="desc"/>
        <result column="content" property="content"/>
        <result column="params" property="params"/>
        <result column="hrefType" property="hrefType"/>
        <result column="href" property="href"/>
        <result column="template_id" property="templateId"/>
        <result column="used_count" property="usedCount"/>
        <result column="offline" property="offline"/>
        <result column="offline_expire_time" property="offlineExpireTime"/>
        <result column="ctime" property="ctime"/>
        <result column="utime" property="utime"/>
        <result column="status" property="status"/>
        <collection property="filters" javaType="ArrayList" ofType="com.kxdzc.push.domain.entity.PushTemplateFilter">
            <id column="filters.id" property="id"/>
            <result column="filters.push_template_id" property="pushTemplateId"/>
            <result column="filters.phone" property="phone"/>
            <result column="filters.status" property="status"/>
            <result column="filters.type" property="type"/>
            <result column="filters.ctime" property="ctime"/>
            <result column="filters.utime" property="utime"/>
        </collection>
    </resultMap>

    <select id="getFilterById" resultMap="QueryResultMap">
        SELECT
            a.*, b.phone AS 'filters.phone',
            b.push_template_id AS 'filters.push_template_id',
            b. STATUS AS 'filters.status',
            b.ctime AS 'filters.ctime',
            b.utime AS 'filters.utime',
            b.type AS 'filters.type'
        FROM
            push_template a
        LEFT JOIN push_template_filter b ON a.id = b.push_template_id
        AND b.`status` = 1
        WHERE
            a.id = #{value}
        AND a.`status` = 1
    </select>

  

 

上一篇:vue-filter的基本使用


下一篇:标准化和归一化(综合)