123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <?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.travel.mapper.ReleaseTravelMapper">
- <!-- 新增每天游记内容 -->
- <insert id="travelInsterExper" parameterType="TravelExperience">
- insert into bus_travel_experience(uuid,day_num,synopsis,video_url,img_url,title) values(#{uuid},#{dayNum},#{synopsis},#{videoUrl},#{imgUrl},#{title})
- </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,people_all,title,title_travel,demand_uuid,look_num,title_day_name,amount,release_uuid)
- values (#{code},#{titleImg},#{synopsis},#{videoUrl},#{imgUrl},#{uuid},#{stateType},#{travelDate},#{travelDay},#{capita},#{figure},#{playType},#{season},#{destination},SYSDATETIME(),#{peopleAll},#{title},#{titleTravel},#{demandUuid},0,#{titleDayName},#{amount},#{releaseUuid})
- </insert>
- <!-- 查询游记内容 -->
- <select id="getTravel" resultType="Travel">
- select
- top ${limit} a.*,b.countNum,c.flag,d.commCount,f.name,f.headpir
- 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
- LEFT JOIN (SELECT headpir,name,code from sys_users) f on f.code = a.code
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="uuid != null and uuid != ''">
- and a.uuid = #{uuid}
- </if>
- <if test="code != null and code != ''">
- and a.code = #{code}
- </if>
- <if test="stateType != null and stateType != ''">
- and a.state_type = #{stateType}
- </if>
- <if test="demandUuid != null and demandUuid != ''">
- and a.demand_uuid = #{demandUuid}
- </if>
- and a.id not in (select top ${page} id from bus_travel ) order by a.id
- </trim>
- </select>
- <!-- 查询游记列表内容 -->
- <select id="getTravelAll" resultType="Travel">
- SELECT TOP
- ${limit} e.*
- FROM
- (
- SELECT
- a.id,
- a.uuid,
- a.img_url,
- a.look_num,
- a.code,
- a.capita,
- a.jdrq,
- a.title_img,
- a.title_travel,
- a.travel_date,
- a.title_day_name,
- a.amount,
- a.people_all,
- a.travel_day,
- a.synopsis,
- f.name,
- f.headpir,
- b.countNum,
- c.flag,
- d.commCount,
- 'ptyh' as typeForm
- 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
- LEFT JOIN ( SELECT headpir, name, code FROM sys_users ) f ON f.code = a.code
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="destination != null and destination != ''">
- a.destination like CONCAT(CONCAT('%', #{destination}), '%')
- </if>
- <if test="titleTravel != null and titleTravel != ''">
- a.title_travel like CONCAT(CONCAT('%', #{titleTravel}), '%')
- </if>
- <if test="jdrq != null and jdrq != ''">
- #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
- </if>
- </trim>
- UNION ALL
- SELECT
- a.id,
- a.uuid,
- a.title_img,
- a.look_num,
- a.code,
- (a.price_all / a.people_num) as capita,
- a.jdrq,
- a.title_img,
- a.offer_name as titleTravel,
- (a.start_time + '~' + a.end_time) as travelDate,
- a.title_day_name,
- a.price_all,
- a.people_num,
- datediff(day,a.start_time,a.end_time) as travelDay,
- null as synopsis,
- f.name,
- f.headpir,
- b.countNum,
- c.flag,
- d.commCount,
- 'gys' as typeForm
- FROM
- bus_supplier_route 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
- LEFT JOIN ( SELECT headpir, name, code FROM sys_supplier ) f ON f.code = a.code
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="destination != null and destination != ''">
- a.destination like CONCAT(CONCAT('%', #{destination}), '%')
- </if>
- <if test="titleTravel != null and titleTravel != ''">
- a.offer_name like CONCAT(CONCAT('%', #{titleTravel}), '%')
- </if>
- <if test="jdrq != null and jdrq != ''">
- #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
- </if>
- </trim>
- ) e
- where
- e.id not in (
- select top ${page} f.id
- from
- (select id,jdrq
- from bus_travel
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="destination != null and destination != ''">
- a.destination like CONCAT(CONCAT('%', #{destination}), '%')
- </if>
- <if test="titleTravel != null and titleTravel != ''">
- a.title_travel like CONCAT(CONCAT('%', #{titleTravel}), '%')
- </if>
- <if test="jdrq != null and jdrq != ''">
- #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
- </if>
- </trim>
- UNION ALL
- select
- id,jdrq
- from bus_supplier_route
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="destination != null and destination != ''">
- a.destination like CONCAT(CONCAT('%', #{destination}), '%')
- </if>
- <if test="titleTravel != null and titleTravel != ''">
- a.offer_name like CONCAT(CONCAT('%', #{titleTravel}), '%')
- </if>
- <if test="jdrq != null and jdrq != ''">
- #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
- </if>
- </trim>
- ) f ORDER BY f.jdrq desc)
- ORDER BY
- e.jdrq desc
- </select>
- <!-- 查询随机一条游记 -->
- <select id="getTravelOne" resultType="Travel" parameterType="Travel">
- select
- top ${limit} a.*,b.countNum,c.flag,d.commCount,f.name,f.headpir
- 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
- LEFT JOIN (SELECT headpir,name,code from sys_users) f on f.code = a.code
- ORDER BY NEWID()
- </select>
- <!-- 查询游记详情 -->
- <select id="getTravelID" resultType="Travel">
- SELECT
- a.*,b.name,b.headpir,c.countNum,d.commCount,e.sendTravelNum,f.collectionNum,g.conllectionCount,h.flag
- FROM
- bus_travel a
- LEFT JOIN (SELECT headpir,name,code from sys_users) b on b.code = a.code
- LEFT JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give 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
- LEFT JOIN ( SELECT COUNT ( * ) as sendTravelNum,code from bus_travel GROUP BY code ) e on a.code = e.code
- LEFT JOIN ( SELECT COUNT ( * ) as collectionNum,ordering_uuid from bus_collection where type = '1' and code = #{code} GROUP BY ordering_uuid ) f on a.uuid = f.ordering_uuid
- LEFT JOIN ( SELECT COUNT ( * ) as conllectionCount,ordering_uuid from bus_collection where type = '1' GROUP BY ordering_uuid ) g on a.uuid = g.ordering_uuid
- LEFT JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) h ON a.uuid = h.travel_uuid
- WHERE
- a.uuid = #{uuid}
- </select>
- <!-- 查询每天游记内容 -->
- <select id="getTravelExper" resultType="TravelExperience">
- select id,uuid,day_num as dayNum,synopsis,video_url as videoUrl,img_url as imgUrl,title
- from bus_travel_experience
- where uuid = #{uuid}
- </select>
- <!-- 删除游记 -->
- <delete id="delTravel" parameterType="Travel">
- delete from bus_travel where uuid = #{uuid} and code = #{code}
- </delete>
- <!-- 删除每日游记 -->
- <delete id="delTravelExper">
- delete from bus_travel_experience
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="uuid != null and uuid != ''">
- and uuid = #{uuid}
- </if>
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- </trim>
- </delete>
- <!-- 修改游记 -->
- <update id="updateTravel" parameterType="Travel">
- update bus_travel
- <set>
- <trim suffixOverrides=",">
- <if test="titleImg != null and titleImg != ''">
- title_img=#{titleImg},
- </if>
- <if test="synopsis != null and synopsis != ''">
- synopsis=#{synopsis},
- </if>
- <if test="videoUrl != null and videoUrl != ''">
- video_url=#{videoUrl},
- </if>
- <if test="imgUrl != null and imgUrl != ''">
- img_url=#{imgUrl},
- </if>
- <if test="travelDate != null and travelDate != ''">
- travel_date=#{travelDate},
- </if>
- <if test="travelDay != null and travelDay != ''">
- travel_day=#{travelDay},
- </if>
- <if test="capita != null and capita != ''">
- capita=#{capita},
- </if>
- <if test="figure != null and figure != ''">
- figure=#{figure},
- </if>
- <if test="playType != null and playType != ''">
- play_type=#{playType},
- </if>
- <if test="season != null and season != ''">
- season=#{season},
- </if>
- <if test="title != null and title != ''">
- title=#{title},
- </if>
- <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}
- </update>
- <!-- 查询是否点赞 -->
- <select id="getGiveCount" resultType="int">
- select count(*) as count from sys_travel_give where code = #{code} and travel_uuid = #{travelUuid}
- </select>
- <!-- 点赞 -->
- <insert id="addGive" parameterType="TravelGive">
- insert into sys_travel_give(code,jdrq,travel_uuid,uuid) values(#{code},format(SYSDATETIME(),'yyyy-MM-dd hh:mm:ss'),#{travelUuid},#{uuid})
- </insert>
- <!-- 取消点赞 -->
- <delete id="delGive" parameterType="TravelGive">
- delete from sys_travel_give where code = #{code} and travel_uuid=#{travelUuid}
- </delete>
- <!-- 查看数量 -->
- <update id="updateLookNum" parameterType="Travel">
- UPDATE bus_travel
- SET look_num = ( SELECT look_num + 1 FROM bus_travel WHERE uuid = #{uuid} )
- WHERE
- uuid = #{uuid}
- </update>
- <!-- 查询游记总数 -->
- <select id="getTravelCountAll" resultType="int">
- select count(*) as count
- from
- (
- select id
- from bus_travel
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="stateType != null and stateType != ''">
- and state_type = #{stateType}
- </if>
- <if test="demandUuid != null and demandUuid != ''">
- and demand_uuid = #{demandUuid}
- </if>
- <if test="code != null and code != ''">
- and code = #{code}
- </if>
- <if test="destination != null and destination != ''">
- destination = #{destination}
- </if>
- </trim>
- UNION ALL
- select id
- FROM bus_supplier_route
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="stateType != null and stateType != ''">
- and state_type = #{stateType}
- </if>
- <if test="demandUuid != null and demandUuid != ''">
- and demand_uuid = #{demandUuid}
- </if>
- <if test="code != null and code != ''">
- and code = #{code}
- </if>
- <if test="destination != null and destination != ''">
- destination = #{destination}
- </if>
- </trim>
- ) a
- </select>
- <!-- 查询游记总数个人 -->
- <select id="getTravelCount" resultType="int">
- select count(*) as count
- from bus_travel
- <trim prefix="WHERE" prefixOverrides="and | or">
- <if test="stateType != null and stateType != ''">
- and state_type = #{stateType}
- </if>
- <if test="code != null and code != ''">
- and code = #{code}
- </if>
- <if test="demandUuid != null and demandUuid != ''">
- and demand_uuid = #{demandUuid}
- </if>
- </trim>
- </select>
- <!-- 修改供应商路线查看次数 -->
- <update id="updateLookNumRoute" parameterType="Release">
- UPDATE bus_supplier_route
- SET look_num = ( SELECT look_num + 1 FROM bus_supplier_route WHERE uuid = #{uuid} )
- WHERE
- uuid = #{uuid}
- </update>
- <!-- 查询供应商路线详情 -->
- <select id="getTravelRoute" parameterType="Travel" resultType="Travel">
- SELECT
- a.id,
- a.code,
- a.title_img,
- null as synopsis,
- null as videoUrl,
- null as imgUrl,
- a.uuid,
- 0 as stateType,
- (a.start_time + '~' + a.end_time) as travelDate,
- datediff(day,a.start_time,a.end_time) as travelDay,
- (a.price_all / a.people_num) as capita,
- null as title,
- a.offer_name as titleTravel,
- a.uuid as demandUuid,
- a.jdrq,
- a.look_num,
- a.destination,
- b.name,
- b.headpir,
- c.countNum,
- d.commCount,
- e.sendTravelNum,
- f.collectionNum,
- g.conllectionCount,
- h.flag
- FROM
- bus_supplier_route a
- LEFT JOIN (SELECT headpir,name,code from sys_supplier) b on b.code = a.code
- LEFT JOIN ( SELECT COUNT ( * ) AS countNum, travel_uuid FROM sys_travel_give 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
- LEFT JOIN ( SELECT COUNT ( * ) as sendTravelNum,code from bus_supplier_route GROUP BY code ) e on a.code = e.code
- LEFT JOIN ( SELECT COUNT ( * ) as collectionNum,ordering_uuid from bus_collection where type = '2' and code = #{code} GROUP BY ordering_uuid ) f on a.uuid = f.ordering_uuid
- LEFT JOIN ( SELECT COUNT ( * ) as conllectionCount,ordering_uuid from bus_collection where type = '2' GROUP BY ordering_uuid ) g on a.uuid = g.ordering_uuid
- LEFT JOIN ( SELECT COUNT ( * ) AS flag, travel_uuid FROM sys_travel_give WHERE code = #{code} GROUP BY travel_uuid ) h ON a.uuid = h.travel_uuid
- WHERE
- a.uuid = #{uuid}
- </select>
- <!-- 查询订单完成的定制单并且是没写过游记的 -->
- <select id="getTravelRelese" resultType="PrivateOrder">
- SELECT
- b.uuid,
- b.start_time,
- b.end_time,
- c.uuid AS uuidRele,
- c.price_all,
- c.title_img,
- c.offer_name as offerName,
- c.order_no AS orderNoRelease,
- a.order_type AS orderType,
- e.name AS supplieName
- FROM
- bus_private_ordering AS b
- LEFT JOIN bus_supplier_release c ON b.uuid = c.demand_uuid
- LEFT JOIN sys_supplier e ON c.code = e.code
- JOIN bus_private_ordering_type a ON (order_type = '4' or order_type = '5') and b.uuid = a.demand_uuid
- where b.code = #{code} and b.uuid not in (select demand_uuid from bus_travel where code = #{code} )
- </select>
- <!-- 查询指定定制单内容 -->
- <select id="getTravelVal" resultType="PrivateOrder">
- SELECT
- b.*,
- a.price_all
- FROM
- bus_supplier_release a
- LEFT JOIN bus_private_ordering b on a.demand_uuid = b.uuid
- WHERE
- a.uuid = #{id}
- </select>
- </mapper>
|