Browse Source

http请求修改

gao.qiang 2 weeks ago
parent
commit
58f3ba98e4
1 changed files with 18 additions and 1 deletions
  1. 18 1
      base-system/src/main/resources/mapper/system/SysOperLogMapper.xml

+ 18 - 1
base-system/src/main/resources/mapper/system/SysOperLogMapper.xml

@@ -64,7 +64,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				and date_format(oper_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
 			</if>
 		</where>
-		order by oper_time desc  limit 60000;
+		<choose>
+			<when test="title == null and title == '' and businessType == null
+            and (userId == null or userId == '')
+            and (startTime == null or startTime == '')
+            and (endTime == null or endTime == '')">
+				<!-- 先通过索引快速定位最近60000条的起始点 -->
+				WHERE id >= (
+				SELECT id FROM your_table
+				ORDER BY oper_time DESC
+				LIMIT 60000, 1
+				)
+				ORDER BY oper_time DESC 60000
+			</when>
+			<!-- 有查询条件时使用正常排序和分页 -->
+			<otherwise>
+				ORDER BY oper_time DESC  60000
+			</otherwise>
+		</choose>
 	</select>
 
 	<delete id="deleteOperLogByIds" parameterType="Long">