diff --git a/eladmin-common/src/main/java/me/zhengjie/exception/EntityNotFoundException.java b/eladmin-common/src/main/java/me/zhengjie/exception/EntityNotFoundException.java
index 4d9f4d96..2702ede8 100644
--- a/eladmin-common/src/main/java/me/zhengjie/exception/EntityNotFoundException.java
+++ b/eladmin-common/src/main/java/me/zhengjie/exception/EntityNotFoundException.java
@@ -23,12 +23,16 @@ import org.springframework.util.StringUtils;
*/
public class EntityNotFoundException extends RuntimeException {
- public EntityNotFoundException(Class clazz, String field, String val) {
+ public EntityNotFoundException(Class> clazz, String field, String val) {
super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val));
}
+ public EntityNotFoundException(Class> clazz, String field, Long val) {
+ super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, "" + val));
+ }
+
private static String generateMessage(String entity, String field, String val) {
return StringUtils.capitalize(entity)
- + " with " + field + " "+ val + " does not exist";
+ + " with " + field + " " + val + " does not exist";
}
}
\ No newline at end of file
diff --git a/eladmin-system/src/main/resources/db/migration/V11__add_event_tags.sql b/eladmin-system/src/main/resources/db/migration/V11__add_event_tags.sql
new file mode 100644
index 00000000..3609626a
--- /dev/null
+++ b/eladmin-system/src/main/resources/db/migration/V11__add_event_tags.sql
@@ -0,0 +1,4 @@
+-- Add tags column to event table
+ALTER TABLE event
+ add column poster_image varchar(255),
+ ADD COLUMN tags VARCHAR(255) NULL COMMENT 'Tags stored as comma-delimited string';
diff --git a/pom.xml b/pom.xml
index f636015f..2c0ce0c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
1.2.9UTF-8UTF-8
- 1.8
+ 172.0.541.2.192.11.1
diff --git a/sport/src/main/java/com/srr/converter/StringListConverter.java b/sport/src/main/java/com/srr/converter/StringListConverter.java
new file mode 100644
index 00000000..2d39f80d
--- /dev/null
+++ b/sport/src/main/java/com/srr/converter/StringListConverter.java
@@ -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.converter;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Converter to store List as a comma-delimited string in database
+ * @author Chanheng
+ * @date 2025-05-26
+ */
+@Converter
+public class StringListConverter implements AttributeConverter, String> {
+
+ private static final String DELIMITER = ",";
+
+ @Override
+ public String convertToDatabaseColumn(List stringList) {
+ if (stringList == null || stringList.isEmpty()) {
+ return null;
+ }
+ return String.join(DELIMITER, stringList);
+ }
+
+ @Override
+ public List convertToEntityAttribute(String string) {
+ if (string == null || string.isEmpty()) {
+ return new ArrayList<>();
+ }
+ return new ArrayList<>(Arrays.asList(string.split(DELIMITER)));
+ }
+}
diff --git a/sport/src/main/java/com/srr/domain/Event.java b/sport/src/main/java/com/srr/domain/Event.java
index b4ee0a61..facfa69d 100644
--- a/sport/src/main/java/com/srr/domain/Event.java
+++ b/sport/src/main/java/com/srr/domain/Event.java
@@ -15,6 +15,7 @@
*/
package com.srr.domain;
+import com.srr.converter.StringListConverter;
import com.srr.enumeration.EventStatus;
import com.srr.enumeration.Format;
import lombok.Data;
@@ -24,6 +25,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
+import javax.persistence.Convert;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import javax.validation.constraints.NotBlank;
@@ -138,6 +140,13 @@ public class Event implements Serializable {
@Column(name = "`allow_wait_list`")
private boolean allowWaitList;
+ @Column(name = "`poster_image`")
+ private String posterImage;
+
+ @Column(name = "`tags`")
+ @Convert(converter = StringListConverter.class)
+ private List tags = new ArrayList<>();
+
@ManyToMany
@JoinTable(name = "event_co_host_player",
joinColumns = {@JoinColumn(name = "event_id",referencedColumnName = "id")},
diff --git a/sport/src/main/java/com/srr/dto/EventDto.java b/sport/src/main/java/com/srr/dto/EventDto.java
index 6b0361e7..b0146795 100644
--- a/sport/src/main/java/com/srr/dto/EventDto.java
+++ b/sport/src/main/java/com/srr/dto/EventDto.java
@@ -92,7 +92,12 @@ public class EventDto implements Serializable {
@ApiModelProperty(value = "Number of groups")
private Integer groupCount;
+
+ private String posterImage;
@ApiModelProperty(value = "Co-host players")
private List coHostPlayers;
+
+ @ApiModelProperty(value = "Tags")
+ private List tags;
}
\ No newline at end of file
diff --git a/sport/src/main/java/com/srr/dto/JoinEventDto.java b/sport/src/main/java/com/srr/dto/JoinEventDto.java
new file mode 100644
index 00000000..6090db72
--- /dev/null
+++ b/sport/src/main/java/com/srr/dto/JoinEventDto.java
@@ -0,0 +1,13 @@
+package com.srr.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+public class JoinEventDto {
+ private Long playerId;
+ @NotNull
+ private Long eventId;
+ private Long teamId;
+}
diff --git a/sport/src/main/java/com/srr/rest/EventController.java b/sport/src/main/java/com/srr/rest/EventController.java
index 296520cd..b2e36ebf 100644
--- a/sport/src/main/java/com/srr/rest/EventController.java
+++ b/sport/src/main/java/com/srr/rest/EventController.java
@@ -1,42 +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.
-*/
+ * 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.rest;
-import me.zhengjie.annotation.Log;
import com.srr.domain.Event;
-import com.srr.service.EventService;
+import com.srr.dto.EventDto;
import com.srr.dto.EventQueryCriteria;
-import org.springframework.data.domain.Pageable;
+import com.srr.dto.JoinEventDto;
+import com.srr.enumeration.EventStatus;
+import com.srr.service.EventService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
+import me.zhengjie.annotation.Log;
+import me.zhengjie.utils.PageResult;
+import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import io.swagger.annotations.*;
-import java.io.IOException;
+
import javax.servlet.http.HttpServletResponse;
-import me.zhengjie.utils.PageResult;
-import com.srr.dto.EventDto;
+import java.io.IOException;
/**
-* @website https://eladmin.vip
-* @author Chanheng
-* @date 2025-05-18
-**/
+ * @author Chanheng
+ * @website https://eladmin.vip
+ * @date 2025-05-18
+ **/
@RestController
@RequiredArgsConstructor
@Api(tags = "event")
@@ -55,26 +60,42 @@ public class EventController {
@GetMapping
@ApiOperation("Query event")
@PreAuthorize("@el.check('event:list')")
- public ResponseEntity> queryEvent(EventQueryCriteria criteria, Pageable pageable){
- return new ResponseEntity<>(eventService.queryAll(criteria,pageable),HttpStatus.OK);
+ public ResponseEntity> queryEvent(EventQueryCriteria criteria, Pageable pageable) {
+ return new ResponseEntity<>(eventService.queryAll(criteria, pageable), HttpStatus.OK);
}
@PostMapping
@Log("Add event")
@ApiOperation("Add event")
@PreAuthorize("@el.check('event:add')")
- public ResponseEntity