Commit e0467a47 authored by zhangfeng's avatar zhangfeng

feature-ecw-node:新增前端下拉框获取网点信息接口

parent a55d456d
......@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
......@@ -17,11 +19,13 @@ import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.ecw.controller.admin.node.vo.*;
......@@ -83,6 +87,13 @@ public class NodeController {
return success(NodeConvert.INSTANCE.convertList(list));
}
@GetMapping("/list-all-simple")
@ApiOperation(value = "获得服务网点精简信息列表", notes = "主要用于前端的下拉选项")
public CommonResult<List<NodeSimpleRespVO>> getNodeListAllSimple() {
List<NodeDO> list = nodeService.getNodeList();
return success(NodeConvert.INSTANCE.convertListSimple(list));
}
@GetMapping("/page")
@ApiOperation("获得服务网点分页")
// @PreAuthorize("@ss.hasPermission('ecw:node:query')")
......@@ -113,13 +124,13 @@ public class NodeController {
.filter(t -> t.getAdminId() != null)
.map(NodeDO::getAdminId)
.collect(Collectors.toList());
if(CollectionUtil.isEmpty(userIdList)) return;
if (CollectionUtil.isEmpty(userIdList)) return;
List<AdminUserRespDTO> userList = adminUserApi.getUsers(userIdList);
Map<Long, String> userNameMap = userList.stream()
.collect(Collectors.toMap(AdminUserRespDTO::getId, AdminUserRespDTO::getNickname, (v1,v2)->v2));
.collect(Collectors.toMap(AdminUserRespDTO::getId, AdminUserRespDTO::getNickname, (v1, v2) -> v2));
nodeList.forEach(t -> {
Long adminId = t.getAdminId();
if(adminId != null && userNameMap.containsKey(adminId)) {
if (adminId != null && userNameMap.containsKey(adminId)) {
t.setAdminName(userNameMap.get(adminId));
}
});
......
package cn.iocoder.yudao.module.ecw.controller.admin.node.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@ApiModel("网点精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NodeSimpleRespVO {
@ApiModelProperty(value = "", required = true)
private Long id;
@ApiModelProperty(value = "中文标题")
private String titleZh;
@ApiModelProperty(value = "英文标题")
private String titleEn;
}
......@@ -27,6 +27,8 @@ public interface NodeConvert {
List<NodeRespVO> convertList(List<NodeDO> list);
List<NodeSimpleRespVO> convertListSimple(List<NodeDO> list);
PageResult<NodeRespVO> convertPage(PageResult<NodeDO> page);
List<NodeExcelVO> convertList02(List<NodeDO> list);
......
......@@ -51,6 +51,13 @@ public interface NodeService {
*/
List<NodeDO> getNodeList(Collection<Long> ids);
/**
* 获得服务网点列表
*
* @return 所有服务网点列表
*/
List<NodeDO> getNodeList();
/**
* 获得服务网点分页
*
......
......@@ -71,6 +71,11 @@ public class NodeServiceImpl implements NodeService {
return nodeMapper.selectBatchIds(ids);
}
@Override
public List<NodeDO> getNodeList() {
return nodeMapper.selectList();
}
@Override
public PageResult<NodeDO> getNodePage(NodePageReqVO pageReqVO) {
return nodeMapper.selectPage(pageReqVO);
......
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