|
|
@@ -8,29 +8,31 @@
|
|
|
</insert>
|
|
|
<!-- 新增游记内容 -->
|
|
|
<insert id="travelInster" parameterType="Travel">
|
|
|
- insert into bus_travel(code,title_img,synopsis,video_url,img_url,uuid,state_type,travel_date,travel_day,capita,figure,play_type,season,destination,jdrq,title,title_travel,demand_uuid,look_num)
|
|
|
- values (#{code},#{titleImg},#{synopsis},#{videoUrl},#{imgUrl},#{uuid},#{stateType},#{travelDate},#{travelDay},#{capita},#{figure},#{playType},#{season},#{destination},GETDATE(),#{title},#{titleTravel},#{demandUuid},0)
|
|
|
+ insert into bus_travel(code,title_img,synopsis,video_url,img_url,uuid,state_type,travel_date,travel_day,capita,figure,play_type,season,destination,jdrq,title,title_travel,demand_uuid,look_num,title_day_name)
|
|
|
+ values (#{code},#{titleImg},#{synopsis},#{videoUrl},#{imgUrl},#{uuid},#{stateType},#{travelDate},#{travelDay},#{capita},#{figure},#{playType},#{season},#{destination},GETDATE(),#{title},#{titleTravel},#{demandUuid},0,#{titleDayName})
|
|
|
</insert>
|
|
|
<!-- 查询游记内容 -->
|
|
|
<select id="getTravel" resultType="Travel">
|
|
|
select
|
|
|
a.*,b.countNum,c.flag,d.commCount
|
|
|
- from bus_travel a
|
|
|
- JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give GROUP BY travel_uuid ) b ON a.uuid = b.travel_uuid
|
|
|
- JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) c ON a.uuid = c.travel_uuid
|
|
|
- JOIN ( SELECT COUNT ( * ) AS commCount, travel_uuid FROM bus_travel_comments GROUP BY travel_uuid ) d ON a.uuid = d.travel_uuid
|
|
|
+ from
|
|
|
+ ( SELECT *, ROW_NUMBER ( ) OVER ( ORDER BY ID ) AS RowId FROM bus_travel ) AS a
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give GROUP BY travel_uuid ) b ON a.uuid = b.travel_uuid
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) c ON a.uuid = c.travel_uuid
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS commCount, travel_uuid FROM bus_travel_comments GROUP BY travel_uuid ) d ON a.uuid = d.travel_uuid
|
|
|
<trim prefix="WHERE" prefixOverrides="and | or">
|
|
|
+ RowId BETWEEN #{page} AND #{limit}
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="code != null and code != ''">
|
|
|
- and code = #{code}
|
|
|
+ and a.code = #{code}
|
|
|
</if>
|
|
|
<if test="stateType != null and stateType != ''">
|
|
|
- and state_type = #{stateType}
|
|
|
+ and a.state_type = #{stateType}
|
|
|
</if>
|
|
|
<if test="demandUuid != null and demandUuid != ''">
|
|
|
- and demand_uuid = #{demandUuid}
|
|
|
+ and a.demand_uuid = #{demandUuid}
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
@@ -38,19 +40,21 @@
|
|
|
<select id="getTravelAll" resultType="Travel">
|
|
|
select
|
|
|
a.*,b.countNum,c.flag,d.commCount
|
|
|
- from bus_travel a
|
|
|
- JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give GROUP BY travel_uuid ) b ON a.uuid = b.travel_uuid
|
|
|
- JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) c ON a.uuid = c.travel_uuid
|
|
|
- JOIN ( SELECT COUNT ( * ) AS commCount, travel_uuid FROM bus_travel_comments GROUP BY travel_uuid ) d ON a.uuid = d.travel_uuid
|
|
|
+ from
|
|
|
+ ( SELECT *, ROW_NUMBER ( ) OVER ( ORDER BY ID ) AS RowId FROM bus_travel ) AS a
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give GROUP BY travel_uuid ) b ON a.uuid = b.travel_uuid
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) c ON a.uuid = c.travel_uuid
|
|
|
+ LEFT JOIN ( SELECT COUNT ( * ) AS commCount, travel_uuid FROM bus_travel_comments GROUP BY travel_uuid ) d ON a.uuid = d.travel_uuid
|
|
|
<trim prefix="WHERE" prefixOverrides="and | or">
|
|
|
+ RowId BETWEEN #{page} AND #{limit}
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="stateType != null and stateType != ''">
|
|
|
- and state_type = #{stateType}
|
|
|
+ and a.state_type = #{stateType}
|
|
|
</if>
|
|
|
<if test="demandUuid != null and demandUuid != ''">
|
|
|
- and demand_uuid = #{demandUuid}
|
|
|
+ and a.demand_uuid = #{demandUuid}
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
@@ -117,6 +121,9 @@
|
|
|
<if test="titleTravel != null and titleTravel != ''">
|
|
|
title_travel=#{titleTravel},
|
|
|
</if>
|
|
|
+ <if test="titleDayName != null and titleDayName != ''">
|
|
|
+ title_day_name=#{titleDayName},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</set>
|
|
|
where uuid = #{uuid}
|