Merge branch 'USVT-117' into 'master'

USVT-117 USVisaTrack 网站关注成功但是后台没有显示关注的结果

See merge request usvisatrack/usvisatrack.api.service!2
This commit is contained in:
YuCheng Hu 2022-12-01 18:16:37 +00:00
commit b9c87529be
2 changed files with 16 additions and 6 deletions

View File

@ -12,9 +12,9 @@ import java.util.List;
import java.util.Optional;
/**
* Created with IntelliJ IDEA.
* VisaCase data Repository form database
*
* @Author: XieYang
* @author XieYang, YuCheng
* @Date: 2022/10/08/23:20
* @Description:
*/
@ -77,8 +77,12 @@ public interface VisaCaseRepository extends PagingAndSortingRepository<VisaCase,
@Param("endDate") LocalDate endDate);
@Query("select visaCase from VisaCase visaCase where visaCase.saveUserId in (select m.userId from " +
"MyFavouredVisaCase m where m.userId = :userId)")
// @Query("select visaCase from VisaCase visaCase where visaCase.saveUserId in (select m.userId from " +
// "MyFavouredVisaCase m where m.userId = :userId)")
@Query(value = " SELECT visa_case.* " +
" FROM visa_case " +
" JOIN my_favoured_visa_case ON visa_case.id = my_favoured_visa_case.visa_case_id " +
" WHERE my_favoured_visa_case.user_id = :userId", nativeQuery = true)
List<VisaCase> queryFavouredVisaCaseByUserId(@Param("userId") Long userId);

View File

@ -11,9 +11,9 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* Created with IntelliJ IDEA.
* VisaCase Service
*
* @Author: XieYang
* @author XieYang, YuCheng
* @Date: 2022/10/23/17:40
* @Description:
*/
@ -64,6 +64,12 @@ public class MyFavouredVisaCaseService {
return myFavouredVisaCaseRepository.findAllByUserId(userId).stream().collect(Collectors.toList());
}
/**
* Get follow cases by userId
*
* @param userId
* @return
*/
public List<VisaCase> queryFavouredVisaCases(Long userId) {
log.info("Query user: {} favoured visa cases", userId);