<?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.ask.mapper.OrderCustomMapper">
<resultMap type="com.ask.pojo.OrderCustom" id="orderCustom">
<id column="id" property="id"/>
<result column="user_id" property="user_id"/>
<result column="number" property="number"/>
<result column="createTime" property="createTime"/>
<result column="note" property="note"/>
<result column="username" property="name"/>
<result column="address" property="address"/>
</resultMap>
<!-- 内接关联查询 -->
<select id="getOrderAndUser" resultMap="orderCustom">
SELECT
o.*,
u.username,
u.address
FROM
orders o,
USER u
WHERE o.user_id = u.id
</select>

</mapper>