Commit c1404eed authored by wujipeng's avatar wujipeng
Browse files

bug修复

parent 8fc878c3
...@@ -35,8 +35,11 @@ ...@@ -35,8 +35,11 @@
and e.type = #{type} and e.type = #{type}
</if> </if>
</where> </where>
ORDER BY <!--
STR_TO_DATE(SUBSTRING_INDEX(exam_time, '-', 1), '%Y.%m.%d %H:%i:%s') DESC 教师端考试管理默认按真实考试时间倒序展示,最近开考的场次排在最前面。
同一考试时间下再按主键倒序,避免分页查询时记录顺序不稳定。
-->
ORDER BY e.exam_time DESC, e.id DESC
</select> </select>
<!-- <!--
......
...@@ -44,6 +44,13 @@ class ExamMapperXmlTest { ...@@ -44,6 +44,13 @@ class ExamMapperXmlTest {
.getBoundSql(Collections.emptyMap()); .getBoundSql(Collections.emptyMap());
String pageSql = pageBoundSql.getSql().replaceAll("\\s+", " ").toLowerCase(); String pageSql = pageBoundSql.getSql().replaceAll("\\s+", " ").toLowerCase();
assertTrue(pageSql.contains("e.duration")); assertTrue(pageSql.contains("e.duration"));
/*
* 教师端考试管理应直接使用数据库时间字段倒序;不能截取日期字符串后再转换,
* 否则标准 yyyy-MM-dd 时间会只按年份排序,同一年内的考试顺序将不可控。
*/
assertTrue(pageSql.contains("order by e.exam_time desc, e.id desc"));
assertFalse(pageSql.contains("str_to_date"));
assertFalse(pageSql.contains("substring_index"));
org.apache.ibatis.mapping.BoundSql summaryBoundSql = configuration.getMappedStatement( org.apache.ibatis.mapping.BoundSql summaryBoundSql = configuration.getMappedStatement(
"com.platform.business.mapper.ExamMapper.summary") "com.platform.business.mapper.ExamMapper.summary")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment