mirror of https://github.com/elunez/eladmin
build jar
parent
e8aee9751b
commit
004998166d
|
@ -49,5 +49,4 @@ public enum DataScopeEnum {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
45
pom.xml
45
pom.xml
|
@ -34,6 +34,7 @@
|
||||||
<druid.version>1.2.19</druid.version>
|
<druid.version>1.2.19</druid.version>
|
||||||
<commons-pool2.version>2.11.1</commons-pool2.version>
|
<commons-pool2.version>2.11.1</commons-pool2.version>
|
||||||
<mapstruct.version>1.4.2.Final</mapstruct.version>
|
<mapstruct.version>1.4.2.Final</mapstruct.version>
|
||||||
|
<lombok.version>1.18.30</lombok.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -160,7 +161,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<version>${lombok.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- excel tool -->
|
<!-- excel tool -->
|
||||||
|
@ -241,6 +243,47 @@
|
||||||
<skip>true</skip>
|
<skip>true</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Configure Maven compiler plugin to properly handle Lombok -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-parameters</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Lombok plugin to ensure annotation processing -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok-maven-plugin</artifactId>
|
||||||
|
<version>1.18.20.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>delombok</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<properties>
|
<properties>
|
||||||
<hutool.version>5.8.35</hutool.version>
|
<hutool.version>5.8.35</hutool.version>
|
||||||
|
<mapstruct.version>1.5.3.Final</mapstruct.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<artifactId>sport</artifactId>
|
<artifactId>sport</artifactId>
|
||||||
|
@ -25,5 +26,49 @@
|
||||||
<artifactId>eladmin-tools</artifactId>
|
<artifactId>eladmin-tools</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Explicitly add Lombok with provided scope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<!-- Add build configuration specific to sport module -->
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-Amapstruct.defaultComponentModel=spring</arg>
|
||||||
|
<arg>-parameters</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
|
@ -40,50 +40,50 @@ public class Club implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`name`",nullable = false)
|
@Column(name = "name",nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "Name")
|
@ApiModelProperty(value = "Name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name = "`description`")
|
@Column(name = "description")
|
||||||
@ApiModelProperty(value = "Description")
|
@ApiModelProperty(value = "Description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
@Column(name = "create_time")
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||||
private Timestamp createTime;
|
private Timestamp createTime;
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
@Column(name = "update_time")
|
||||||
@UpdateTimestamp
|
@UpdateTimestamp
|
||||||
@ApiModelProperty(value = "Update time", hidden = true)
|
@ApiModelProperty(value = "Update time", hidden = true)
|
||||||
private Timestamp updateTime;
|
private Timestamp updateTime;
|
||||||
|
|
||||||
@Column(name = "`icon`")
|
@Column(name = "icon")
|
||||||
@ApiModelProperty(value = "Icon")
|
@ApiModelProperty(value = "Icon")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
@Column(name = "`sort`")
|
@Column(name = "sort")
|
||||||
@ApiModelProperty(value = "Sort")
|
@ApiModelProperty(value = "Sort")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@Column(name = "`enabled`")
|
@Column(name = "enabled")
|
||||||
@ApiModelProperty(value = "Enabled")
|
@ApiModelProperty(value = "Enabled")
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
|
|
||||||
@Column(name = "`location`")
|
@Column(name = "location")
|
||||||
@ApiModelProperty(value = "Location")
|
@ApiModelProperty(value = "Location")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
@Column(name = "`longitude`")
|
@Column(name = "longitude")
|
||||||
@ApiModelProperty(value = "Longitude")
|
@ApiModelProperty(value = "Longitude")
|
||||||
private Double longitude;
|
private Double longitude;
|
||||||
|
|
||||||
@Column(name = "`latitude`")
|
@Column(name = "latitude")
|
||||||
@ApiModelProperty(value = "Latitude")
|
@ApiModelProperty(value = "Latitude")
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
|
||||||
|
|
|
@ -40,29 +40,29 @@ public class Court implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`club_id`")
|
@Column(name = "club_id")
|
||||||
@ApiModelProperty(value = "clubId")
|
@ApiModelProperty(value = "clubId")
|
||||||
private Long clubId;
|
private Long clubId;
|
||||||
|
|
||||||
@Column(name = "`sport_id`")
|
@Column(name = "sport_id")
|
||||||
@ApiModelProperty(value = "sportId")
|
@ApiModelProperty(value = "sportId")
|
||||||
private Long sportId;
|
private Long sportId;
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
@Column(name = "create_time")
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||||
private Timestamp createTime;
|
private Timestamp createTime;
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
@Column(name = "update_time")
|
||||||
@UpdateTimestamp
|
@UpdateTimestamp
|
||||||
@ApiModelProperty(value = "Update time", hidden = true)
|
@ApiModelProperty(value = "Update time", hidden = true)
|
||||||
private Timestamp updateTime;
|
private Timestamp updateTime;
|
||||||
|
|
||||||
@Column(name = "`amount`",nullable = false)
|
@Column(name = "amount",nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "Amount")
|
@ApiModelProperty(value = "Amount")
|
||||||
private Integer amount;
|
private Integer amount;
|
||||||
|
|
|
@ -18,7 +18,8 @@ package com.srr.domain;
|
||||||
import com.srr.converter.StringListConverter;
|
import com.srr.converter.StringListConverter;
|
||||||
import com.srr.enumeration.EventStatus;
|
import com.srr.enumeration.EventStatus;
|
||||||
import com.srr.enumeration.Format;
|
import com.srr.enumeration.Format;
|
||||||
import lombok.Data;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
@ -41,7 +42,8 @@ import java.util.List;
|
||||||
* @date 2025-05-18
|
* @date 2025-05-18
|
||||||
**/
|
**/
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Getter
|
||||||
|
@Setter
|
||||||
@Table(name="event")
|
@Table(name="event")
|
||||||
@SQLDelete(sql = "update event set status = 'DELETED' where id = ?", check = ResultCheckStyle.COUNT)
|
@SQLDelete(sql = "update event set status = 'DELETED' where id = ?", check = ResultCheckStyle.COUNT)
|
||||||
@Where(clause = "status != 'DELETED'")
|
@Where(clause = "status != 'DELETED'")
|
||||||
|
@ -49,105 +51,105 @@ public class Event implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`name`",nullable = false)
|
@Column(name = "name", nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "Name")
|
@ApiModelProperty(value = "Name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name = "`description`")
|
@Column(name = "description")
|
||||||
@ApiModelProperty(value = "Description")
|
@ApiModelProperty(value = "Description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "`format`",nullable = false)
|
@Column(name = "format", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@ApiModelProperty(value = "SINGLE, DOUBLE")
|
@ApiModelProperty(value = "SINGLE, DOUBLE")
|
||||||
private Format format;
|
private Format format;
|
||||||
|
|
||||||
@Column(name = "`location`")
|
@Column(name = "location")
|
||||||
@ApiModelProperty(value = "Location")
|
@ApiModelProperty(value = "Location")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
@Column(name = "`image`")
|
@Column(name = "image")
|
||||||
@ApiModelProperty(value = "Image")
|
@ApiModelProperty(value = "Image")
|
||||||
private String image;
|
private String image;
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
@Column(name = "create_time")
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||||
private Timestamp createTime;
|
private Timestamp createTime;
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
@Column(name = "update_time")
|
||||||
@UpdateTimestamp
|
@UpdateTimestamp
|
||||||
@ApiModelProperty(value = "Update time", hidden = true)
|
@ApiModelProperty(value = "Update time", hidden = true)
|
||||||
private Timestamp updateTime;
|
private Timestamp updateTime;
|
||||||
|
|
||||||
@Column(name = "`check_in_at`")
|
@Column(name = "check_in_at")
|
||||||
@ApiModelProperty(value = "Check in time", hidden = true)
|
@ApiModelProperty(value = "Check in time", hidden = true)
|
||||||
private Timestamp checkInAt;
|
private Timestamp checkInAt;
|
||||||
|
|
||||||
@Column(name = "`group_count`")
|
@Column(name = "group_count")
|
||||||
@ApiModelProperty(value = "Number of groups")
|
@ApiModelProperty(value = "Number of groups")
|
||||||
private Integer groupCount;
|
private Integer groupCount;
|
||||||
|
|
||||||
@Column(name = "`sort`")
|
@Column(name = "sort")
|
||||||
@ApiModelProperty(value = "Sort")
|
@ApiModelProperty(value = "Sort")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@Column(name = "`enabled`")
|
@Column(name = "enabled")
|
||||||
@ApiModelProperty(value = "Enabled")
|
@ApiModelProperty(value = "Enabled")
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
|
|
||||||
@Column(name = "`event_time`",nullable = false)
|
@Column(name = "event_time", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "Time")
|
@ApiModelProperty(value = "Time")
|
||||||
private Timestamp eventTime;
|
private Timestamp eventTime;
|
||||||
|
|
||||||
@Column(name = "`club_id`",nullable = false)
|
@Column(name = "club_id", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "clubId")
|
@ApiModelProperty(value = "clubId")
|
||||||
private Long clubId;
|
private Long clubId;
|
||||||
|
|
||||||
@Column(name = "`public_link`")
|
@Column(name = "public_link")
|
||||||
@ApiModelProperty(value = "publicLink", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
|
@ApiModelProperty(value = "publicLink", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
|
||||||
private String publicLink;
|
private String publicLink;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "`sport_id`",nullable = false)
|
@Column(name = "sport_id", nullable = false)
|
||||||
@ApiModelProperty(value = "sportId")
|
@ApiModelProperty(value = "sportId")
|
||||||
private Long sportId;
|
private Long sportId;
|
||||||
|
|
||||||
@Column(name = "`create_by`")
|
@Column(name = "create_by")
|
||||||
@ApiModelProperty(value = "createBy")
|
@ApiModelProperty(value = "createBy")
|
||||||
private Long createBy;
|
private Long createBy;
|
||||||
|
|
||||||
@Column(name = "`status`")
|
@Column(name = "status")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@ApiModelProperty(value = "status")
|
@ApiModelProperty(value = "status")
|
||||||
private EventStatus status;
|
private EventStatus status;
|
||||||
|
|
||||||
@Column(name = "`is_public`")
|
@Column(name = "is_public")
|
||||||
private boolean isPublic;
|
private boolean isPublic;
|
||||||
|
|
||||||
@Column(name = "`allow_wait_list`")
|
@Column(name = "allow_wait_list")
|
||||||
private boolean allowWaitList;
|
private boolean allowWaitList;
|
||||||
|
|
||||||
@Column(name = "`current_participants`")
|
@Column(name = "current_participants")
|
||||||
@ApiModelProperty(value = "Current number of participants")
|
@ApiModelProperty(value = "Current number of participants")
|
||||||
private Integer currentParticipants = 0;
|
private Integer currentParticipants = 0;
|
||||||
|
|
||||||
@Column(name = "`max_participants`")
|
@Column(name = "max_participants")
|
||||||
@ApiModelProperty(value = "Maximum number of participants")
|
@ApiModelProperty(value = "Maximum number of participants")
|
||||||
private Integer maxParticipants;
|
private Integer maxParticipants;
|
||||||
|
|
||||||
@Column(name = "`poster_image`")
|
@Column(name = "poster_image")
|
||||||
private String posterImage;
|
private String posterImage;
|
||||||
|
|
||||||
@Column(name = "`tags`")
|
@Column(name = "tags")
|
||||||
@Convert(converter = StringListConverter.class)
|
@Convert(converter = StringListConverter.class)
|
||||||
private List<String> tags = new ArrayList<>();
|
private List<String> tags = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,19 @@
|
||||||
*/
|
*/
|
||||||
package com.srr.domain;
|
package com.srr.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import org.hibernate.annotations.*;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
@ -35,52 +36,53 @@ import java.io.Serializable;
|
||||||
* @date 2025-05-18
|
* @date 2025-05-18
|
||||||
**/
|
**/
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Getter
|
||||||
|
@Setter
|
||||||
@Table(name="player")
|
@Table(name="player")
|
||||||
public class Player implements Serializable {
|
public class Player implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(name = "`name`",nullable = false)
|
@Column(name = "name", nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "Name")
|
@ApiModelProperty(value = "Name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name = "`description`")
|
@Column(name = "description")
|
||||||
@ApiModelProperty(value = "Description")
|
@ApiModelProperty(value = "Description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "`latitude`")
|
@Column(name = "latitude")
|
||||||
@ApiModelProperty(value = "Latitude")
|
@ApiModelProperty(value = "Latitude")
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
|
||||||
@Column(name = "`longitude`")
|
@Column(name = "longitude")
|
||||||
@ApiModelProperty(value = "Longitude")
|
@ApiModelProperty(value = "Longitude")
|
||||||
private Double longitude;
|
private Double longitude;
|
||||||
|
|
||||||
@Column(name = "`profile_image`")
|
@Column(name = "profile_image")
|
||||||
@ApiModelProperty(value = "Image")
|
@ApiModelProperty(value = "Image")
|
||||||
private String profileImage;
|
private String profileImage;
|
||||||
|
|
||||||
@Column(name = "`create_time`")
|
@Column(name = "create_time")
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||||
private Timestamp createTime;
|
private Timestamp createTime;
|
||||||
|
|
||||||
@Column(name = "`update_time`")
|
@Column(name = "update_time")
|
||||||
@UpdateTimestamp
|
@UpdateTimestamp
|
||||||
@ApiModelProperty(value = "Update time", hidden = true)
|
@ApiModelProperty(value = "Update time", hidden = true)
|
||||||
private Timestamp updateTime;
|
private Timestamp updateTime;
|
||||||
|
|
||||||
@Column(name = "`rate_score`")
|
@Column(name = "rate_score")
|
||||||
@ApiModelProperty(value = "Score")
|
@ApiModelProperty(value = "Score")
|
||||||
private Double rateScore;
|
private Double rateScore;
|
||||||
|
|
||||||
@Column(name = "`user_id`",nullable = false)
|
@Column(name = "user_id", nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "userId")
|
@ApiModelProperty(value = "userId")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
package com.srr.domain;
|
package com.srr.domain;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
@Table(name = "team")
|
@Table(name = "team")
|
||||||
public class Team implements Serializable {
|
public class Team implements Serializable {
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ import java.io.Serializable;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "`team_player`")
|
@Table(name = "team_player")
|
||||||
public class TeamPlayer implements Serializable {
|
public class TeamPlayer implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ public class TeamPlayer implements Serializable {
|
||||||
@JoinColumn(name = "team_id")
|
@JoinColumn(name = "team_id")
|
||||||
private Team team;
|
private Team team;
|
||||||
|
|
||||||
@Column(name = "`score`")
|
@Column(name = "score")
|
||||||
private Double score;
|
private Double score;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "player_id")
|
@JoinColumn(name = "player_id")
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
@Column(name = "`is_checked_in`")
|
@Column(name = "is_checked_in")
|
||||||
private boolean isCheckedIn;
|
private boolean isCheckedIn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2025-05-25
|
* @date 2025-05-25
|
||||||
**/
|
**/
|
||||||
public interface TeamPlayerRepository extends JpaRepository<TeamPlayer, Long>, JpaSpecificationExecutor<TeamPlayer> {
|
public interface TeamPlayerRepository extends JpaRepository<TeamPlayer, Long>, JpaSpecificationExecutor<TeamPlayer> {
|
||||||
|
boolean existsByTeamIdAndPlayerId(Long teamId, Long playerId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,11 @@
|
||||||
package com.srr.service.impl;
|
package com.srr.service.impl;
|
||||||
|
|
||||||
import com.srr.domain.Event;
|
import com.srr.domain.Event;
|
||||||
|
import com.srr.domain.Player;
|
||||||
|
import com.srr.domain.Team;
|
||||||
|
import com.srr.domain.TeamPlayer;
|
||||||
import com.srr.enumeration.EventStatus;
|
import com.srr.enumeration.EventStatus;
|
||||||
|
import com.srr.enumeration.Format;
|
||||||
import me.zhengjie.exception.EntityNotFoundException;
|
import me.zhengjie.exception.EntityNotFoundException;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
import me.zhengjie.utils.FileUtil;
|
import me.zhengjie.utils.FileUtil;
|
||||||
|
@ -104,7 +108,7 @@ public class EventServiceImpl implements EventService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public EventDto updateStatus(Long id, EventStatus status) {
|
public EventDto updateStatus(Long id, EventStatus status) {
|
||||||
Event event = eventRepository.findById(id)
|
Event event = eventRepository.findById(id)
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", id));
|
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", Long.valueOf(id)));
|
||||||
|
|
||||||
// Only update the status field
|
// Only update the status field
|
||||||
event.setStatus(status);
|
event.setStatus(status);
|
||||||
|
@ -121,7 +125,7 @@ public class EventServiceImpl implements EventService {
|
||||||
public EventDto joinEvent(JoinEventDto joinEventDto) {
|
public EventDto joinEvent(JoinEventDto joinEventDto) {
|
||||||
// Find the event
|
// Find the event
|
||||||
Event event = eventRepository.findById(joinEventDto.getEventId())
|
Event event = eventRepository.findById(joinEventDto.getEventId())
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", joinEventDto.getEventId()));
|
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", Long.valueOf(joinEventDto.getEventId())));
|
||||||
|
|
||||||
// Check if event allows joining
|
// Check if event allows joining
|
||||||
if (event.getStatus() != EventStatus.OPEN) {
|
if (event.getStatus() != EventStatus.OPEN) {
|
||||||
|
@ -143,11 +147,75 @@ public class EventServiceImpl implements EventService {
|
||||||
// Handle team-related logic
|
// Handle team-related logic
|
||||||
if (joinEventDto.getTeamId() != null) {
|
if (joinEventDto.getTeamId() != null) {
|
||||||
// Add player to existing team
|
// Add player to existing team
|
||||||
// For implementation, you'd use teamRepository and teamPlayerRepository
|
Team team = teamRepository.findById(joinEventDto.getTeamId())
|
||||||
// to check if team exists and add the player
|
.orElseThrow(() -> new EntityNotFoundException(Team.class, "id", Long.valueOf(joinEventDto.getTeamId())));
|
||||||
|
|
||||||
|
// Verify team belongs to this event
|
||||||
|
if (!team.getEvent().getId().equals(event.getId())) {
|
||||||
|
throw new BadRequestException("Team does not belong to this event");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if player is already in the team
|
||||||
|
if (teamPlayerRepository.existsByTeamIdAndPlayerId(team.getId(), joinEventDto.getPlayerId())) {
|
||||||
|
throw new BadRequestException("Player is already in this team");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if team is full
|
||||||
|
if (team.getTeamSize() == team.getTeamPlayers().size()) {
|
||||||
|
throw new BadRequestException("Team is already full");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add player to team
|
||||||
|
TeamPlayer teamPlayer = new TeamPlayer();
|
||||||
|
teamPlayer.setTeam(team);
|
||||||
|
Player player = new Player();
|
||||||
|
player.setId(joinEventDto.getPlayerId());
|
||||||
|
teamPlayer.setPlayer(player);
|
||||||
|
teamPlayer.setCheckedIn(false);
|
||||||
|
teamPlayerRepository.save(teamPlayer);
|
||||||
} else {
|
} else {
|
||||||
// Create new team for the player if needed
|
// Create new team for the player if needed or add as individual participant
|
||||||
// or add as individual participant depending on event format
|
if (event.getFormat() == Format.SINGLE) {
|
||||||
|
// For single format, create a "virtual" team with just one player
|
||||||
|
Team team = new Team();
|
||||||
|
team.setEvent(event);
|
||||||
|
team.setName("Player " + joinEventDto.getPlayerId());
|
||||||
|
team.setTeamSize(1);
|
||||||
|
Team savedTeam = teamRepository.save(team);
|
||||||
|
|
||||||
|
// Add player to the team
|
||||||
|
TeamPlayer teamPlayer = new TeamPlayer();
|
||||||
|
teamPlayer.setTeam(savedTeam);
|
||||||
|
Player player = new Player();
|
||||||
|
player.setId(joinEventDto.getPlayerId());
|
||||||
|
teamPlayer.setPlayer(player);
|
||||||
|
teamPlayer.setCheckedIn(false);
|
||||||
|
teamPlayerRepository.save(teamPlayer);
|
||||||
|
} else if (event.getFormat() == Format.DOUBLE || event.getFormat() == Format.TEAM) {
|
||||||
|
// For doubles/team format, create a new team
|
||||||
|
Team team = new Team();
|
||||||
|
team.setEvent(event);
|
||||||
|
team.setName("New Team");
|
||||||
|
|
||||||
|
// Set team size based on format
|
||||||
|
if (event.getFormat() == Format.DOUBLE) {
|
||||||
|
team.setTeamSize(2);
|
||||||
|
} else {
|
||||||
|
// Default team size of 4 for TEAM format, can be adjusted as needed
|
||||||
|
team.setTeamSize(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
Team savedTeam = teamRepository.save(team);
|
||||||
|
|
||||||
|
// Add player as the first member of the team
|
||||||
|
TeamPlayer teamPlayer = new TeamPlayer();
|
||||||
|
teamPlayer.setTeam(savedTeam);
|
||||||
|
Player player = new Player();
|
||||||
|
player.setId(joinEventDto.getPlayerId());
|
||||||
|
teamPlayer.setPlayer(player);
|
||||||
|
teamPlayer.setCheckedIn(false);
|
||||||
|
teamPlayerRepository.save(teamPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update participant count if not joining waitlist
|
// Update participant count if not joining waitlist
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class WaitListServiceImpl implements WaitListService {
|
||||||
public WaitListDto create(WaitList resources) {
|
public WaitListDto create(WaitList resources) {
|
||||||
// Validate event exists
|
// Validate event exists
|
||||||
Event event = eventRepository.findById(resources.getEventId())
|
Event event = eventRepository.findById(resources.getEventId())
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", resources.getEventId()));
|
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", Long.valueOf(resources.getEventId())));
|
||||||
|
|
||||||
// Check if player is already in wait list
|
// Check if player is already in wait list
|
||||||
if (waitListRepository.findByEventIdAndPlayerId(resources.getEventId(), resources.getPlayerId()) != null) {
|
if (waitListRepository.findByEventIdAndPlayerId(resources.getEventId(), resources.getPlayerId()) != null) {
|
||||||
|
@ -73,7 +73,7 @@ public class WaitListServiceImpl implements WaitListService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public void update(WaitList resources) {
|
public void update(WaitList resources) {
|
||||||
WaitList waitList = waitListRepository.findById(resources.getId())
|
WaitList waitList = waitListRepository.findById(resources.getId())
|
||||||
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", resources.getId()));
|
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", Long.valueOf(resources.getId())));
|
||||||
waitList.copy(resources);
|
waitList.copy(resources);
|
||||||
waitListRepository.save(waitList);
|
waitListRepository.save(waitList);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class WaitListServiceImpl implements WaitListService {
|
||||||
@Override
|
@Override
|
||||||
public WaitListDto findById(Long id) {
|
public WaitListDto findById(Long id) {
|
||||||
WaitList waitList = waitListRepository.findById(id)
|
WaitList waitList = waitListRepository.findById(id)
|
||||||
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", id));
|
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", Long.valueOf(id)));
|
||||||
return mapToDto(waitList);
|
return mapToDto(waitList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class WaitListServiceImpl implements WaitListService {
|
||||||
public List<WaitListDto> findByEventId(Long eventId) {
|
public List<WaitListDto> findByEventId(Long eventId) {
|
||||||
// Validate event exists
|
// Validate event exists
|
||||||
if (!eventRepository.existsById(eventId)) {
|
if (!eventRepository.existsById(eventId)) {
|
||||||
throw new EntityNotFoundException(Event.class, "id", eventId);
|
throw new EntityNotFoundException(Event.class, "id", Long.valueOf(eventId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return waitListRepository.findByEventId(eventId).stream()
|
return waitListRepository.findByEventId(eventId).stream()
|
||||||
|
@ -127,11 +127,11 @@ public class WaitListServiceImpl implements WaitListService {
|
||||||
public boolean promoteToParticipant(Long waitListId) {
|
public boolean promoteToParticipant(Long waitListId) {
|
||||||
// Find wait list entry
|
// Find wait list entry
|
||||||
WaitList waitList = waitListRepository.findById(waitListId)
|
WaitList waitList = waitListRepository.findById(waitListId)
|
||||||
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", waitListId));
|
.orElseThrow(() -> new EntityNotFoundException(WaitList.class, "id", Long.valueOf(waitListId)));
|
||||||
|
|
||||||
// Find event
|
// Find event
|
||||||
Event event = eventRepository.findById(waitList.getEventId())
|
Event event = eventRepository.findById(waitList.getEventId())
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", waitList.getEventId()));
|
.orElseThrow(() -> new EntityNotFoundException(Event.class, "id", Long.valueOf(waitList.getEventId())));
|
||||||
|
|
||||||
// Check if event is full
|
// Check if event is full
|
||||||
if (event.getCurrentParticipants() >= event.getMaxParticipants()) {
|
if (event.getCurrentParticipants() >= event.getMaxParticipants()) {
|
||||||
|
|
Loading…
Reference in New Issue