add Match

pull/882/head
chanhengseang 2025-05-25 18:14:57 -07:00
parent 69b559997d
commit e7b914c00b
9 changed files with 229 additions and 0 deletions

View File

@ -14,6 +14,7 @@ CREATE TABLE team_player (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
team_id BIGINT,
player_id BIGINT,
score DOUBLE DEFAULT NULL,
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)

View File

@ -0,0 +1,49 @@
package com.srr.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Setter
@Getter
public class Match implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`id`")
@ApiModelProperty(value = "id", hidden = true)
private Long id;
@ManyToOne
@JoinColumn(name = "match_group_id")
private MatchGroup matchGroup;
@ManyToOne
@JoinColumn(name = "team_player_a_id")
private TeamPlayer teamPlayerA;
@Column(name = "`score_a`")
@ApiModelProperty(value = "Score A")
private int scoreA;
@Column(name = "`team_a_win`")
private boolean teamAWin;
@Column(name = "`score_b`")
@ApiModelProperty(value = "Score B")
private int scoreB;
@Column(name = "`team_b_win`")
private boolean teamBWin;
@ManyToOne
@JoinColumn(name = "team_player_b_id")
private TeamPlayer teamPlayerB;
@Column(name = "`score_verified`")
private boolean scoreVerified;
}

View File

@ -0,0 +1,28 @@
package com.srr.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
public class MatchGroup implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`id`")
@ApiModelProperty(value = "id", hidden = true)
private Long id;
@Column(name = "`name`")
@ApiModelProperty(value = "Name")
private String name;
@ManyToOne
@JoinColumn(name = "event_id")
private Event event;
}

View File

@ -22,6 +22,9 @@ public class TeamPlayer implements Serializable {
@JoinColumn(name = "team_id")
private Team team;
@Column(name = "`score`")
private Double score;
@ManyToOne
@JoinColumn(name = "player_id")
private Player player;

View File

@ -0,0 +1,49 @@
/*
* 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 MatchDto implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "Match Group id")
private Long matchGroupId;
@ApiModelProperty(value = "Team 1 id")
private Long team1Id;
@ApiModelProperty(value = "Team 2 id")
private Long team2Id;
@ApiModelProperty(value = "Score Team 1")
private Integer scoreTeam1;
@ApiModelProperty(value = "Score Team 2")
private Integer scoreTeam2;
}

View File

@ -0,0 +1,40 @@
/*
* 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 MatchGroupDto implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "Name")
private String name;
@ApiModelProperty(value = "Event id")
private Long eventId;
}

View File

@ -41,6 +41,9 @@ public class TeamPlayerDto implements Serializable {
@ApiModelProperty(value = "Player name")
private String playerName;
@ApiModelProperty(value = "Score")
private Double score;
@ApiModelProperty(value = "Is checked in")
private Boolean isCheckedIn;
}

View File

@ -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.MatchGroup;
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 MatchGroupRepository extends JpaRepository<MatchGroup, Long>, JpaSpecificationExecutor<MatchGroup> {
}

View File

@ -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.Match;
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 MatchRepository extends JpaRepository<Match, Long>, JpaSpecificationExecutor<Match> {
}