dev add lawcase logic
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-04-06 14:51:00 +07:00
parent 5f063354e6
commit 077902f4ab
14 changed files with 559 additions and 1 deletions
@@ -0,0 +1,40 @@
package ru.soune.nocopy.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import ru.soune.nocopy.entity.complaint.LawCase;
import ru.soune.nocopy.entity.complaint.LawCasePriority;
import ru.soune.nocopy.entity.complaint.LawCaseType;
import java.util.List;
@Repository
public interface LawCaseRepository extends JpaRepository<LawCase, Long> {
@Query("SELECT l FROM LawCase l WHERE l.user.Id = :userId")
List<LawCase> getUserLawCases(@Param("userId") Long userId, Pageable pageable);
// @Query("SELECT l FROM LawCase l WHERE l.user.Id = :userId " +
// "AND (:type IS NULL OR l.type = :type) " +
// "AND (:lawyer IS NULL OR l.lawyer = :lawyer) " +
// "AND (:priority IS NULL OR l.priority = :priority)")
// List<LawCase> getUserLawCases(@Param("userId") Long userId,
// @Param("type") LawCaseType type,
// @Param("lawyer") String lawyer,
// @Param("priority") LawCasePriority priority,
// Pageable pageable);
@Query("SELECT l FROM LawCase l WHERE l.user.Id = :userId " +
"AND (:type IS NULL OR l.type = :type) " +
"AND (:lawyer IS NULL OR l.lawyer = :lawyer) " +
"AND (:priority IS NULL OR l.priority = :priority)")
Page<LawCase> getUserLawCases(@Param("userId") Long userId,
@Param("type") LawCaseType type,
@Param("lawyer") String lawyer,
@Param("priority") LawCasePriority priority,
Pageable pageable);
}