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

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条)

报告相同问题?

悬赏问题

  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
  • ¥15 下列c语言代码为何输出了多余的空格