11 changed files with 247 additions and 26 deletions
@ -0,0 +1,22 @@ |
|||
package app.entities.report; |
|||
|
|||
import jakarta.persistence.Column; |
|||
import jakarta.persistence.Entity; |
|||
import jakarta.persistence.Id; |
|||
import jakarta.persistence.Table; |
|||
import lombok.Data; |
|||
|
|||
@Entity |
|||
@Table(schema = "tf2_facti13", name = "user_reports_action") |
|||
@Data |
|||
public class ReportAction { |
|||
@Id |
|||
@Column(name = "id") |
|||
private Long id; |
|||
|
|||
@Column(name = "report_id") |
|||
private Long reportId; |
|||
|
|||
@Column(name = "action") |
|||
private String action; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package app.entities.report; |
|||
|
|||
import app.entities.SearchFilter; |
|||
import app.services.ProfileService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
public class ReportSearchFilter extends SearchFilter { |
|||
private List<String> accounts_2 = null; |
|||
|
|||
public ReportSearchFilter() { |
|||
} |
|||
|
|||
/** |
|||
* Выдает список из ид 2 версии STEAM_0:0:63666481 |
|||
* @param profileService |
|||
* @return |
|||
*/ |
|||
public String getAccounts2Steam2(ProfileService profileService) { |
|||
if (accounts_2 == null || accounts_2.isEmpty()) return ""; |
|||
|
|||
return String.join(",", accounts_2.stream() |
|||
.map(profileService::GetSteamIDFromAnyData) |
|||
.filter(Objects::nonNull) |
|||
.map(sId -> sId.steam2) |
|||
.toList()); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
package app.repositories; |
|||
|
|||
import app.entities.report.Report; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.data.repository.PagingAndSortingRepository; |
|||
import org.springframework.data.repository.query.Param; |
|||
|
|||
public interface ReportRepository extends PagingAndSortingRepository<Report, Long> { |
|||
@Query(value = "select r from Report r where " + |
|||
"(:authors_ne = true or position(r.a_steam2 in :authors) > 0) and " + |
|||
"(:reportes_ne = true or position(r.r_steam2 in :reportes) > 0) and " + |
|||
"(:begin_date is null or r.utime >= :begin_date) and " + |
|||
"(:end_date is null or :end_date >= r.utime) and " + |
|||
"(:server_id is null or r.srv like :server_id) order by r.id desc" |
|||
) |
|||
Page<Report> getReports(Pageable pageable, |
|||
@Param("authors_ne") boolean authors_ne,//a
|
|||
@Param("authors") String authors, |
|||
@Param("reportes_ne") boolean reportes_ne,//r
|
|||
@Param("reportes") String reportes, |
|||
//
|
|||
@Param("server_id") String server_id, |
|||
@Param(value = "begin_date") Long begin_date, |
|||
@Param(value = "end_date") Long end_date); |
|||
} |
Loading…
Reference in new issue