linwei
2024-02-22 947c4e68b6ce3b64db967a689227315924dd181e
投票人员查询优化
2 files modified
9 ■■■■ changed files
src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/discuss/service/impl/UserTopicsServiceImpl.java 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/article/mapper/ArticleMapper.xml
@@ -98,6 +98,7 @@
            <if test="article.articleType != null and article.articleType != ''">
                and ja.article_type = #{article.articleType}
            </if>
            <if test="article.eventType != null">
                and jpd.event_type = #{article.eventType}
            </if>
src/main/java/org/springblade/modules/discuss/service/impl/UserTopicsServiceImpl.java
@@ -83,13 +83,17 @@
        PublicDiscussEntity one = bean.getOne(Wrappers.<PublicDiscussEntity>lambdaQuery().eq(PublicDiscussEntity::getArticleId, topics.get(0).getArticleId()));
        // 一户一票
        if (one.getVoteRestrictions().equals(CommonConstant.NUMBER_ONE)) {
            long count = count(Wrappers.<UserTopicsEntity>lambdaQuery().eq(UserTopicsEntity::getHouseCode, topics.get(0).getHouseCode()));
            long count = count(Wrappers.<UserTopicsEntity>lambdaQuery()
                .eq(UserTopicsEntity::getHouseCode, topics.get(0).getHouseCode())
                .eq(UserTopicsEntity::getArticleId,topics.get(0).getArticleId()));
            if (count > 1) {
                throw new Exception("您的房屋已投票,不能重复投票!");
            }
        } else {
            //
            long count = count(Wrappers.<UserTopicsEntity>lambdaQuery().eq(UserTopicsEntity::getUserId, AuthUtil.getUserId()));
            long count = count(Wrappers.<UserTopicsEntity>lambdaQuery()
                .eq(UserTopicsEntity::getUserId, AuthUtil.getUserId())
                .eq(UserTopicsEntity::getArticleId,topics.get(0).getArticleId()));
            if (count > 1) {
                throw new Exception("您的已投票,不能重复投票!");
            }