<?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.xxfc.platform.tour.mapper.TourUserScoreMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.xxfc.platform.tour.entity.TourUserScore" id="tourUserScoreMap">
        <result property="id" column="id"/>
        <result property="userId" column="user_id"/>
        <result property="orderId" column="order_id"/>
        <result property="modelId" column="model_id"/>
        <result property="type" column="type"/>
        <result property="aveScore" column="ave_score"/>
        <result property="scores" column="scores"/>
        <result property="isAnony" column="is_anony"/>
        <result property="comment" column="comment"/>
        <result property="imgs" column="imgs"/>
        <result property="status" column="status"/>
        <result property="crtTime" column="crt_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="isDel" column="is_del"/>
    </resultMap>

    <!--查询评价-->
     <select id="findyByGoodIdAndApproved">
         select `user_id` as `userId`,`comment` as `comment`,`ave_score` as `aveScore`,`is_anony` as `isAnony`,`imgs` as `imgs`,`crt_time` as `crtTime` from `tour_user_score` where `model_id`=#{goodId}
     </select>

    <!--根据订单id查询-->
    <select id="findTourUserScoreDetailByOrderId"
            resultType="com.xxfc.platform.tour.dto.TourUserScoreDetailDTO">
SELECT tus.user_id as `userId`,tus.ave_score as `aveScore`,tus.comment as `comment`, tus.imgs as `imgs`,tus.crt_time as `crtTime`,tus.scores as `scores`,tg.name as `name`,tg.describes as `describes`,tg.cover as `cover`
FROM `tour_user_score` as `tus` left JOIN `tour_good` as `tg` on tus.model_id=tg.id WHERE tus.order_id=#{orderId} ;
    </select>
</mapper>
