Merge remote-tracking branch 'origin/test' into test

# Conflicts:
#	src/main/resources/mapper/course/CourseDao.xml
This commit is contained in:
Tankaikai
2024-12-30 20:24:52 +08:00
11 changed files with 93 additions and 67 deletions

View File

@@ -52,13 +52,13 @@
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and date_format(u.create_time,'%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
and u.create_time BETWEEN #{startTime} and #{endTime}
</if>
<if test="startTime!=null and startTime!='' and (endTime==null or endTime=='')">
and date_format(u.create_time,'%Y-%m-%d') &gt;= #{startTime}
and u.create_time &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!='' and (startTime==null or startTime=='')">
and date_format(u.create_time,'%Y-%m-%d') &lt;= #{endTime}
and u.create_time &lt;= #{endTime}
</if>
order by create_time desc
</select>
@@ -136,7 +136,6 @@
</select>
<select id="queryCourseOrder" resultType="com.sqx.modules.app.response.CourseOrderResponse">
select * from (
select c.course_id as courseId,sum(o.pay_money) as 'coursemoney' ,count(*) as 'coursenum',any_value(c.title) as 'coursename'
from orders o
left join course c on o.course_id=c.course_id
@@ -144,18 +143,9 @@
<if test="sysUserId!=null">
and sys_user_id=#{sysUserId}
</if>
<if test="type==1">
and date_format(o.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
</if>
<if test="type==2">
and date_format(o.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
</if>
<if test="type==3">
and date_format(o.create_time,'%Y')=date_format(#{date},'%Y')
</if>
and o.create_time between #{start} and #{end}
group by c.course_id
) a
order by a.coursenum desc
order by coursenum desc
</select>
<select id="userMessage" resultType="int">
select count(*) from tb_user t
@@ -335,4 +325,4 @@
</update>
</mapper>
</mapper>

View File

@@ -6,6 +6,34 @@
<select id="selectCourseByCollect" resultType="com.sqx.modules.course.entity.Course">
SELECT
MAX(u.update_time) AS produceEndTime,
c.*,
d1.course_details_name AS courseDetailsName,
d1.course_details_id AS courseDetailsId,
COUNT(d2.course_details_id) AS courseDetailsCount
FROM
course_collect u
LEFT JOIN
course c ON u.course_id = c.course_id
LEFT JOIN
course_collect cc1 ON cc1.course_id = u.course_id
AND cc1.classify = 3
AND cc1.user_id = #{userId}
LEFT JOIN
course_details d1 ON cc1.course_details_id = d1.course_details_id
LEFT JOIN
course_details d2 ON d2.course_id = c.course_id
WHERE
u.user_id = #{userId}
AND c.course_id IS NOT NULL
AND u.classify = #{classify}
GROUP BY
u.course_id, c.course_id
ORDER BY
produceEndTime DESC;
<!-- SELECT
MAX( u.update_time ) AS produceEndTime,
c.*,
(
@@ -46,6 +74,7 @@
u.course_id
ORDER BY
produceEndTime DESC
-->
</select>
</mapper>
</mapper>

View File

@@ -30,43 +30,15 @@
</select>
<select id="sumMoney" resultType="Double">
select sum(money) from cash_out where state =1
<if test="flag!=null and flag==1">
and date_format(create_at,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
</if>
<if test="flag!=null and flag==2">
and date_format(create_at,'%Y-%m')=date_format(#{time},'%Y-%m')
</if>
<if test="flag!=null and flag==3">
and date_format(create_at,'%Y')=date_format(#{time},'%Y')
</if>
select sum(money) from cash_out where state = 1 and create_at between #{start} and #{end}
</select>
<select id="countMoney" resultType="Integer">
select count(*) from cash_out where
<if test="flag!=null and flag==1">
date_format(create_at,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
</if>
<if test="flag!=null and flag==2">
date_format(create_at,'%Y-%m')=date_format(#{time},'%Y-%m')
</if>
<if test="flag!=null and flag==3">
date_format(create_at,'%Y')=date_format(#{time},'%Y')
</if>
select count(*) from cash_out where create_at between #{start} and #{end}
</select>
<select id="stayMoney" resultType="Integer">
select count(*) from cash_out where
<if test="flag!=null and flag==1">
date_format(create_at,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
</if>
<if test="flag!=null and flag==2">
date_format(create_at,'%Y-%m')=date_format(#{time},'%Y-%m')
</if>
<if test="flag!=null and flag==3">
date_format(create_at,'%Y')=date_format(#{time},'%Y')
</if>
and state=0
select count(*) from cash_out where create_at between #{start} and #{end} and state=0
</select>
<select id="selectMayMoney" resultType="Double">