Browse Source

修bug

master
lenghui 5 months ago
parent
commit
bf89af49b2
  1. 2
      pom.xml
  2. 6
      src/main/java/com/lh/service/CrowdfundingServiceImpl.java
  3. 18
      src/test/java/com/lh/CrowdfundingSystemApplicationTests.java

2
pom.xml

@ -43,7 +43,7 @@
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
<version>8.0.22</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>

6
src/main/java/com/lh/service/CrowdfundingServiceImpl.java

@ -18,11 +18,13 @@ public class CrowdfundingServiceImpl implements CrowdfundingService {
public CrowdfundingInfo loadPage() { public CrowdfundingInfo loadPage() {
CrowdfundingInfo crowdfundingInfoList = crowdfundingMapper.loadPage(); CrowdfundingInfo crowdfundingInfoList = crowdfundingMapper.loadPage();
//如果当前进度大于等于目标人数将status变更为0 //如果当前进度大于等于目标人数将status变更为0
if (crowdfundingInfoList.getNowNumber() >= crowdfundingInfoList.getTargetNumber()) {
if (crowdfundingInfoList != null && crowdfundingInfoList.getNowNumber() >= crowdfundingInfoList.getTargetNumber()) {
crowdfundingMapper.updateStatus(0); crowdfundingMapper.updateStatus(0);
} }
List<Participant> participants = crowdfundingMapper.queryCrowdUser(null); List<Participant> participants = crowdfundingMapper.queryCrowdUser(null);
crowdfundingInfoList.setParticipantList(participants);
if (crowdfundingInfoList != null) {
crowdfundingInfoList.setParticipantList(participants);
}
return crowdfundingInfoList; return crowdfundingInfoList;
} }

18
src/test/java/com/lh/CrowdfundingSystemApplicationTests.java

@ -1,29 +1,11 @@
package com.lh; package com.lh;
import com.lh.bean.CrowdfundingInfo;
import com.lh.mapper.CrowdfundingMapper;
import com.lh.service.CrowdfundingService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
class CrowdfundingSystemApplicationTests { class CrowdfundingSystemApplicationTests {
@Autowired
private CrowdfundingMapper crowdfundingMapper;
@Autowired
private CrowdfundingService crowdfundingService;
@Test @Test
void contextLoads() { void contextLoads() {
CrowdfundingInfo crowdfundingInfo = crowdfundingMapper.loadPage();
} }
@Test
void contextLoads1() {
System.out.println(crowdfundingService.loadPage());
}
} }
Loading…
Cancel
Save