以下是多表查询得XML写法,请问一下如果使用MybatisPlus得话,应该怎么简化他呢,不直接使用XML来实现
<resultMap id="BaseResultMap" type="com.tedu.pojo.admin.Problem" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="video_id" property="videoId" jdbcType="VARCHAR" />
<result column="from_user_id" property="fromUserId" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="comment" property="comment" jdbcType="LONGVARCHAR" />
<result column="face_image" property="faceImage" jdbcType="VARCHAR" />
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
<result column="toNickname" property="toNickname" jdbcType="VARCHAR" />
</resultMap>
<select id="queryComments" resultMap="BaseResultMap" parameterType="String">
select c.*,u.face_image as face_image,u.nickname,tu.nickname as toNickname
from comments c
left join users u on c.from_user_id = u.id
left join users tu on c.to_user_id = tu.id
where c.video_id = #{videoId} order by c.create_time desc
</select>