puzhibing
2023-07-06 c0f6294b0be6789fddd652f89f820fcf6d5526cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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.dsh.competition.mapper.UserCompetitionMapper">
 
    <select id="queryUsersCompetetions" resultType="com.dsh.competition.entity.UserCompetition">
        SELECT *
        FROM t_user_competition
        UNION ALL
        SELECT *
        FROM t_user_competition1
        UNION ALL
        SELECT *
        FROM t_user_competition2
        UNION ALL
        SELECT *
        FROM t_user_competition3
        UNION ALL
        SELECT *
        FROM t_user_competition4
        UNION ALL
        SELECT *
        FROM t_user_competition5
        WHERE 1 = 1
        <if test=" stuId != null">
            and studentId = #{stuId}
        </if>
        <if test="appUserId != null">
            and competitionId in
        <foreach collection="comIds" item="item" separator="," open="(" index="index" close=")">
            #{item}
        </foreach>
        </if>
        <if test="startTime != null and endTime != null">
            and (insertTime between #{startTime} and #{endTime})
        </if>
    </select>
 
</mapper>