|
@@ -0,0 +1,42 @@
|
|
|
+<?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.chelvc.cloud.vehicle.server.dao.ReservationMapper">
|
|
|
+
|
|
|
+ <resultMap id="RESERVATION_RESULT_MAP" type="com.chelvc.cloud.vehicle.server.entity.Reservation">
|
|
|
+ <id column="id" property="id" jdbcType="BIGINT"/>
|
|
|
+ <result column="user_id" property="userId" jdbcType="BIGINT"/>
|
|
|
+ <result column="merchant_id" property="merchantId" jdbcType="BIGINT"/>
|
|
|
+ <result column="mobile" property="mobile" jdbcType="VARCHAR"/>
|
|
|
+ <result column="appoint_time" property="appointTime" jdbcType="TIMESTAMP"/>
|
|
|
+ <result column="status" property="status" jdbcType="VARCHAR"/>
|
|
|
+ <result column="creator" property="creator" jdbcType="BIGINT"/>
|
|
|
+ <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
|
|
+ <result column="updater" property="updater" jdbcType="BIGINT"/>
|
|
|
+ <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
|
|
+ <association property="merchant" javaType="com.chelvc.cloud.vehicle.api.dto.MerchantDTO">
|
|
|
+ <id column="merchant_id" property="id" jdbcType="BIGINT"/>
|
|
|
+ <result column="name" property="name" jdbcType="VARCHAR"/>
|
|
|
+ <result column="logo" property="logo" jdbcType="VARCHAR"/>
|
|
|
+ <result column="score" property="score" jdbcType="DOUBLE"/>
|
|
|
+ <result column="sale" property="sale" jdbcType="INTEGER"/>
|
|
|
+ <result column="address" property="address" jdbcType="VARCHAR"/>
|
|
|
+ <result column="distance" property="distance" jdbcType="DOUBLE"/>
|
|
|
+ </association>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="listUserReservations" resultMap="RESERVATION_RESULT_MAP">
|
|
|
+ select rn.id,rn.user_id,rn.merchant_id,rn.mobile,rn.appoint_time,rn.status, mt.name, mt.logo, mt.score,
|
|
|
+ mt.sale, mt.address
|
|
|
+ from reservation rn
|
|
|
+ inner join merchant mt on merchant_id = mt.id and mt.status = 'ONLINE'
|
|
|
+ where rn.user_id = #{userId}
|
|
|
+ <if test="param.offset != null">
|
|
|
+ and rn.id > #{param.offset}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null">
|
|
|
+ and rn.status = #{param.status}
|
|
|
+ </if>
|
|
|
+ order by rn.appoint_time asc
|
|
|
+ limit #{param.size}
|
|
|
+ </select>
|
|
|
+</mapper>
|