add event option

This commit is contained in:
Timi
2026-08-30 23:50:47 +08:00
parent 4496619eeb
commit 712118556b
23 changed files with 716 additions and 1 deletions
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoEventOptionGroupMapper">
<select id="selectAllByEventIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoEventOptionGroup">
SELECT
*
FROM `gao_event_option_group`
WHERE
TRUE
<if test="eventIdList != null and !eventIdList.isEmpty()">
AND `event_id` IN
<foreach collection="eventIdList" item="eventId" separator="," open="(" close=")">
#{eventId}
</foreach>
</if>
<if test="eventIdList == null or eventIdList.isEmpty()">
AND FALSE
</if>
AND `deleted_at` IS NULL
ORDER BY `sort`, `created_at`
</select>
</mapper>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoEventOptionMapper">
<select id="selectAllByGroupIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoEventOption">
SELECT
*
FROM `gao_event_option`
WHERE
TRUE
<if test="groupIdList != null and !groupIdList.isEmpty()">
AND `group_id` IN
<foreach collection="groupIdList" item="groupId" separator="," open="(" close=")">
#{groupId}
</foreach>
</if>
<if test="groupIdList == null or groupIdList.isEmpty()">
AND FALSE
</if>
AND `deleted_at` IS NULL
ORDER BY `sort`, `created_at`
</select>
</mapper>
@@ -118,6 +118,17 @@
#{eventId}
</foreach>
</if>
<if test="optionIdList != null and optionIdList.size() > 0">
<foreach collection="optionIdList" item="optionId">
AND EXISTS (
SELECT 1
FROM `gao_event_record_option` fro
WHERE fro.`event_record_id` = r.`id`
AND fro.`option_id` = #{optionId}
AND fro.`deleted_at` IS NULL
)
</foreach>
</if>
<if test="verificationStatus != null">
AND r.`verification_status` = #{verificationStatus}
</if>
@@ -154,6 +165,27 @@
<include refid="rangeWhere"/>
AND r.`number_value` IS NOT NULL
</select>
<select id="selectOptionStatByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventOptionStatView">
SELECT
ro.`group_id` AS `groupId`,
ro.`group_name_snapshot` AS `groupName`,
ro.`option_id` AS `optionId`,
ro.`option_label_snapshot` AS `optionLabel`,
COUNT(DISTINCT ro.`event_record_id`) AS `recordCount`
FROM `gao_event_record` r
INNER JOIN `gao_event_record_option` ro ON ro.`event_record_id` = r.`id`
WHERE
<include refid="rangeWhere"/>
AND ro.`deleted_at` IS NULL
GROUP BY
ro.`group_id`,
ro.`group_name_snapshot`,
ro.`option_id`,
ro.`option_label_snapshot`,
ro.`group_sort`,
ro.`option_sort`
ORDER BY ro.`group_sort`, ro.`option_sort`
</select>
<sql id="rankWhere">
r.`deleted_at` IS NULL
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoEventRecordOptionMapper">
<select id="selectAllByEventRecordIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoEventRecordOption">
SELECT
*
FROM `gao_event_record_option`
WHERE
TRUE
<if test="eventRecordIdList != null and !eventRecordIdList.isEmpty()">
AND `event_record_id` IN
<foreach collection="eventRecordIdList" item="eventRecordId" separator="," open="(" close=")">
#{eventRecordId}
</foreach>
</if>
<if test="eventRecordIdList == null or eventRecordIdList.isEmpty()">
AND FALSE
</if>
AND `deleted_at` IS NULL
ORDER BY `group_sort`, `option_sort`, `created_at`
</select>
</mapper>