This commit is contained in:
Timi
2026-07-31 15:16:55 +08:00
parent e45809a0db
commit 844c5381c4
13 changed files with 436 additions and 69 deletions
@@ -214,20 +214,66 @@
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
</select>
<sql id="rangeWhere">
r.`registered_at` &gt;= #{req.beginRegisteredAt}
AND r.`registered_at` &lt;= #{req.endRegisteredAt}
AND r.`deleted_at` IS NULL
<if test="req.customerId != null and req.customerId != ''">
AND r.`customer_id` = #{req.customerId}
</if>
<if test="req.registrationEventId != null and req.registrationEventId != ''">
AND r.`registration_event_id` = #{req.registrationEventId}
</if>
<if test="req.registrationEventIdList != null and req.registrationEventIdList.size() > 0">
AND r.`registration_event_id` IN
<foreach collection="req.registrationEventIdList" item="registrationEventId" open="(" separator="," close=")">
#{registrationEventId}
</foreach>
</if>
<if test="req.keyword != null and req.keyword != ''">
AND (
c.`code` LIKE CONCAT('%', #{req.keyword}, '%')
OR c.`name` LIKE CONCAT('%', #{req.keyword}, '%')
OR e.`name` LIKE CONCAT('%', #{req.keyword}, '%')
OR r.`remark` LIKE CONCAT('%', #{req.keyword}, '%')
OR u.`name` LIKE CONCAT('%', #{req.keyword}, '%')
OR u.`nick` LIKE CONCAT('%', #{req.keyword}, '%')
OR r.`operator_user_id` LIKE CONCAT('%', #{req.keyword}, '%')
)
</if>
</sql>
<sql id="rangeFrom">
FROM `gao_registration_event_record` r
LEFT JOIN `gao_customer` c ON r.`customer_id` = c.`id`
LEFT JOIN `gao_registration_event` e ON r.`registration_event_id` = e.`id`
LEFT JOIN `user` u ON r.`operator_user_id` = u.`id`
</sql>
<select id="selectByRange" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEventRecord">
SELECT
*
FROM `gao_registration_event_record`
r.*
<include refid="rangeFrom"/>
WHERE
`registered_at` &gt;= #{req.beginRegisteredAt}
AND `registered_at` &lt;= #{req.endRegisteredAt}
AND `deleted_at` IS NULL
<if test="req.customerId != null and req.customerId != ''">
AND `customer_id` = #{req.customerId}
</if>
<if test="req.registrationEventId != null and req.registrationEventId != ''">
AND `registration_event_id` = #{req.registrationEventId}
</if>
ORDER BY `registered_at` DESC, `created_at` DESC
<include refid="rangeWhere"/>
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
</select>
<select id="countByRange" resultType="java.lang.Long">
SELECT
COUNT(1)
<include refid="rangeFrom"/>
WHERE
<include refid="rangeWhere"/>
</select>
<select id="selectPageByRange" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEventRecord">
SELECT
r.*
<include refid="rangeFrom"/>
WHERE
<include refid="rangeWhere"/>
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
LIMIT #{offset}, #{size}
</select>
</mapper>