<?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="com.diagbot.mapper.InformationMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.Information">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="lib_id" property="libId" />
        <result column="title" property="title" />
        <result column="content" property="content" />
    </resultMap>

    <select id="getInformation" parameterType="com.diagbot.dto.LibraryDTO" resultType="com.diagbot.dto.InforDTO">
        SELECT
        a.id,
        a.title,
        a.content
        FROM information a
        LEFT JOIN library b on a.lib_id = b.id
        WHERE b.id = #{id}
    </select>

</mapper>
