hentai龍 2019-09-09 23:35 采纳率: 0%
浏览 1210

MyBatis怎么进行三表联立查询啊

user表

图片说明

book表

图片说明

shopcart表

图片说明

三表联立关系

图片说明

user类

    private int user_id;
    private String user_name;
    private String user_account;
    private String user_pwd;
    private String user_time;
    private String user_icon;
    private String user_iphone;
    private String user_email;

book类

    private int book_id;
    private String book_name;
    private String book_author;
    private String book_into;
    private String book_img;
    private float book_price;
    private String book_time;

shopcart类

    private int cart_id;
    private int user_id;
    private int book_id;
    private int num;
    private User user;
    private Book book;

xml文件

    <select id="findCart" parameterType="shopCart" resultMap="shopCarts">
        SELECT user.user_id,book.*,shoppingcart.num FROM user,book,shoppingcart WHERE user.user_id = shoppingcart.user_id and book.book_id = shoppingcart.book_id AND user.user_id = #{user_id};
    </select>


<resultMap type="shopCart" id="shopCarts" >
    <id property="card_id" column="card_id"/>
    <result property="book_id" column="book_id"/>
    <result property="user_id" column="user_id"/>
    <collection property="book_id" ofType="book"/>
       <result property="book_name" column="book_name"/>
       <result property="book_author" column="book_author"/>
       <result property="book_into" column="book_into"/>
        <result property="book_img" column="book_img"/>
        <result property="book_price" column="book_price"/>
         <result property="book_time" column="book_time"/>
      </collection>

          <collection property="user" ofType="user">
          <id property="user_id" column="user_id"/>
         <result property="class_name" column="class_name"/>
          </collection>
   </resultMap>

报错

The element type "resultMap" must be terminated by the matching end-tag "</resultMap>".

那个xml文件该怎么写啊

  • 写回答

1条回答

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图2.0 版本点聚合中Marker的位置无法实时更新,如何解决呢?
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题