linwei
2024-01-08 ad2ec97fe0c60eee4bb7c8cdacff7c876f280ea7
src/main/java/org/springblade/modules/discuss/mapper/PublicDiscussMapper.xml
@@ -47,24 +47,23 @@
    <select id="selectPublicDiscussPage" resultMap="publicDiscussResultMap">
        select  id,
        title,
        open_flag,
        number_restrictions,
        vote_restrictions,
        user_restrictions,
        end_time,
        article_id,
        create_time,
        update_time,
        deleted_flag,
        repeat_vote,
        vote_number_public,
        appoint_user,
        user_ids,
        event_type,
        (SELECT count(1) FROM jczz_user_public_enroll where public_discuss_id = jpd.id) enrollCount,
        (SELECT count(1) from (SELECT * FROM jczz_user_topics WHERE public_discuss_id = jpd.id GROUP BY user_id ) a) topsCount
        select  jpd.id,
        jpd.title,
        jpd.open_flag,
        jpd.number_restrictions,
        jpd.vote_restrictions,
        jpd.user_restrictions,
        jpd.end_time,
        jpd.article_id,
        jpd.create_time,
        jpd.update_time,
        jpd.deleted_flag,
        jpd.repeat_vote,
        jpd.vote_number_public,
        jpd.appoint_user,
        jpd.user_ids,
        jpd.event_type,
        jpd.signature_flag
        from jczz_public_discuss jpd
        <where>
            <if test="publicDiscuss.id != null "> and id = #{publicDiscuss.id}</if>
@@ -127,11 +126,12 @@
        jpd.appoint_user,
        jpd.user_ids,
        jpd.event_type,
        jupe.user_id userId
        jpd.signature_flag,
        (SELECT user_id from jczz_user_public_enroll where user_id = #{userId} and article_id = jpd.article_id)userId
        from
        jczz_public_discuss jpd LEFT JOIN jczz_user_public_enroll jupe on  jupe.public_discuss_id = jpd.id
        jczz_public_discuss jpd
        <where>
            <if test="id != null "> and jpd.id = #{id}</if>
            <if test="articleId != null ">and jpd.article_id = #{articleId}</if>
        </where>
    </select>