Commit 76922f51 by 丁伟峰

改用nativeQuery

1 parent fcd0ba79
......@@ -6,18 +6,21 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.data.repository.query.Param;
import java.time.LocalDate;
@Repository
public interface OrderEventDao extends JpaRepository<OrderEventEntity, Integer> {
@Query("SELECT a FROM OrderEventEntity a JOIN OrderRequestEntity b ON a.orderId = b.orderId WHERE b.orgClusterId = :clusterId AND DATE(a.createTime) = :date")
Page<OrderEventEntity> findAllByClusterId(String clusterId, LocalDate date, Pageable pageable);
@Query(value = "SELECT a FROM order_event a JOIN order_request b ON a.order_id = b.order_id WHERE b.org_clustet_id = :clusterId AND date(a.create_time) = :date", nativeQuery = true)
Page<OrderEventEntity> findAllByClusterId(String clusterId, String date, Pageable pageable);
@Query("SELECT a FROM OrderEventEntity a JOIN OrderRequestEntity b ON a.orderId = b.orderId WHERE b.orgBranchId = :branchId AND DATE(a.createTime) = :date")
Page<OrderEventEntity> findAllByBranchId(String branchId, LocalDate date, Pageable pageable);
@Query(value = "SELECT a FROM order_event a JOIN order_request b ON a.order_id = b.order_id WHERE b.org_branch_id = :branchId AND date(a.create_time) = :date", nativeQuery = true)
Page<OrderEventEntity> findAllByBranchId(String branchId, String date, Pageable pageable);
@Query("SELECT a FROM OrderEventEntity a JOIN OrderRequestEntity b ON a.orderId = b.orderId WHERE b.orgGroupId = :groupId AND DATE(a.createTime) = :date")
Page<OrderEventEntity> findAllByGroupId(String groupId, LocalDate date, Pageable pageable);
@Query(value = "SELECT a FROM order_event a JOIN order_request b ON a.order_id = b.order_id WHERE b.org_group_id = :groupId AND date(a.create_time) = :date", nativeQuery = true)
Page<OrderEventEntity> findAllByGroupId(String groupId, String date, Pageable pageable);
}
......@@ -54,8 +54,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
Page<?> changes;
String levelType = reqDTO.getLevelType();
String levelValue = reqDTO.getLevelValue();
LocalDate date = LocalDate.parse(reqDTO.getDate(), DateTimeFormatter.ofPattern(PATTERN_DATE));
String date = reqDTO.getDate();
if ("cluster".equals(levelType)) {
changes = orderEventDao.findAllByClusterId(levelValue, date, pageable);
} else if ("branch".equals(levelType)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!