Browse Source

修bug

master
lenghui 5 months ago
parent
commit
bf89af49b2
  1. 2
      pom.xml
  2. 4
      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>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
<version>8.0.22</version>
<scope>runtime</scope>
</dependency>
</dependencies>

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

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

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

@ -1,29 +1,11 @@
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CrowdfundingSystemApplicationTests {
@Autowired
private CrowdfundingMapper crowdfundingMapper;
@Autowired
private CrowdfundingService crowdfundingService;
@Test
void contextLoads() {
CrowdfundingInfo crowdfundingInfo = crowdfundingMapper.loadPage();
}
@Test
void contextLoads1() {
System.out.println(crowdfundingService.loadPage());
}
}
Loading…
Cancel
Save