Jelajahi Sumber

超短池历史趋势记录显示逻辑修改

Zhangbw 1 bulan lalu
induk
melakukan
03ad2fcfc1
1 mengubah file dengan 13 tambahan dan 12 penghapusan
  1. 13 12
      src/main/java/com/yingpai/gupiao/mapper/StockPoolMapper.java

+ 13 - 12
src/main/java/com/yingpai/gupiao/mapper/StockPoolMapper.java

@@ -3,6 +3,7 @@ package com.yingpai.gupiao.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yingpai.gupiao.domain.po.StockPool;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.time.LocalDate;
@@ -60,21 +61,21 @@ public interface StockPoolMapper extends BaseMapper<StockPool> {
             "</if>" +
             "WHERE sp.add_date BETWEEN #{startDate} AND #{endDate} " +
             "  AND sp.pool_type = #{poolType} " +
-            "  AND ((#{poolType} = 1 AND (sp.status = 1 OR (sp.status = 2 AND sp.add_date &lt; CURDATE()))) " +
+            "  AND ((#{poolType} = 1 AND (sp.status = 1 OR (sp.status = 2 AND (sp.add_date &lt; CURDATE() OR (sp.add_date = CURDATE() AND CURTIME() >= '15:00:00'))))) " +
             "       OR (#{poolType} = 2 AND sp.status IN (1, 2))) " +
             "ORDER BY sp.add_date DESC, sp.id DESC " +
             "LIMIT #{limit} OFFSET #{offset}" +
             "</script>")
     List<com.yingpai.gupiao.domain.vo.StockHistoryVO> selectPoolHistory(
-        @org.apache.ibatis.annotations.Param("startDate") LocalDate startDate,
-        @org.apache.ibatis.annotations.Param("endDate") LocalDate endDate,
-        @org.apache.ibatis.annotations.Param("poolType") Integer poolType,
-        @org.apache.ibatis.annotations.Param("offset") int offset,
-        @org.apache.ibatis.annotations.Param("limit") int limit);
+        @Param("startDate") LocalDate startDate,
+        @Param("endDate") LocalDate endDate,
+        @Param("poolType") Integer poolType,
+        @Param("offset") int offset,
+        @Param("limit") int limit);
 
     /**
      * 统计历史数据总数
-     * 超短池:status=1 或 (status=2 且 add_date < 今天)
+     * 超短池:status=1 或 (status=2 且 (add_date < 今天 或 (add_date = 今天 且 时间 >= 15:00)))
      * 强势池:status IN (1, 2)
      * @param startDate 开始日期
      * @param endDate 结束日期
@@ -84,7 +85,7 @@ public interface StockPoolMapper extends BaseMapper<StockPool> {
     @Select("SELECT COUNT(*) FROM stock_pool " +
             "WHERE add_date BETWEEN #{startDate} AND #{endDate} " +
             "AND pool_type = #{poolType} " +
-            "AND ((#{poolType} = 1 AND (status = 1 OR (status = 2 AND add_date < CURDATE()))) OR (#{poolType} = 2 AND status IN (1, 2)))")
+            "AND ((#{poolType} = 1 AND (status = 1 OR (status = 2 AND (add_date < CURDATE() OR (add_date = CURDATE() AND CURTIME() >= '15:00:00'))))) OR (#{poolType} = 2 AND status IN (1, 2)))")
     int countPoolHistory(LocalDate startDate, LocalDate endDate, Integer poolType);
 
     /**
@@ -109,10 +110,10 @@ public interface StockPoolMapper extends BaseMapper<StockPool> {
             "<if test='startDate != null and endDate != null'>" +
             "AND add_date BETWEEN #{startDate} AND #{endDate} " +
             "</if>" +
-            "AND ((#{poolType} = 1 AND (status = 1 OR (status = 2 AND add_date &lt; CURDATE()))) OR (#{poolType} = 2 AND status IN (1, 2)))" +
+            "AND ((#{poolType} = 1 AND (status = 1 OR (status = 2 AND (add_date &lt; CURDATE() OR (add_date = CURDATE() AND CURTIME() >= '15:00:00'))))) OR (#{poolType} = 2 AND status IN (1, 2)))" +
             "</script>")
     Map<String, Object> selectPoolHistoryStats(
-        @org.apache.ibatis.annotations.Param("startDate") LocalDate startDate,
-        @org.apache.ibatis.annotations.Param("endDate") LocalDate endDate,
-        @org.apache.ibatis.annotations.Param("poolType") Integer poolType);
+        @Param("startDate") LocalDate startDate,
+        @Param("endDate") LocalDate endDate,
+        @Param("poolType") Integer poolType);
 }