重构第一版,没有明显bug
This commit is contained in:
@@ -8,8 +8,11 @@ package cn.van.business.repository;
|
||||
*/
|
||||
|
||||
import cn.van.business.model.jd.OrderRow;
|
||||
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.format.annotation.DateTimeFormat;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -31,11 +34,16 @@ public interface OrderRowRepository extends JpaRepository<OrderRow, String> {
|
||||
|
||||
// 查找 validCode != 15 或者 !=-1 的订单行 ,并且按orderTime 降序
|
||||
@Query("select o from OrderRow o where o.validCode not in ?1 and o.unionId =?2 order by o.orderTime DESC")
|
||||
List<OrderRow> findByValidCodeNotInOrderByOrderTimeDescAndUnionId(int[] validCodes,Long unionId);
|
||||
List<OrderRow> findByValidCodeNotInOrderByOrderTimeDescAndUnionId(int[] validCodes, Long unionId);
|
||||
|
||||
@Query("select o from OrderRow o where o.validCode not in ?1 and o.orderTime >= ?2 order by o.orderTime DESC")
|
||||
List<OrderRow> findByValidCodeNotInAndOrderTimeGreaterThanOrderByOrderTimeDesc(
|
||||
int[] validCodes,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date threeMonthsAgo
|
||||
);
|
||||
List<OrderRow> findByValidCodeNotInAndOrderTimeGreaterThanOrderByOrderTimeDesc(int[] validCodes, @DateTimeFormat(pattern = "yyyy-MM-dd") Date threeMonthsAgo);
|
||||
|
||||
@Query("select o from OrderRow o where o.validCode not in ?1 and o.skuId = ?2 and o.unionId = ?3 order by o.orderTime DESC")
|
||||
List<OrderRow> findBySkuIdAndUnionId(int[] validCodes,long skuId, long unionId);
|
||||
|
||||
//// 在OrderRowRepository中添加模糊查询方法
|
||||
//// 模糊查询收件人姓名或地址(包含分页)
|
||||
//@Query("SELECT o FROM OrderRow o WHERE " + "o.recipientName LIKE %:keyword% OR " + "o.address LIKE %:keyword% " + "ORDER BY o.orderTime DESC")
|
||||
//Page<OrderRow> searchByRecipientOrAddress(@Param("keyword") String keyword, Pageable pageable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user