修改羊只档案显示排序,导入测试数据
This commit is contained in:
@@ -59,13 +59,29 @@ public class SheepFileController extends BaseController
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// 使用默认值
|
// 使用默认值
|
||||||
}
|
}
|
||||||
|
} else if (queryParams.containsKey("page") && queryParams.get("page") != null) {
|
||||||
|
// 如果 pageNum 不存在,则尝试使用 page
|
||||||
|
try {
|
||||||
|
pageNum = Integer.parseInt(queryParams.get("page").toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 使用默认值
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (queryParams.containsKey("pageSize") && queryParams.get("pageSize") != null) {
|
if (queryParams.containsKey("pageSize") && queryParams.get("pageSize") != null) {
|
||||||
try {
|
try {
|
||||||
pageSize = Integer.parseInt(queryParams.get("pageSize").toString());
|
pageSize = Integer.parseInt(queryParams.get("pageSize").toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// 使用默认值
|
// 使用默认值
|
||||||
}
|
}
|
||||||
|
}else if (queryParams.containsKey("limit") && queryParams.get("limit") != null) {
|
||||||
|
// 如果 pageSize 不存在,则尝试使用 limit
|
||||||
|
try {
|
||||||
|
pageSize = Integer.parseInt(queryParams.get("limit").toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 使用默认值
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取常规查询参数到 SheepFile 对象
|
// 提取常规查询参数到 SheepFile 对象
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class SheepFileSqlProvider {
|
|||||||
// 添加动态条件
|
// 添加动态条件
|
||||||
addDynamicConditions(sql, conditions);
|
addDynamicConditions(sql, conditions);
|
||||||
|
|
||||||
sql.ORDER_BY("id DESC");
|
sql.ORDER_BY("id ASC");
|
||||||
|
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="statusId != null "> and status_id = #{statusId}</if>
|
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||||
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY id ASC <!-- 修改为升序 -->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSheepFileById" parameterType="Long" resultMap="SheepFileResult">
|
<select id="selectSheepFileById" parameterType="Long" resultMap="SheepFileResult">
|
||||||
@@ -260,7 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY id DESC
|
ORDER BY id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <!– 查询所有公羊(gender=2) –>-->
|
<!-- <!– 查询所有公羊(gender=2) –>-->
|
||||||
|
|||||||
Reference in New Issue
Block a user