大赛管理功能

This commit is contained in:
tiger_zhou 2024-02-23 11:03:10 +08:00
parent 6288c72829
commit cade3772cd
4 changed files with 1310 additions and 14 deletions

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.services.race.RaceModuleService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleCreateVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleListVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleVO;
import club.joylink.rtss.vo.race.RaceModule.TaskSetting;
import club.joylink.rtss.vo.race.RaceModuleQueryVO;
@ -58,7 +59,7 @@ public class RaceModuleController {
}
@GetMapping("/page")
public PageVO<RacetrModulePager> page(RaceModuleQueryVO vo) {
public PageVO<RaceModuleListVO> page(RaceModuleQueryVO vo) {
return this.moduleServicce.page(vo);
}

View File

@ -10,18 +10,22 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleCreateVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleListVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleVO;
import club.joylink.rtss.vo.race.RaceModule.TaskSetting;
import club.joylink.rtss.vo.race.RaceModuleQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
@ -71,10 +75,35 @@ public class RaceModuleService extends RaceService {
this.moduleDAO.updateByPrimaryKeySelective(module);
}
public PageVO<RacetrModulePager> page(RaceModuleQueryVO vo) {
public PageVO<RaceModuleListVO> page(RaceModuleQueryVO vo) {
PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
Page<RacetrModulePager> page = (Page<RacetrModulePager>) this.moduleDAO.pageList(vo);
return PageVO.convert(page, page.getResult());
return PageVO.convert(page, this.convertPageVO(page.getResult()));
}
private RaceModuleListVO convertVO(RacetrModulePager p) {
RaceModuleListVO.Builder bu = RaceModuleListVO.newBuilder();
bu.setId(p.getId());
bu.setCode(p.getCode());
bu.setDesc(p.getDesc());
bu.setDuration(p.getDuration());
bu.setPaperId(p.getPaperId());
bu.setPaperName(p.getPaperName());
ModifyInfoVO modifyInfoVO = this.createModifyInfo(p.getCreatorId(), p.getCreatorName(), p.getUpdaterId(), p.getUpdaterName(), p.getCreateTime(), p.getUpdateTime());
bu.setModifyInfo(modifyInfoVO);
return bu.build();
}
private List<RaceModuleListVO> convertPageVO(List<RacetrModulePager> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
List<RaceModuleListVO> voList = Lists.newArrayListWithCapacity(list.size());
for (RacetrModulePager mp : list) {
voList.add(this.convertVO(mp));
}
return voList;
}
public void delete(Long id) {

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.entity.racetr.RacetrModulePager;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleCreateVO;
import club.joylink.rtss.vo.race.RaceModule.RaceModuleListVO;
import club.joylink.rtss.vo.race.RaceModuleQueryVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,7 +32,7 @@ public class ModuleServiceTest {
query.setPageNum(1);
query.setPageSize(10);
query.setPaperName("t");
PageVO<RacetrModulePager> page = this.moduleService.page(query);
PageVO<RaceModuleListVO> page = this.moduleService.page(query);
System.out.println(JsonUtils.writeValueAsString(page));
}