大赛管理功能

This commit is contained in:
tiger_zhou 2024-02-27 13:39:04 +08:00
parent 37f6fd51eb
commit 23d46aac0c
9 changed files with 2842 additions and 65 deletions

@ -1 +1 @@
Subproject commit a186e4a490116a0ad043125c9f55b31d4426e6ff
Subproject commit bab005c36a386b8986678715c0adeea67edd0f18

View File

@ -19,7 +19,7 @@ import org.springframework.stereotype.Repository;
public interface RacetrPaperDAO extends MyBatisBaseDao<RacetrPaper, Long, RacetrPaperExample> {
@Select("<script>"
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName,A.support_copy "
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName,A.support_copy ,B.group"
+ " ,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_paper A left join racetr_season B on A.season_id = B.id "
+ " left join sys_account C on A.creator_id = C.id "
@ -28,8 +28,9 @@ public interface RacetrPaperDAO extends MyBatisBaseDao<RacetrPaper, Long, Racetr
+ "<if test='vo.name!= null and vo.name!= \"\"'> "
+ " and A.name like CONCAT('%',#{vo.name},'%') "
+ "</if> "
+ "<if test='vo.id!= null and vo.id >=0'> "
+ " and A.id = #{vo.name}"
+ "<if test='vo.group!= null and vo.group != \"\"'> "
+ " and B.group = #{vo.group} "
+ "</if> "
+ "</script>")
List<RacePaperPageVO> pages(@Param("vo") RacePaperQueryVO vo);

View File

@ -12,6 +12,7 @@ import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperPageVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
@ -20,6 +21,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -65,6 +67,9 @@ public class RacePaperService {
public PageVO<RacePaperVO> pageQuery(RacePaperQueryVO query) {
if (!StringUtils.equalsAny(query.getGroup(), Group.GZ.name(), Group.ZZ.name())) {
query.setGroup(null);
}
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<RacePaperPageVO> page = (Page<RacePaperPageVO>) this.paperDAO.pages(query);
List<RacePaperVO> voList = this.convertEntity(page.getResult());
@ -82,6 +87,10 @@ public class RacePaperService {
builder.setSeasonId(rp.getSeasonId());
builder.setSeasonName(Objects.isNull(rp.getSeasonName()) ? "" : rp.getSeasonName());
builder.setSupportCopy(!Objects.isNull(rp.getSupportCopy()) && rp.getSupportCopy());
builder.setGroup(Group.Unknown);
if (Objects.nonNull(rp.getGroup())) {
builder.setGroup(Group.valueOf(rp.getGroup()));
}
return builder.build();
}

View File

@ -90,6 +90,17 @@ public final class RacePaper {
* <code>.common.ModifyInfoVO modify_info = 8;</code>
*/
club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVOOrBuilder getModifyInfoOrBuilder();
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The enum numeric value on the wire for group.
*/
int getGroupValue();
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The group.
*/
club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group getGroup();
}
/**
* Protobuf type {@code race.RacePaperVO}
@ -107,6 +118,7 @@ public final class RacePaper {
name_ = "";
desc_ = "";
seasonName_ = "";
group_ = 0;
}
@java.lang.Override
@ -309,6 +321,24 @@ public final class RacePaper {
return modifyInfo_ == null ? club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO.getDefaultInstance() : modifyInfo_;
}
public static final int GROUP_FIELD_NUMBER = 9;
private int group_ = 0;
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The enum numeric value on the wire for group.
*/
@java.lang.Override public int getGroupValue() {
return group_;
}
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The group.
*/
@java.lang.Override public club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group getGroup() {
club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group result = club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.forNumber(group_);
return result == null ? club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.UNRECOGNIZED : result;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@ -344,6 +374,9 @@ public final class RacePaper {
if (modifyInfo_ != null) {
output.writeMessage(8, getModifyInfo());
}
if (group_ != club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.Unknown.getNumber()) {
output.writeEnum(9, group_);
}
getUnknownFields().writeTo(output);
}
@ -378,6 +411,10 @@ public final class RacePaper {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, getModifyInfo());
}
if (group_ != club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.Unknown.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(9, group_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@ -410,6 +447,7 @@ public final class RacePaper {
if (!getModifyInfo()
.equals(other.getModifyInfo())) return false;
}
if (group_ != other.group_) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@ -440,6 +478,8 @@ public final class RacePaper {
hash = (37 * hash) + MODIFY_INFO_FIELD_NUMBER;
hash = (53 * hash) + getModifyInfo().hashCode();
}
hash = (37 * hash) + GROUP_FIELD_NUMBER;
hash = (53 * hash) + group_;
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@ -582,6 +622,7 @@ public final class RacePaper {
modifyInfoBuilder_.dispose();
modifyInfoBuilder_ = null;
}
group_ = 0;
return this;
}
@ -638,6 +679,9 @@ public final class RacePaper {
? modifyInfo_
: modifyInfoBuilder_.build();
}
if (((from_bitField0_ & 0x00000080) != 0)) {
result.group_ = group_;
}
}
@java.lang.Override
@ -679,6 +723,9 @@ public final class RacePaper {
if (other.hasModifyInfo()) {
mergeModifyInfo(other.getModifyInfo());
}
if (other.group_ != 0) {
setGroupValue(other.getGroupValue());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@ -742,6 +789,11 @@ public final class RacePaper {
bitField0_ |= 0x00000040;
break;
} // case 66
case 72: {
group_ = input.readEnum();
bitField0_ |= 0x00000080;
break;
} // case 72
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@ -1201,6 +1253,59 @@ public final class RacePaper {
}
return modifyInfoBuilder_;
}
private int group_ = 0;
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The enum numeric value on the wire for group.
*/
@java.lang.Override public int getGroupValue() {
return group_;
}
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @param value The enum numeric value on the wire for group to set.
* @return This builder for chaining.
*/
public Builder setGroupValue(int value) {
group_ = value;
bitField0_ |= 0x00000080;
onChanged();
return this;
}
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return The group.
*/
@java.lang.Override
public club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group getGroup() {
club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group result = club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.forNumber(group_);
return result == null ? club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group.UNRECOGNIZED : result;
}
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @param value The group to set.
* @return This builder for chaining.
*/
public Builder setGroup(club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000080;
group_ = value.getNumber();
onChanged();
return this;
}
/**
* <code>.race.RaceSeason.Group group = 9;</code>
* @return This builder for chaining.
*/
public Builder clearGroup() {
bitField0_ = (bitField0_ & ~0x00000080);
group_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@ -6789,27 +6894,28 @@ public final class RacePaper {
static {
java.lang.String[] descriptorData = {
"\n\020race_paper.proto\022\004race\032\030common/modify_" +
"info.proto\032\026race/race_season.proto\"\236\001\n\013R" +
"info.proto\032\026race/race_season.proto\"\305\001\n\013R" +
"acePaperVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004" +
"desc\030\003 \001(\t\022\021\n\tseason_id\030\005 \001(\003\022\023\n\013season_" +
"name\030\006 \001(\t\022\024\n\014support_copy\030\007 \001(\010\022)\n\013modi" +
"fy_info\030\010 \001(\0132\024.common.ModifyInfoVO\"\320\001\n\021" +
"RacePaperDetailVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 " +
"\001(\t\022\014\n\004desc\030\003 \001(\t\022*\n\tmodule_vo\030\004 \001(\0132\027.r" +
"ace.RacePaperModuleVO\022\021\n\tseason_id\030\005 \001(\003" +
"\022\023\n\013season_name\030\006 \001(\t\022\024\n\014support_copy\030\007 " +
"\001(\010\022)\n\013modify_info\030\010 \001(\0132\024.common.Modify" +
"InfoVO\"X\n\021RacePaperCreateVO\022\014\n\004name\030\001 \001(" +
"\t\022\014\n\004desc\030\002 \001(\t\022\021\n\tseason_id\030\003 \001(\003\022\024\n\014su" +
"pport_copy\030\004 \001(\010\"\243\002\n\021RacePaperModuleVO\0224" +
"\n\007modules\030\001 \003(\0132#.race.RacePaperModuleVO" +
".PaperModule\032\200\001\n\013PaperModule\022\023\n\013module_n" +
"ame\030\001 \001(\t\022\020\n\010duration\030\002 \001(\005\022,\n\005group\030\003 \003" +
"(\0132\035.race.RacePaperModuleVO.Group\022\034\n\024mod" +
"ule_score_rule_id\030\004 \001(\003\032U\n\005Group\022\020\n\010task" +
"_ids\030\001 \003(\003\022,\n\005group\030\002 \003(\0132\035.race.RacePap" +
"erModuleVO.Group\022\014\n\004name\030\003 \001(\tB\033\n\031club.j" +
"oylink.rtss.vo.raceb\006proto3"
"fy_info\030\010 \001(\0132\024.common.ModifyInfoVO\022%\n\005g" +
"roup\030\t \001(\0162\026.race.RaceSeason.Group\"\320\001\n\021R" +
"acePaperDetailVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001" +
"(\t\022\014\n\004desc\030\003 \001(\t\022*\n\tmodule_vo\030\004 \001(\0132\027.ra" +
"ce.RacePaperModuleVO\022\021\n\tseason_id\030\005 \001(\003\022" +
"\023\n\013season_name\030\006 \001(\t\022\024\n\014support_copy\030\007 \001" +
"(\010\022)\n\013modify_info\030\010 \001(\0132\024.common.ModifyI" +
"nfoVO\"X\n\021RacePaperCreateVO\022\014\n\004name\030\001 \001(\t" +
"\022\014\n\004desc\030\002 \001(\t\022\021\n\tseason_id\030\003 \001(\003\022\024\n\014sup" +
"port_copy\030\004 \001(\010\"\243\002\n\021RacePaperModuleVO\0224\n" +
"\007modules\030\001 \003(\0132#.race.RacePaperModuleVO." +
"PaperModule\032\200\001\n\013PaperModule\022\023\n\013module_na" +
"me\030\001 \001(\t\022\020\n\010duration\030\002 \001(\005\022,\n\005group\030\003 \003(" +
"\0132\035.race.RacePaperModuleVO.Group\022\034\n\024modu" +
"le_score_rule_id\030\004 \001(\003\032U\n\005Group\022\020\n\010task_" +
"ids\030\001 \003(\003\022,\n\005group\030\002 \003(\0132\035.race.RacePape" +
"rModuleVO.Group\022\014\n\004name\030\003 \001(\tB\033\n\031club.jo" +
"ylink.rtss.vo.raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -6822,7 +6928,7 @@ public final class RacePaper {
internal_static_race_RacePaperVO_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_race_RacePaperVO_descriptor,
new java.lang.String[] { "Id", "Name", "Desc", "SeasonId", "SeasonName", "SupportCopy", "ModifyInfo", });
new java.lang.String[] { "Id", "Name", "Desc", "SeasonId", "SeasonName", "SupportCopy", "ModifyInfo", "Group", });
internal_static_race_RacePaperDetailVO_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_race_RacePaperDetailVO_fieldAccessorTable = new

View File

@ -19,4 +19,5 @@ public class RacePaperPageVO {
private String creatorName;
private String updaterName;
private byte[] configs;
private String group;
}

View File

@ -1,11 +1,16 @@
package club.joylink.rtss.vo.race;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import lombok.Data;
@Data
public class RacePaperQueryVO extends PageQueryVO {
private String name;
private Long id;
/**
* GZ, ZZ
*/
private String group;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
package club.joylink.rtss.services.race;
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;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class ModuleServiceTest {
@Autowired
private RaceModuleService moduleService;
@Test
public void saveBasicTest() {
RaceModuleCreateVO.Builder dto = RaceModuleCreateVO.newBuilder();
dto.setCode("test");
dto.setDesc("test");
dto.setPaperId(1L);
dto.setDuration(1);
this.moduleService.saveBasic(dto.build(), SeasonServiceTest.createAccount());
}
@Test
public void pageTest() {
RaceModuleQueryVO query = new RaceModuleQueryVO();
query.setPageNum(1);
query.setPageSize(10);
query.setPaperName("t");
PageVO<RaceModuleListVO> page = this.moduleService.page(query);
System.out.println(JsonUtils.writeValueAsString(page));
}
}

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@ -28,6 +29,7 @@ public class PaperServiceTest {
RacePaperQueryVO queryVO = new RacePaperQueryVO();
queryVO.setPageNum(1);
queryVO.setPageSize(10);
queryVO.setGroup(Group.GZ.name());
PageVO<RacePaperVO> page = this.paperService.pageQuery(queryVO);
System.out.println(JsonUtils.writeValueAsString(page));
}