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

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 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler