|
@@ -45,6 +45,54 @@
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap id="gameResultMap" type="org.jeecg.modules.app.vo.game.FindByIdResponse">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="cover" column="cover"/>
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="startTime" column="start_time"/>
|
|
|
+ <result property="endTime" column="end_time"/>
|
|
|
+ <result property="organizers" column="organizers"/>
|
|
|
+ <result property="reminder" column="reminder"/>
|
|
|
+ <result property="backgroundImage" column="background_image"/>
|
|
|
+ <result property="applicationEndTime" column="application_end_time"/>
|
|
|
+ <result property="address" column="address"/>
|
|
|
+ <result property="isEntry" column="is_entry"/>
|
|
|
+ <result property="km" column="km"/>
|
|
|
+ <result property="type" column="type"/>
|
|
|
+ <result property="phone" column="mobile"/>
|
|
|
+ <result property="latitude" column="latitude"/>
|
|
|
+ <result property="longitude" column="longitude"/>
|
|
|
+
|
|
|
+ <!-- 关联查询 - 赛程安排 -->
|
|
|
+ <collection property="gameScheduleVOList" ofType="org.jeecg.modules.app.vo.game.GameScheduleVO" javaType="java.util.List" columnPrefix="c_">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="arrange" column="arrange"/>
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="startTime" column="start_time"/>
|
|
|
+ <result property="endTime" column="end_time"/>
|
|
|
+ <result property="startStatus" column="startStatus"/>
|
|
|
+ </collection>
|
|
|
+ <!-- 关联查询 - 比赛项目价格规则 -->
|
|
|
+ <collection property="gamePriceRulesVOList" ofType="org.jeecg.modules.app.vo.game.GamePriceRulesVO" javaType="java.util.List" columnPrefix="b_">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="categoryName" column="category_name"/>
|
|
|
+ <result property="categoryId" column="category_id"/>
|
|
|
+ <result property="sellingPrice" column="selling_price" javaType="java.math.BigDecimal"/>
|
|
|
+ <result property="peopleNum" column="people_num"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <resultMap id="findByGameIdPriceVoMap" type="org.jeecg.modules.app.vo.game.FindByGameIdPriceVo">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="aptitudes" column="aptitudes"/>
|
|
|
+ <!-- 关联查询 - 比赛项目安排 -->
|
|
|
+ <collection property="gamePriceRulesTypeVOList" ofType="org.jeecg.modules.app.vo.game.GamePriceRulesTypeVO" javaType="java.util.List">
|
|
|
+ <id property="type" column="type"/>
|
|
|
+ <result property="typeName" column="type_name"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<select id="convertSearchCompetitionVOPage" resultType="org.jeecg.modules.app.vo.SearchVO$SearchRaceVO" parameterType="org.jeecg.modules.app.dto.SearchDTO">
|
|
|
SELECT
|
|
|
a.id,
|
|
@@ -68,20 +116,52 @@
|
|
|
</if>
|
|
|
ORDER BY a.end_time ASC;
|
|
|
</select>
|
|
|
+<!-- <select id="findPage" resultMap="appGameDTOResult">-->
|
|
|
+<!-- select a.id as a_id, a.org_code as a_org_code, a.tenant_id as a_tenant_id, a.name as a_name, a.cover as a_cover,-->
|
|
|
+<!-- a.background_image as a_background_image, a.organizers as a_organizers, a.site_type as a_site_type,-->
|
|
|
+<!-- a.site_id as a_site_id, a.province_code as a_province_code,a.city_code as a_city_code,-->
|
|
|
+<!-- a.area_code as a_area_code, IFNULL(b.name, a.address) as a_address, IFNULL(b.latitude, a.latitude) as a_latitude,IFNULL(b.longitude, a.longitude) as a_longitude,-->
|
|
|
+<!-- a.application_end_time as a_application_end_time, a.insure_ids as a_insure_ids, a.start_time as a_start_time,-->
|
|
|
+<!-- a.end_time as a_end_time, a.reminder as a_reminder, a.aptitudes as a_aptitudes, a.game_results as a_game_results,a.create_time as a_create_time,-->
|
|
|
+<!-- c.id AS c_id,c.game_id as c_game_id,c.type as c_type,d.name as c_category_name,c.category_id as c_category_id,c.selling_price as c_selling_price-->
|
|
|
+<!-- ,c.people_num as c_people_num,c.type as c_type,e.id as e_id,e.name as e_scheduleName,e.start_time as e_eStartTime,e.end_time as e_eEndTime, e.arrange as e_arrange-->
|
|
|
+<!-- from nm_game a-->
|
|
|
+<!-- left join nm_site b on a.site_id = b.id and b.del_flag=0-->
|
|
|
+<!-- left join nm_game_price_rules c on c.game_id = a.id and c.del_flag=0-->
|
|
|
+<!-- left join nm_game_schedule e on e.game_id =a.id-->
|
|
|
+<!-- left join nm_category d on c.category_id = d.id and d.del_flag=0-->
|
|
|
+<!-- where a.del_flag = 0-->
|
|
|
+<!-- <if test="appGamePageDTO != null and appGamePageDTO != ''">-->
|
|
|
+<!-- <if test="appGamePageDTO.name != null and appGamePageDTO.name != ''">-->
|
|
|
+<!-- AND a.name LIKE CONCAT('%',#{appGamePageDTO.name},'%')-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="appGamePageDTO.categoryId != null and appGamePageDTO.categoryId != ''">-->
|
|
|
+<!-- AND a.id in (select game_id from nm_game_price_rules where category_id = #{appGamePageDTO.categoryId} )-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="appGamePageDTO.endTime!=null and staffRequestVO.endTime!=''">-->
|
|
|
+<!-- <![CDATA[ AND DATE_FORMAT(a.application_end_time, '%Y-%m-%d')<= DATE_FORMAT(#{appGamePageDTO.endTime}, '%Y-%m-%d') ]]>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="appGamePageDTO.startTime!=null and appGamePageDTO.startTime!=''">-->
|
|
|
+<!-- <![CDATA[ AND DATE_FORMAT(a.application_end_time, '%Y-%m-%d')<= DATE_FORMAT(#{appGamePageDTO.startTime}, '%Y-%m-%d') ]]>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="appGamePageDTO.orgCode != null and appGamePageDTO.orgCode != ''">-->
|
|
|
+<!-- AND a.org_code LIKE CONCAT(#{appGamePageDTO.orgCode},'%')-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
<select id="findPage" resultMap="appGameDTOResult">
|
|
|
select a.id as a_id, a.org_code as a_org_code, a.tenant_id as a_tenant_id, a.name as a_name, a.cover as a_cover,
|
|
|
- a.background_image as a_background_image, a.organizers as a_organizers, a.site_type as a_site_type,
|
|
|
- a.site_id as a_site_id, a.province_code as a_province_code,a.city_code as a_city_code,
|
|
|
- a.area_code as a_area_code, IFNULL(b.name, a.address) as a_address, IFNULL(b.latitude, a.latitude) as a_latitude,IFNULL(b.longitude, a.longitude) as a_longitude,
|
|
|
- a.application_end_time as a_application_end_time, a.insure_ids as a_insure_ids, a.start_time as a_start_time,
|
|
|
- a.end_time as a_end_time, a.reminder as a_reminder, a.aptitudes as a_aptitudes, a.game_results as a_game_results,a.create_time as a_create_time,
|
|
|
- c.id AS c_id,c.game_id as c_game_id,c.type as c_type,d.name as c_category_name,c.category_id as c_category_id,c.selling_price as c_selling_price
|
|
|
- ,c.people_num as c_people_num,c.type as c_type,e.id as e_id,e.name as e_scheduleName,e.start_time as e_eStartTime,e.end_time as e_eEndTime, e.arrange as e_arrange
|
|
|
- from nm_game a
|
|
|
- left join nm_site b on a.site_id = b.id and b.del_flag=0
|
|
|
- left join nm_game_price_rules c on c.game_id = a.id and c.del_flag=0
|
|
|
- left join nm_game_schedule e on e.game_id =a.id
|
|
|
- left join nm_category d on c.category_id = d.id and d.del_flag=0
|
|
|
+ a.background_image as a_background_image, a.organizers as a_organizers, a.site_type as a_site_type,
|
|
|
+ a.site_id as a_site_id, a.province_code as a_province_code,a.city_code as a_city_code,
|
|
|
+ a.area_code as a_area_code, IFNULL(b.name, a.address) as a_address, IFNULL(b.latitude, a.latitude) as a_latitude,IFNULL(b.longitude, a.longitude) as a_longitude,
|
|
|
+ a.application_end_time as a_application_end_time, a.insure_ids as a_insure_ids, a.start_time as a_start_time,
|
|
|
+ a.end_time as a_end_time, a.reminder as a_reminder, a.aptitudes as a_aptitudes, a.game_results as a_game_results,a.create_time as a_create_time
|
|
|
+ from nm_game a
|
|
|
+ left join nm_site b on a.site_id = b.id and b.del_flag=0
|
|
|
+ left join nm_game_price_rules c on c.game_id = a.id and c.del_flag=0
|
|
|
+ left join nm_game_schedule e on e.game_id =a.id
|
|
|
+ left join nm_category d on c.category_id = d.id and d.del_flag=0
|
|
|
where a.del_flag = 0
|
|
|
<if test="appGamePageDTO != null and appGamePageDTO != ''">
|
|
|
<if test="appGamePageDTO.name != null and appGamePageDTO.name != ''">
|
|
@@ -100,5 +180,90 @@
|
|
|
AND a.org_code LIKE CONCAT(#{appGamePageDTO.orgCode},'%')
|
|
|
</if>
|
|
|
</if>
|
|
|
+ group by a.id
|
|
|
+ order by a.application_end_time desc
|
|
|
+ </select>
|
|
|
+ <select id="findConcerts" resultType="org.jeecg.modules.app.vo.game.FindPagResponse">
|
|
|
+ <![CDATA[
|
|
|
+ select
|
|
|
+ a.id,a.cover,a.name,a.start_time,a.end_time,MIN(b.selling_price) as min_price,
|
|
|
+ IFNULL(d.name, a.address) as address
|
|
|
+ ,a.application_end_time
|
|
|
+ ,CASE
|
|
|
+ WHEN a.application_end_time <= NOW()
|
|
|
+ THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END AS is_entry
|
|
|
+ , ST_Distance_Sphere(
|
|
|
+ POINT(#{longitude}, #{latitude}),
|
|
|
+ POINT(IFNULL(d.longitude, a.longitude),IFNULL(d.latitude, a.latitude))
|
|
|
+ ) /1000 AS km,
|
|
|
+ CASE
|
|
|
+ WHEN EXISTS (SELECT 1 FROM nm_game_price_rules WHERE game_id = a.id AND del_flag = 0 AND type = 0)
|
|
|
+ AND EXISTS (SELECT 1 FROM nm_game_price_rules WHERE game_id = a.id AND del_flag = 0 AND type = 1)
|
|
|
+ THEN 2
|
|
|
+ ELSE MAX(b.type)
|
|
|
+ END AS type
|
|
|
+ from nm_game a
|
|
|
+ left JOIN nm_game_price_rules b on a.id = b.game_id and b.del_flag=0
|
|
|
+ LEFT JOIN nm_game_schedule c on a.id = c.game_id and c.del_flag=0
|
|
|
+ left join nm_site d on a.site_id = d.id and d.del_flag=0
|
|
|
+ where a.del_flag=0
|
|
|
+ GROUP BY a.id
|
|
|
+ ORDER BY a.application_end_time DESC
|
|
|
+ ]]>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findById" resultMap="gameResultMap">
|
|
|
+ <![CDATA[
|
|
|
+ select
|
|
|
+ a.id ,a.cover ,a.name,a.start_time ,a.end_time ,a.organizers,a.reminder,
|
|
|
+ a.background_image,f.mobile,IFNULL(d.longitude, a.longitude) as longitude,IFNULL(d.latitude, a.latitude) as latitude,
|
|
|
+ IFNULL(d.name, a.address) as address
|
|
|
+ ,a.application_end_time as application_end_time,
|
|
|
+ CASE
|
|
|
+ WHEN a.application_end_time < NOW() THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END AS is_entry,
|
|
|
+ ST_Distance_Sphere(
|
|
|
+ POINT(#{longitude}, #{latitude}),
|
|
|
+ POINT(IFNULL(d.longitude, a.longitude),IFNULL(d.latitude, a.latitude))
|
|
|
+ ) /1000 AS km,
|
|
|
+ CASE
|
|
|
+ WHEN EXISTS (SELECT 1 FROM nm_game_price_rules WHERE game_id = a.id AND del_flag = 0 AND type = 0)
|
|
|
+ AND EXISTS (SELECT 1 FROM nm_game_price_rules WHERE game_id = a.id AND del_flag = 0 AND type = 1)
|
|
|
+ THEN 3
|
|
|
+ ELSE MAX(b.type)
|
|
|
+ END AS type,
|
|
|
+ c.name as c_name ,c.start_time as c_start_time,c.end_time as c_end_time,c.arrange as c_arrange,
|
|
|
+ CASE
|
|
|
+ WHEN NOW() < c.start_time THEN '未开始'
|
|
|
+ WHEN NOW() >= c.end_time THEN '已结束'
|
|
|
+ ELSE '进行中'
|
|
|
+ END AS c_startStatus,c.id as c_id,
|
|
|
+ e.name as b_category_name,b.category_id as b_category_id,b.id as b_id,b.selling_price as b_selling_price,b.people_num as b_people_num
|
|
|
+ from nm_game a
|
|
|
+ left JOIN nm_game_price_rules b on a.id = b.game_id and b.del_flag=0
|
|
|
+ LEFT JOIN nm_game_schedule c on a.id = c.game_id and c.del_flag=0
|
|
|
+ left join nm_site d on a.site_id = d.id and d.del_flag=0
|
|
|
+ left join nm_category e on b.category_id = e.id and e.del_flag=0
|
|
|
+ left join sys_depart f on a.org_code = f.org_code and f.del_flag=0
|
|
|
+ WHERE a.del_flag=0 and a.id =#{id}
|
|
|
+ GROUP BY a.id,b.id,c.id
|
|
|
+ ORDER BY a.application_end_time DESC
|
|
|
+ ]]>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findByGameId" resultMap="findByGameIdPriceVoMap">
|
|
|
+ select a.id,a.aptitudes,b.type,
|
|
|
+ CASE
|
|
|
+ WHEN b.type = 0 THEN '个人赛项目'
|
|
|
+ WHEN b.type = 1 THEN '团队赛项目'
|
|
|
+ ELSE '未知类型项目'
|
|
|
+ END AS type_name
|
|
|
+ from nm_game a
|
|
|
+ LEFT JOIN nm_game_price_rules b on a.id = b.game_id and b.del_flag=0
|
|
|
+ where a.del_flag=0 and a.id=#{id}
|
|
|
+ group by a.id, b.type
|
|
|
</select>
|
|
|
</mapper>
|