Browse Source

优化 学员登记逻辑

hgw 3 years ago
parent
commit
a1fef2b063

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampUserRelationServiceImpl.java

@@ -50,6 +50,11 @@ public class TempLittleArtistTrainingCampUserRelationServiceImpl extends Service
     @Override
     public void add(Integer campId) {
         SysUser user = getUser();
+        TempLittleArtistTrainingCampUserRelation one = this.getOne(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId()));
+        if (Objects.nonNull(one)) {
+            throw new BizException("您已登记训练营!");
+        }
         int count = this.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaUpdate()
                 .set(TempLittleArtistTrainingCampUserRelation::getActivityId, campId));
         if (count == 2000) {