From f974bf528f0fd1f7316bdb3f06be8004e8db9f15 Mon Sep 17 00:00:00 2001 From: wangwh <2397901735@qq.com> Date: Wed, 21 Aug 2024 17:24:07 +0800 Subject: [PATCH] 用户中心部分迁移1 --- dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java index b283aa8..fc1f1c1 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java @@ -2,8 +2,12 @@ import cn.huge.base.common.utils.ReturnFailUtils; import cn.huge.base.common.utils.ReturnSucUtils; +import cn.huge.base.config.CurrentUser; import cn.huge.module.ctuser.domain.po.CtPost; +import cn.huge.module.ctuser.domain.po.CtUser; import cn.huge.module.ctuser.service.CtPostService; +import cn.huge.module.ctuser.service.CtUserService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -14,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -36,6 +41,9 @@ @Autowired private CtPostService service; + + @Autowired + private CtUserService ctUserService; /** * 获取请求URL参数 @@ -143,7 +151,7 @@ /** * 根据主键单个 * @url {ctx}/api/web/ctPost/deleteById - * @param ids 主键编号 + * @param id 主键编号 * @return Object */ @GetMapping("/deleteById") @@ -172,4 +180,24 @@ } } + /** + * 根据单位编号查询所有岗位 + * @url {ctx}/api/v1/ctPost/getByUnitId + * @param userId 登录用户编号 + * @return Object + * @throws Exception + */ + @GetMapping("/getByUnitId") + public Object getByUnitId(@CurrentUser String userId) { + try { + // 获取当前登录用户 + CtUser ctUser = ctUserService.getById(userId); + QueryWrapper<CtPost> ctPostQueryWrapper = new QueryWrapper<>(); + ctPostQueryWrapper.eq("unit_id", ctUser.getUnitId()); + List<CtPost> ctPostList = service.list(ctPostQueryWrapper); + return ReturnSucUtils.getRepInfo(ctPostList); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(); + } + } } -- Gitblit v1.8.0