Commit 78e9f906462ade9f3567fe9d45cbda5525b4a122
1 parent
bd9c90a0
道路支持排序
Showing
2 changed files
with
16 additions
and
1 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.road.vo; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | |
| 4 | +import com.zteits.urbanops.module.garden.dal.dataobject.departmentcost.DepartmentCostDO; | |
| 5 | +import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; | |
| 3 | 6 | import lombok.*; |
| 4 | 7 | import java.util.*; |
| 5 | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -83,4 +86,12 @@ public class RoadPageReqVO extends PageParam { |
| 83 | 86 | @Schema(description = "更新者", example = "芋艿") |
| 84 | 87 | private String updaterName; |
| 85 | 88 | |
| 89 | + //对应前端排序字段 | |
| 90 | + public static final Map<String, SFunction<RoadDO, ?>> SORT_FIELD_MAP = Map.of( | |
| 91 | + "id", RoadDO::getId, | |
| 92 | + "greenBeltTreeArea", RoadDO::getGreenBeltTreeArea, | |
| 93 | + "greenBeltArea", RoadDO::getGreenBeltArea, | |
| 94 | + "totalArea", RoadDO::getTotalArea, | |
| 95 | + "treeArea", RoadDO::getTreeArea | |
| 96 | + ); | |
| 86 | 97 | } |
| 87 | 98 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/road/RoadInterceptMapper.java
| ... | ... | @@ -4,6 +4,7 @@ import com.zteits.urbanops.framework.annotation.ProcessBusinessLine; |
| 4 | 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 5 | 5 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 6 | import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | +import com.zteits.urbanops.module.garden.controller.admin.departmentcost.vo.DepartmentCostPageReqVO; | |
| 7 | 8 | import com.zteits.urbanops.module.garden.controller.admin.road.vo.RoadPageReqVO; |
| 8 | 9 | import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; |
| 9 | 10 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -42,7 +43,10 @@ public interface RoadInterceptMapper extends BaseMapperX<RoadDO> { |
| 42 | 43 | .likeIfPresent(RoadDO::getCreatorName, reqVO.getCreatorName()) |
| 43 | 44 | .betweenIfPresent(RoadDO::getCreateTime, reqVO.getCreateTime()) |
| 44 | 45 | .likeIfPresent(RoadDO::getUpdaterName, reqVO.getUpdaterName()) |
| 45 | - .orderByDesc(RoadDO::getId)); | |
| 46 | + .orderBy(true, reqVO.getSortAsc(), | |
| 47 | + RoadPageReqVO.SORT_FIELD_MAP.get(reqVO.getOrderByColumn()) | |
| 48 | + ) | |
| 49 | + ); | |
| 46 | 50 | } |
| 47 | 51 | |
| 48 | 52 | } |
| 49 | 53 | \ No newline at end of file | ... | ... |