Commit cb29f568c730b471b819771ce6b4e9f0369e98ac
1 parent
38258113
feat(dept): 添加组织查询接口
- 新增 queryAllDeptList 接口用于查询所有组织 - 创建 SysDeptRespVO 数据传输对象 - 使用流式处理转换部门数据 - 添加部门编码、名称、父部门编码等字段映射 feat(road): 添加道路查询接口 - 新增 queryAllRoadList 接口用于物联网查询道路 - 创建 SysRoadRespVO 数据传输对象 - 实现道路名称和部门编码的查询过滤 - 添加道路编码和名称的字段映射 refactor(dept): 优化部门控制器导入 - 使用通配符导入部门相关 VO 类 - 添加 Collectors 工具类导入 - 简化代码结构提高可读性
Showing
4 changed files
with
96 additions
and
6 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/RoadController.java
| @@ -14,6 +14,7 @@ import jakarta.validation.*; | @@ -14,6 +14,7 @@ import jakarta.validation.*; | ||
| 14 | import jakarta.servlet.http.*; | 14 | import jakarta.servlet.http.*; |
| 15 | import java.util.*; | 15 | import java.util.*; |
| 16 | import java.io.IOException; | 16 | import java.io.IOException; |
| 17 | +import java.util.stream.Collectors; | ||
| 17 | 18 | ||
| 18 | import com.zteits.urbanops.framework.common.pojo.PageParam; | 19 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 19 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 20 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| @@ -121,4 +122,21 @@ public class RoadController { | @@ -121,4 +122,21 @@ public class RoadController { | ||
| 121 | BeanUtils.toBean(list, RoadRespVO.class)); | 122 | BeanUtils.toBean(list, RoadRespVO.class)); |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | -} | ||
| 125 | \ No newline at end of file | 125 | \ No newline at end of file |
| 126 | + @Operation(summary = "物联网查询道路") | ||
| 127 | + @GetMapping("/queryAllRoadList") | ||
| 128 | + public CommonResult<List<SysRoadRespVO>> queryAllRoadList(@RequestParam(required = false)String roadName,@RequestParam(required = false)String deptCode,@RequestParam(required = false)String companyCode) { | ||
| 129 | + RoadListReqVO reqVO = new RoadListReqVO(); | ||
| 130 | + reqVO.setRoadName(roadName); | ||
| 131 | + reqVO.setCompanyId(Long.valueOf(deptCode)); | ||
| 132 | + reqVO.setBusiLine(companyCode); | ||
| 133 | + List<RoadDO> roadList = roadService.getRoadList(reqVO); | ||
| 134 | + List<SysRoadRespVO> deptResps = roadList.stream().map(manager -> { | ||
| 135 | + SysRoadRespVO sysDeptResp = new SysRoadRespVO(); | ||
| 136 | + sysDeptResp.setRoadCode(manager.getId()+""); | ||
| 137 | + sysDeptResp.setRoadName(manager.getRoadName()); | ||
| 138 | + return sysDeptResp; | ||
| 139 | + }).collect(Collectors.toList()); | ||
| 140 | + return success(deptResps); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/SysRoadRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.road.vo; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + * @author smartiot | ||
| 10 | + * @date 2025-07-22 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class SysRoadRespVO implements Serializable { | ||
| 14 | + private static final long serialVersionUID = 1L; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 编码 | ||
| 18 | + */ | ||
| 19 | + private String roadCode; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 名称 | ||
| 23 | + */ | ||
| 24 | + private String roadName; | ||
| 25 | +} |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/dept/DeptController.java
| @@ -4,11 +4,7 @@ package com.zteits.urbanops.module.system.controller.admin.dept; | @@ -4,11 +4,7 @@ package com.zteits.urbanops.module.system.controller.admin.dept; | ||
| 4 | import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; | 4 | import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; |
| 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 6 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 6 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 7 | -import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | ||
| 8 | -import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptListReqVO; | ||
| 9 | -import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptRespVO; | ||
| 10 | -import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO; | ||
| 11 | -import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO; | 7 | +import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.*; |
| 12 | import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; | 8 | import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; |
| 13 | import com.zteits.urbanops.module.system.service.dept.DeptService; | 9 | import com.zteits.urbanops.module.system.service.dept.DeptService; |
| 14 | import com.zteits.urbanops.module.system.util.tree.Dept; | 10 | import com.zteits.urbanops.module.system.util.tree.Dept; |
| @@ -22,6 +18,7 @@ import org.springframework.web.bind.annotation.*; | @@ -22,6 +18,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 22 | import jakarta.annotation.Resource; | 18 | import jakarta.annotation.Resource; |
| 23 | import jakarta.validation.Valid; | 19 | import jakarta.validation.Valid; |
| 24 | import java.util.List; | 20 | import java.util.List; |
| 21 | +import java.util.stream.Collectors; | ||
| 25 | 22 | ||
| 26 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | 23 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 27 | 24 | ||
| @@ -125,4 +122,20 @@ public class DeptController { | @@ -125,4 +122,20 @@ public class DeptController { | ||
| 125 | return success(list); | 122 | return success(list); |
| 126 | } | 123 | } |
| 127 | 124 | ||
| 125 | + @Operation(summary = "查询所有组织") | ||
| 126 | + @GetMapping("/queryAllDeptList") | ||
| 127 | + public CommonResult<List<SysDeptRespVO>> queryAllDeptList(@RequestParam(required = false)String companyCode) { | ||
| 128 | + List<DeptDO> sysDepts = deptService.getSubDeptAllList(); | ||
| 129 | + List<SysDeptRespVO> deptResps = sysDepts.stream().map(sysDept -> { | ||
| 130 | + SysDeptRespVO sysDeptResp = new SysDeptRespVO(); | ||
| 131 | + sysDeptResp.setDeptCode(sysDept.getId()+""); | ||
| 132 | + sysDeptResp.setDeptName(sysDept.getName()); | ||
| 133 | + sysDeptResp.setParentDeptCode(sysDept.getParentId()+""); | ||
| 134 | + sysDeptResp.setOrderNum(sysDept.getSort()); | ||
| 135 | + sysDeptResp.setStatus(sysDept.getStatus().toString()); | ||
| 136 | + return sysDeptResp; | ||
| 137 | + }).collect(Collectors.toList()); | ||
| 138 | + return success(deptResps); | ||
| 139 | + } | ||
| 140 | + | ||
| 128 | } | 141 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/dept/vo/dept/SysDeptRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.system.controller.admin.dept.vo.dept; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @since 2025-07-26 | ||
| 7 | + */ | ||
| 8 | +@Data | ||
| 9 | +public class SysDeptRespVO { | ||
| 10 | + /** | ||
| 11 | + * 部门编码 | ||
| 12 | + */ | ||
| 13 | + private String deptCode; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 部门名称 | ||
| 17 | + */ | ||
| 18 | + private String deptName; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 父部门编码 | ||
| 22 | + */ | ||
| 23 | + private String parentDeptCode; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 显示顺序 | ||
| 27 | + */ | ||
| 28 | + private Integer orderNum; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 部门状态(0正常 1停用) | ||
| 32 | + */ | ||
| 33 | + private String status; | ||
| 34 | +} |