|
@@ -1,10 +1,7 @@
|
|
|
package com.uas.cloud.mall.shop.news.data;
|
|
|
|
|
|
import com.uas.cloud.mall.shop.news.model.News;
|
|
|
-import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
-import org.springframework.data.jpa.repository.Query;
|
|
|
-import org.springframework.data.jpa.repository.QueryHints;
|
|
|
+import org.springframework.data.jpa.repository.*;
|
|
|
import org.springframework.data.repository.query.Param;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
@@ -29,4 +26,8 @@ public interface NewsRepository extends JpaSpecificationExecutor<News>, JpaRepos
|
|
|
"where 1=1 and t.slug= :name ",nativeQuery = true)
|
|
|
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value ="true")})
|
|
|
List<Long> findNewsIdByTaxonomySlug (@Param("name")String taskName);
|
|
|
+
|
|
|
+ @Modifying
|
|
|
+ @Query("update News set viewCount = viewCount + 1 where id = :id")
|
|
|
+ void addCount(@Param("id")Long Id);
|
|
|
}
|