|
@@ -80,4 +80,61 @@
|
|
|
instructorName,
|
|
|
instructorAvatar;
|
|
|
</select>
|
|
|
+ <select id="findByCourseList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
|
|
|
+ select b.`name`,e.address,b.original_price,b.selling_price
|
|
|
+ ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum
|
|
|
+ FROM nm_courses b
|
|
|
+ LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
|
|
|
+ LEFT JOIN nm_site e on e.id = b.site_id
|
|
|
+ where 1=1
|
|
|
+ <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
|
|
|
+ and b.user_id=#{courseRequestVo.instructorId}
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
|
|
|
+ and b.site_id=#{courseRequestVo.siteId}
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
|
|
|
+ and b.site_id=#{courseRequestVo.siteId}
|
|
|
+ </if>
|
|
|
+ GROUP BY b.id
|
|
|
+ </select>
|
|
|
+ <select id="findByLaLoList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
|
|
|
+ select b.`name`,e.address,b.original_price,b.selling_price
|
|
|
+ ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum,
|
|
|
+ ST_Distance_Sphere(
|
|
|
+ POINT(#{courseRequestVo.longitude}, #{courseRequestVo.latitude}),
|
|
|
+ POINT(e.longitude, e.latitude)
|
|
|
+ ) /1000 AS km
|
|
|
+ FROM nm_courses b
|
|
|
+ LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
|
|
|
+ LEFT JOIN nm_site e on e.id = b.site_id
|
|
|
+ GROUP BY b.id
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '1'">
|
|
|
+ ORDER BY km DESC
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '2'">
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="findByList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
|
|
|
+ select b.`name`,e.address,b.original_price,b.selling_price
|
|
|
+ ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum
|
|
|
+ FROM nm_courses b
|
|
|
+ LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
|
|
|
+ LEFT JOIN nm_site e on e.id = b.site_id
|
|
|
+ GROUP BY b.id
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '1'">
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '2'">
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </if>
|
|
|
+ <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|