无关风月
2024-07-24 b23b243473fc9ab20ca62eebf3668c143e2e7d23
cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml
@@ -15,39 +15,27 @@
    </select>
    <select id="getPeopleFromId1" resultType="com.dsh.competition.entity.UserCompetition">
        select * from (
        select
        a.*
        from t_user_competition a
        left join t_payment_competition b on (a.paymentCompetitionId = b.id)
        where b.state = 1 and b.payStatus != 1 and a.competitionId = #{id}
        select * from t_user_competition where competitionId = #{id} and paymentCompetitionId in (
        select id from t_payment_competition where state = 1 and payStatus != 1
        <if test="null != state and state == 1">
            and b.payStatus = 2
            and payStatus = 2
        </if>
        <if test="null != state and state == 3">
            and b.payStatus = 3
            and payStatus = 3
        </if>
        group by a.id
        ) as aa where aa.id is not null order by aa.insertTime desc limit #{offset}, #{limit}
        ) order by insertTime desc limit #{offset}, #{limit}
    </select>
    <select id="getPeopleFromIdCount" resultType="java.lang.Integer">
        select
        count(*)
        from (
        select
        a.id
        from t_user_competition a
        left join t_payment_competition b on (a.paymentCompetitionId = b.id)
        where b.state = 1 and b.payStatus != 1 and a.competitionId = #{id}
        select count(1) from t_user_competition where competitionId = #{id} and paymentCompetitionId in (
        select id from t_payment_competition where state = 1 and payStatus != 1
        <if test="null != state and state == 1">
            and b.payStatus = 2
            and payStatus = 2
        </if>
        <if test="null != state and state == 3">
            and b.payStatus = 3
            and payStatus = 3
        </if>
        group by a.id
        ) as aa where aa.id is not null
        )
    </select>