mirror of https://github.com/elunez/eladmin
add team
parent
009714e38b
commit
69b559997d
|
@ -2,3 +2,19 @@ alter table event
|
|||
add column status varchar(255),
|
||||
add column is_public bit default 0,
|
||||
add column allow_wait_list bit default 0;
|
||||
|
||||
CREATE TABLE team (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
event_id BIGINT references event(id),
|
||||
name VARCHAR(255),
|
||||
team_size INT default 2
|
||||
);
|
||||
|
||||
CREATE TABLE team_player (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
team_id BIGINT,
|
||||
player_id BIGINT,
|
||||
is_checked_in BIT DEFAULT 0,
|
||||
CONSTRAINT fk_team FOREIGN KEY (team_id) REFERENCES team(id),
|
||||
CONSTRAINT fk_player FOREIGN KEY (player_id) REFERENCES player(id)
|
||||
);
|
||||
|
|
|
@ -16,6 +16,10 @@ public class Team implements Serializable {
|
|||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "event_id")
|
||||
private Event event;
|
||||
|
||||
@Column(name = "`name`")
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
@ -25,8 +29,6 @@ public class Team implements Serializable {
|
|||
private int teamSize;
|
||||
|
||||
@OneToMany(mappedBy = "team")
|
||||
@JoinTable(name = "team_players",
|
||||
joinColumns = {@JoinColumn(name = "team_id",referencedColumnName = "id")})
|
||||
@ApiModelProperty(value = "Players")
|
||||
private List<Player> players; // <Player>
|
||||
@ApiModelProperty(value = "teamPlayers")
|
||||
private List<TeamPlayer> teamPlayers;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Data
|
||||
public class TeamDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "Event")
|
||||
private Long eventId;
|
||||
|
||||
@ApiModelProperty(value = "Name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "Team size")
|
||||
private Integer teamSize;
|
||||
|
||||
@ApiModelProperty(value = "Team players")
|
||||
private List<TeamPlayerDto> teamPlayers;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
@Data
|
||||
public class TeamPlayerDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "Team id")
|
||||
private Long teamId;
|
||||
|
||||
@ApiModelProperty(value = "Player id")
|
||||
private Long playerId;
|
||||
|
||||
@ApiModelProperty(value = "Player name")
|
||||
private String playerName;
|
||||
|
||||
@ApiModelProperty(value = "Is checked in")
|
||||
private Boolean isCheckedIn;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.repository;
|
||||
|
||||
import com.srr.domain.TeamPlayer;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
public interface TeamPlayerRepository extends JpaRepository<TeamPlayer, Long>, JpaSpecificationExecutor<TeamPlayer> {
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.repository;
|
||||
|
||||
import com.srr.domain.Team;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-25
|
||||
**/
|
||||
public interface TeamRepository extends JpaRepository<Team, Long>, JpaSpecificationExecutor<Team> {
|
||||
}
|
Loading…
Reference in New Issue