<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.system.mapper.info.XiaoyuanInfoMapper">
    <resultMap type="org.dromara.system.domain.info.vo.XiaoyuanInfoVo" id="XiaoyuanInfoResult">
        <result property="infoId"    column="info_id"    />
        <result property="infoTitle"    column="info_title"    />
        <result property="infoPhoto"    column="info_photo"    />
        <result property="schoolId"    column="school_id"    />
        <result property="schoolName"    column="school_name"    />
        <result property="infoType"    column="info_type"    />
        <result property="infoTypeZi"    column="info_type_zi"    />
        <result property="infoContent"    column="info_content"    />
        <result property="status"    column="status"    />
        <result property="faBuTime"    column="fa_bu_time"    />
        <result property="infoYiDu"    column="info_yi_du"    />
        <result property="infoDianZanId"    column="info_dian_zan_id"    />
        <result property="infoDianZan"    column="info_dian_zan"    />
        <result property="infoZhuanFa"    column="info_zhuan_fa"    />
        <result property="infoPingLunId"    column="info_ping_lun_id"    />
    </resultMap>

    <resultMap id="XiaoyuanInfoInfoPingLunResult" type="org.dromara.system.domain.info.vo.XiaoyuanInfoVo" extends="XiaoyuanInfoResult">
        <collection property="infoPingLunList" notNullColumn="sub_info_PingLun_id" javaType="java.util.List" resultMap="InfoPingLunResult" />
    </resultMap>

    <resultMap type="org.dromara.system.domain.info.vo.InfoPingLunVo" id="InfoPingLunResult">
        <result property="infoPingLunId"    column="sub_info_PingLun_id"    />
        <result property="infoId"    column="sub_info_id"    />
        <result property="infoPingLunParent"    column="sub_info_PingLun_parent"    />
        <result property="infoPingLunContent"    column="sub_info_PingLun_content"    />
        <result property="avatar"    column="sub_avatar"    />
        <result property="infoPingLunUserId"    column="sub_info_PingLun_user_id"    />
        <result property="infoPingLunUserName"    column="sub_info_PingLun_user_name"    />
        <result property="infoPingLunQuiltUserId"    column="sub_info_PingLun_quilt_user_id"    />
        <result property="infoPingLunQuiltUserName"    column="sub_info_PingLun_quilt_user_name"    />
        <result property="pingLunTime"    column="sub_PingLun_time"    />
        <result property="infoPingLunType"    column="sub_info_PingLun_type"    />
        <result property="infoPingLunExamine"    column="sub_info_PingLun_examine"    />
    </resultMap>
    <select id="selectXiaoyuanInfoByInfoId" parameterType="Long" resultMap="XiaoyuanInfoInfoPingLunResult">
        select a.info_id, a.info_title, a.info_photo, a.school_id, a.school_name, a.info_type, a.info_type_zi, a.info_content, a.status, a.fa_bu_time, a.info_yi_du, a.info_dian_zan_id,a.info_dian_zan, a.info_zhuan_fa, a.info_ping_lun_id, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
               b.info_pinglun_id as sub_info_PingLun_id, b.info_id as sub_info_id, b.info_ping_lun_parent as sub_info_PingLun_parent, b.info_ping_lun_content as sub_info_PingLun_content, b.avatar as sub_avatar, b.info_ping_lun_user_id as sub_info_PingLun_user_id, b.info_ping_lun_user_name as sub_info_PingLun_user_name, b.info_ping_lun_quilt_user_id as sub_info_PingLun_quilt_user_id, b.info_ping_lun_quilt_user_name as sub_info_PingLun_quilt_user_name, b.ping_lun_time as sub_PingLun_time, b.info_ping_lun_type as sub_info_PingLun_type, b.info_ping_lun_examine as sub_info_PingLun_examine, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark
        from xiaoyuan_info a
                 left join info_pinglun b on b.info_id = a.info_id
        where a.info_id = #{infoId}
    </select>
</mapper>
