mirror of https://github.com/elunez/eladmin
event organizer and rating history
parent
c43cfc082f
commit
a9f294956c
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
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.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description Event organizer entity
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="event_organizer")
|
||||
public class EventOrganizer implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@UpdateTimestamp
|
||||
@ApiModelProperty(value = "Update time", hidden = true)
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`user_id`", nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "userId")
|
||||
private Long userId;
|
||||
|
||||
public void copy(EventOrganizer source){
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.srr.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
public class RatingHistory implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "player_id")
|
||||
private Player player;
|
||||
|
||||
@Column(name = "`rate_score`")
|
||||
@ApiModelProperty(value = "Score")
|
||||
private Double rateScore;
|
||||
|
||||
@Column(name = "`changes`")
|
||||
@ApiModelProperty(value = "Changes")
|
||||
private Double changes;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@CreationTimestamp
|
||||
@ApiModelProperty(value = "Creation time", hidden = true)
|
||||
private Timestamp createTime;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "match_id")
|
||||
private Match match;
|
||||
}
|
|
@ -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.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description Event organizer data transfer object
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Data
|
||||
public class EventOrganizerDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "Description")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "Creation time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@ApiModelProperty(value = "Update time")
|
||||
private Timestamp updateTime;
|
||||
|
||||
@ApiModelProperty(value = "User ID")
|
||||
private Long userId;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Data
|
||||
public class RatingHistoryDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "Player ID")
|
||||
private Long playerId;
|
||||
|
||||
@ApiModelProperty(value = "Player name")
|
||||
private String playerName;
|
||||
|
||||
@ApiModelProperty(value = "Rating score")
|
||||
private Double rateScore;
|
||||
|
||||
@ApiModelProperty(value = "Score changes")
|
||||
private Double changes;
|
||||
|
||||
@ApiModelProperty(value = "Creation time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@ApiModelProperty(value = "Match ID")
|
||||
private Long matchId;
|
||||
}
|
|
@ -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.EventOrganizer;
|
||||
import com.srr.dto.EventOrganizerDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface EventOrganizerMapper extends BaseMapper<EventOrganizerDto, EventOrganizer> {
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.RatingHistory;
|
||||
import com.srr.dto.RatingHistoryDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RatingHistoryMapper extends BaseMapper<RatingHistoryDto, RatingHistory> {
|
||||
|
||||
/**
|
||||
* Entity to DTO mapping with explicit field mappings
|
||||
* @param entity RatingHistory entity
|
||||
* @return RatingHistoryDto
|
||||
*/
|
||||
@Override
|
||||
@Mapping(source = "player.id", target = "playerId")
|
||||
@Mapping(source = "player.name", target = "playerName")
|
||||
@Mapping(source = "match.id", target = "matchId")
|
||||
RatingHistoryDto toDto(RatingHistory entity);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.EventOrganizer;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Repository
|
||||
public interface EventOrganizerRepository extends JpaRepository<EventOrganizer, Long>, JpaSpecificationExecutor<EventOrganizer> {
|
||||
|
||||
/**
|
||||
* Find event organizers by user id
|
||||
* @param userId the user id
|
||||
* @return list of event organizers
|
||||
*/
|
||||
List<EventOrganizer> findByUserId(Long userId);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.RatingHistory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author Chanheng
|
||||
* @date 2025-05-26
|
||||
**/
|
||||
@Repository
|
||||
public interface RatingHistoryRepository extends JpaRepository<RatingHistory, Long>, JpaSpecificationExecutor<RatingHistory> {
|
||||
|
||||
List<RatingHistory> findByPlayerIdOrderByCreateTimeDesc(Long playerId);
|
||||
}
|
Loading…
Reference in New Issue