| | |
| | | .eq(UserTopicsEntity::getUserId, AuthUtil.getUserId()) |
| | | .eq(UserTopicsEntity::getArticleId, topics.get(0).getArticleId())); |
| | | if (count > 0) { |
| | | return "您的已投票,不能重复投票!"; |
| | | return "您已投票,不能重复投票!"; |
| | | } |
| | | } |
| | | Boolean userTopics = getaBoolean(topics); |
| | | if (userTopics != null) return "200"; |
| | | if (userTopics) return "200"; |
| | | return "操作失败!"; |
| | | } |
| | | |
| | | @Nullable |
| | | private Boolean getaBoolean(List<TopicsVO> topics) { |
| | | List<UserTopicsEntity> objects = new ArrayList<>(); |
| | | Boolean result = false; |
| | | for (TopicsVO topic : topics) { |
| | | UserTopicsEntity userTopicsEntity = new UserTopicsEntity(); |
| | | userTopicsEntity.setUserId(AuthUtil.getUserId()); |
| | |
| | | objectUpdateWrapper.setSql("number = number + 1"); |
| | | objectUpdateWrapper.eq("id", topic.getSelected()); |
| | | topicsService.update(null, objectUpdateWrapper); |
| | | return save(userTopics); |
| | | result = save(userTopics); |
| | | } else { |
| | | // 多选 |
| | | if (StringUtils.isBlank(topic.getSelected())) { |
| | |
| | | objectUpdateWrapper.eq("id", o); |
| | | topicsService.update(null, objectUpdateWrapper); |
| | | } |
| | | return saveBatch(objectsTwo); |
| | | result = saveBatch(objectsTwo); |
| | | } |
| | | } |
| | | return null; |
| | | return result; |
| | | } |
| | | |
| | | |