From 2db318b7bbf5040748ee4ab40cde02c0041f1c0e Mon Sep 17 00:00:00 2001 From: PeterAlbus Date: Thu, 23 Dec 2021 19:01:33 +0800 Subject: [PATCH] fix a bug that will happen when group leader quit the group. --- .../service/ParticipateService.java | 2 +- .../java/com/peteralbus/MybatisPlusTest.java | 27 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 src/test/java/com/peteralbus/MybatisPlusTest.java diff --git a/src/main/java/com/peteralbus/service/ParticipateService.java b/src/main/java/com/peteralbus/service/ParticipateService.java index bca9568..71a48a9 100644 --- a/src/main/java/com/peteralbus/service/ParticipateService.java +++ b/src/main/java/com/peteralbus/service/ParticipateService.java @@ -164,7 +164,7 @@ public class ParticipateService QueryWrapper recordQueryWrapper=new QueryWrapper<>(); recordQueryWrapper.eq("participation_id",participate.getParticipationId()); recordDao.delete(recordQueryWrapper); - if(group.getLeaderId().equals(participate.getUserId())&&count==2) + if(group.getLeaderId().equals(participate.getUserId())&&count==1) { participateDao.deleteById(participationId); return groupDao.deleteById(group); diff --git a/src/test/java/com/peteralbus/MybatisPlusTest.java b/src/test/java/com/peteralbus/MybatisPlusTest.java deleted file mode 100644 index 16e3f12..0000000 --- a/src/test/java/com/peteralbus/MybatisPlusTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.peteralbus; - -import com.peteralbus.dao.UserDao; -import com.peteralbus.entity.User; -import com.peteralbus.service.UserService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) // SpringJUnit支持,由此引入Spring-Test框架支持! -@ContextConfiguration(locations = {"classpath:mybatis-config.xml","classpath:applicationContext.xml"})//用于加载bean -public class MybatisPlusTest -{ - @Autowired - UserDao userDao; - @Autowired - UserService userService; - @Test - public void test() - { - User user=userService.queryByUsername("PeterAlbus"); - user.setUserPhone("17317792001"); - userDao.updateById(user); - } -}