mirror of https://github.com/elunez/eladmin
commit
0db1390bcd
|
@ -1,15 +1,6 @@
|
|||
alter table event
|
||||
add column public_link varchar(255);
|
||||
|
||||
create table match_group
|
||||
(
|
||||
id bigint auto_increment primary key,
|
||||
create_time datetime,
|
||||
size int default 2 not null,
|
||||
name varchar(255) not null,
|
||||
score int default 0
|
||||
);
|
||||
|
||||
create table group_player
|
||||
(
|
||||
id bigint auto_increment primary key,
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
-- Create event_player join table for co-host players
|
||||
CREATE TABLE event_co_host_player
|
||||
(
|
||||
event_id BIGINT,
|
||||
player_id BIGINT,
|
||||
PRIMARY KEY (event_id, player_id),
|
||||
CONSTRAINT fk_event_player_event FOREIGN KEY (event_id) REFERENCES event (id),
|
||||
CONSTRAINT fk_event_player_player FOREIGN KEY (player_id) REFERENCES player (id)
|
||||
);
|
||||
|
||||
-- Create match_group table
|
||||
CREATE TABLE match_group
|
||||
(
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
name VARCHAR(255),
|
||||
event_id BIGINT,
|
||||
group_team_size INT DEFAULT 2,
|
||||
CONSTRAINT fk_match_group_event FOREIGN KEY (event_id) REFERENCES event (id)
|
||||
);
|
||||
|
||||
-- Create match table
|
||||
CREATE TABLE `match`
|
||||
(
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
match_group_id BIGINT,
|
||||
team_a_id BIGINT,
|
||||
team_b_id BIGINT,
|
||||
score_a INT DEFAULT 0,
|
||||
score_b INT DEFAULT 0,
|
||||
team_a_win BIT DEFAULT 0,
|
||||
team_b_win BIT DEFAULT 0,
|
||||
score_verified BIT DEFAULT 0,
|
||||
CONSTRAINT fk_match_group FOREIGN KEY (match_group_id) REFERENCES match_group (id),
|
||||
CONSTRAINT fk_team_a FOREIGN KEY (team_a_id) REFERENCES team (id),
|
||||
CONSTRAINT fk_team_b FOREIGN KEY (team_b_id) REFERENCES team (id)
|
||||
);
|
||||
|
||||
-- Add match_group_id column to team table
|
||||
ALTER TABLE team
|
||||
ADD COLUMN match_group_id BIGINT,
|
||||
ADD CONSTRAINT fk_team_match_group FOREIGN KEY (match_group_id) REFERENCES match_group (id);
|
|
@ -29,6 +29,8 @@ import java.sql.Timestamp;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
@ -126,6 +128,12 @@ public class Event implements Serializable {
|
|||
@Column(name = "`allow_wait_list`")
|
||||
private boolean allowWaitList;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "event_co_host_player",
|
||||
joinColumns = {@JoinColumn(name = "event_id",referencedColumnName = "id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "player_id",referencedColumnName = "id")})
|
||||
private List<Player> coHostPlayers = new ArrayList<>();
|
||||
|
||||
public void copy(Event source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class Match implements Serializable {
|
|||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@Column(name = "id")
|
||||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
|
@ -23,27 +23,27 @@ public class Match implements Serializable {
|
|||
private MatchGroup matchGroup;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "team_player_a_id")
|
||||
private TeamPlayer teamPlayerA;
|
||||
@JoinColumn(name = "team_a_id")
|
||||
private Team teamA;
|
||||
|
||||
@Column(name = "`score_a`")
|
||||
@Column(name = "score_a")
|
||||
@ApiModelProperty(value = "Score A")
|
||||
private int scoreA;
|
||||
|
||||
@Column(name = "`team_a_win`")
|
||||
@Column(name = "team_a_win")
|
||||
private boolean teamAWin;
|
||||
|
||||
@Column(name = "`score_b`")
|
||||
@Column(name = "score_b")
|
||||
@ApiModelProperty(value = "Score B")
|
||||
private int scoreB;
|
||||
|
||||
@Column(name = "`team_b_win`")
|
||||
@Column(name = "team_b_win")
|
||||
private boolean teamBWin;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "team_player_b_id")
|
||||
private TeamPlayer teamPlayerB;
|
||||
@JoinColumn(name = "team_b_id")
|
||||
private Team teamB;
|
||||
|
||||
@Column(name = "`score_verified`")
|
||||
@Column(name = "score_verified")
|
||||
private boolean scoreVerified;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Setter;
|
|||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -14,15 +16,22 @@ public class MatchGroup implements Serializable {
|
|||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@Column(name = "id")
|
||||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "`name`")
|
||||
@Column(name = "name")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "event_id")
|
||||
private Event event;
|
||||
|
||||
// how many teams in one group
|
||||
@Column(name = "group_team_size")
|
||||
private int groupTeamSize;
|
||||
|
||||
@OneToMany(mappedBy = "matchGroup")
|
||||
private List<Team> teams = new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -7,24 +7,28 @@ import java.io.Serializable;
|
|||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "`team`")
|
||||
@Table(name = "team")
|
||||
public class Team implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@Column(name = "id")
|
||||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "match_group_id")
|
||||
private MatchGroup matchGroup;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "event_id")
|
||||
private Event event;
|
||||
|
||||
@Column(name = "`name`")
|
||||
@Column(name = "name")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`team_size`")
|
||||
@Column(name = "team_size")
|
||||
@ApiModelProperty(value = "Team size")
|
||||
private int teamSize;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
@ -85,4 +86,7 @@ public class EventDto implements Serializable {
|
|||
private boolean isPublic;
|
||||
|
||||
private boolean allowWaitList;
|
||||
|
||||
@ApiModelProperty(value = "Co-host players")
|
||||
private List<PlayerDto> coHostPlayers;
|
||||
}
|
|
@ -35,15 +35,24 @@ public class MatchDto implements Serializable {
|
|||
@ApiModelProperty(value = "Match Group id")
|
||||
private Long matchGroupId;
|
||||
|
||||
@ApiModelProperty(value = "Team 1 id")
|
||||
private Long team1Id;
|
||||
@ApiModelProperty(value = "Team A id")
|
||||
private Long teamAId;
|
||||
|
||||
@ApiModelProperty(value = "Team 2 id")
|
||||
private Long team2Id;
|
||||
@ApiModelProperty(value = "Team B id")
|
||||
private Long teamBId;
|
||||
|
||||
@ApiModelProperty(value = "Score Team 1")
|
||||
private Integer scoreTeam1;
|
||||
@ApiModelProperty(value = "Score A")
|
||||
private Integer scoreA;
|
||||
|
||||
@ApiModelProperty(value = "Score Team 2")
|
||||
private Integer scoreTeam2;
|
||||
@ApiModelProperty(value = "Score B")
|
||||
private Integer scoreB;
|
||||
|
||||
@ApiModelProperty(value = "Team A Win")
|
||||
private Boolean teamAWin;
|
||||
|
||||
@ApiModelProperty(value = "Team B Win")
|
||||
private Boolean teamBWin;
|
||||
|
||||
@ApiModelProperty(value = "Score Verified")
|
||||
private Boolean scoreVerified;
|
||||
}
|
||||
|
|
|
@ -37,4 +37,7 @@ public class MatchGroupDto implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "Event id")
|
||||
private Long eventId;
|
||||
|
||||
@ApiModelProperty(value = "Group team size")
|
||||
private Integer groupTeamSize;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@ public class TeamDto implements Serializable {
|
|||
@ApiModelProperty(value = "Event")
|
||||
private Long eventId;
|
||||
|
||||
@ApiModelProperty(value = "Match Group")
|
||||
private Long matchGroupId;
|
||||
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019-2025 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.srr.dto.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import com.srr.domain.MatchGroup;
|
||||
import com.srr.dto.MatchGroupDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MatchGroupMapper extends BaseMapper<MatchGroupDto, MatchGroup> {
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019-2025 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.srr.dto.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import com.srr.domain.Match;
|
||||
import com.srr.dto.MatchDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MatchMapper extends BaseMapper<MatchDto, Match> {
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019-2025 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.srr.dto.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import com.srr.domain.Team;
|
||||
import com.srr.dto.TeamDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TeamMapper extends BaseMapper<TeamDto, Team> {
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019-2025 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.srr.dto.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import com.srr.domain.TeamPlayer;
|
||||
import com.srr.dto.TeamPlayerDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TeamPlayerMapper extends BaseMapper<TeamPlayerDto, TeamPlayer> {
|
||||
|
||||
}
|
Loading…
Reference in New Issue