Merge branch 'dev/dev_xp' into dev/dev
# Conflicts: # src/main/java/com/ai/da/service/CollectionElementService.java # src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java
This commit is contained in:
@@ -29,5 +29,106 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 查询用户积分使用情况,可灵活按事件类型查询或查询全部 -->
|
||||
<select id="selectCreditUsage" resultType="com.ai.da.model.dto.AccountCreditsUsageDTO">
|
||||
SELECT
|
||||
a.id id,
|
||||
a.user_email,
|
||||
a.credits currentCredits,
|
||||
<if test="groupByEvent">
|
||||
cd.change_event generateFunction,
|
||||
</if>
|
||||
cd.total_changed_credits consumedCredits,
|
||||
cd.count_account_id usageCount
|
||||
FROM
|
||||
t_account a
|
||||
LEFT JOIN
|
||||
(SELECT
|
||||
account_id,
|
||||
<if test="groupByEvent">
|
||||
change_event,
|
||||
</if>
|
||||
SUM(changed_credits) AS total_changed_credits,
|
||||
COUNT(account_id) AS count_account_id
|
||||
FROM
|
||||
t_credits_detail
|
||||
WHERE
|
||||
changed_credits <= 0
|
||||
<if test="changeEvent != null and changeEvent != ''">
|
||||
AND change_event = #{changeEvent}
|
||||
</if>
|
||||
<!-- 添加时间区间查询条件 -->
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND cd.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND cd.create_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
account_id
|
||||
<if test="groupByEvent">
|
||||
, change_event
|
||||
</if>
|
||||
) cd
|
||||
ON
|
||||
a.id = cd.account_id
|
||||
WHERE
|
||||
<choose>
|
||||
<when test="role == 'corp'">
|
||||
a.system_user IN (5, 6)
|
||||
</when>
|
||||
<when test="role == 'edu'">
|
||||
a.system_user IN (7, 8)
|
||||
</when>
|
||||
<when test="role == 'prsn'">
|
||||
a.system_user IN (0, 1, 2, 3, 4)
|
||||
</when>
|
||||
</choose>
|
||||
<if test="id != null">
|
||||
AND a.id = #{id}
|
||||
</if>
|
||||
<if test="userEmail != null and userEmail != ''">
|
||||
AND a.user_email = #{userEmail}
|
||||
</if>
|
||||
<!-- 添加分页查询 -->
|
||||
ORDER BY a.id
|
||||
<if test="size != null and offset != null">
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询总记录数 (优化版) -->
|
||||
<select id="countCreditUsage" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM t_account a
|
||||
<if test="changeEvent != null or startTime != null or endTime != null">
|
||||
LEFT JOIN t_credits_detail cd ON a.id = cd.account_id
|
||||
AND cd.changed_credits <= 0
|
||||
<if test="changeEvent != null and changeEvent != ''">
|
||||
AND cd.change_event = #{changeEvent}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND cd.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND cd.create_time <= #{endTime}
|
||||
</if>
|
||||
</if>
|
||||
WHERE
|
||||
<choose>
|
||||
<when test="role == 'corp'">
|
||||
a.system_user IN (5, 6)
|
||||
</when>
|
||||
<when test="role == 'edu'">
|
||||
a.system_user IN (7, 8)
|
||||
</when>
|
||||
<when test="role == 'prsn'">
|
||||
a.system_user IN (0, 1, 2, 3, 4)
|
||||
</when>
|
||||
</choose>
|
||||
<if test="userEmail != null and userEmail != ''">
|
||||
AND a.user_email = #{userEmail}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -34,8 +34,19 @@
|
||||
from t_account a
|
||||
left join t_design b on a.id = b.account_id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="role == 'corp'">
|
||||
a.system_user IN (5, 6)
|
||||
</when>
|
||||
<when test="role == 'edu'">
|
||||
a.system_user IN (7, 8)
|
||||
</when>
|
||||
<when test="role == 'prsn'">
|
||||
a.system_user IN (0, 1, 2, 3, 4)
|
||||
</when>
|
||||
</choose>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
b.create_date between #{startTime} and #{endTime}
|
||||
AND b.create_date between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
and b.create_date not like '%:01'
|
||||
@@ -52,17 +63,6 @@
|
||||
GROUP BY b.account_id
|
||||
ORDER BY b.account_id asc) d
|
||||
left join trial_order c on d.user_email = c.email
|
||||
<!--select a.account_id,count(a.account_id) use_design_times,b.user_email,b.user_name,b.is_trial
|
||||
from `t_account` b
|
||||
left join t_design a
|
||||
on a.account_id = b.id
|
||||
<where>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
a.create_date between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.account_id
|
||||
ORDER BY a.account_id ASC;-->
|
||||
</select>
|
||||
|
||||
<select id="selectDeleteList" resultType="com.ai.da.mapper.primary.entity.Design">
|
||||
|
||||
Reference in New Issue
Block a user