翻滚吧翻滚吧 2019-05-15 11:27 采纳率: 66.7%
浏览 485
已采纳

mysql 查询两张表 只显示了一个表的 一条数据 这是什么原因 望各位大神帮助一下



         <sql id="Base_Column_List">
        id_, uuid_, resourcePrimKey, groupId, companyId, userId, userName, createDate, modifiedDate,
        folderId, classNameId, classPK, treePath, articleId, version, title, urlTitle, description,
        content, type_, structureId, templateId, layoutUuid, displayDate, expirationDate,
        reviewDate, indexable, smallImage, smallImageId, smallImageURL, status, statusByUserId,
        statusByUserName, statusDate
    </sql>
    <select id="selectCMSList"  resultMap="BaseResultMap">
        SELECT
        j.title,j.content,j.userName,
        j.createDate, cm.url
        FROM journalarticle j inner join cmspublishedarticle cm
        on j.resourcePrimKey=cm.resourcePrimKey
        limit 0,10000

    </select>



          List<Journalarticle> selectCMSList();


            <resultMap id="BaseResultMap" type="com.sn.pojo.Journalarticle">
        <id column="id_" jdbcType="BIGINT" property="id" />
        <result column="uuid_" jdbcType="VARCHAR" property="uuid" />
        <result column="resourcePrimKey" jdbcType="BIGINT" property="resourceprimkey" />
        <result column="userName" jdbcType="VARCHAR" property="username" />
        <result column="createDate" jdbcType="TIMESTAMP" property="createdate" />
        <result column="modifiedDate" jdbcType="TIMESTAMP" property="modifieddate" />
        <result column="folderId" jdbcType="BIGINT" property="folderid" />
        <result column="classNameId" jdbcType="BIGINT" property="classnameid" />
        <result column="title" jdbcType="VARCHAR" property="title" />
        <result column="urlTitle" jdbcType="VARCHAR" property="urltitle" />
        <result column="description" jdbcType="VARCHAR" property="description" />
        <result column="content" jdbcType="VARCHAR" property="content" />
        <result column="type_" jdbcType="VARCHAR" property="type" />
        <result column="indexable" jdbcType="TINYINT" property="indexable" />
        <result column="statusDate" jdbcType="TIMESTAMP" property="statusdate" />
        <association  property="cmspublishedarticle"  javaType="com.sn.pojo.Cmspublishedarticle">
            <id column="resourcePrimKey" jdbcType="BIGINT" property="resourceprimkey" />
            <result column="url" jdbcType="VARCHAR" property="url" />
        </association>
    </resultMap>

  • 写回答

2条回答 默认 最新

  • 土灵猪 2019-05-15 12:10
    关注

    结果类型BaseResultMap与 j.title,j.content,j.userName,j.createDate, cm.url这个不匹配

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵