From de9369d2c8056e2bb723247b0e877fe9d96f8def Mon Sep 17 00:00:00 2001
From: xusd <hugeinfo123>
Date: Sun, 15 Sep 2024 15:20:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java | 56 +++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 39 insertions(+), 17 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 4b3e29c..72b2120 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
@@ -1,9 +1,13 @@
-package cn.huge.module.ctuser.controller;
+package cn.huge.module.ctuser.controller.web;
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,16 +18,15 @@
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;
/**
- * @title: 客户岗位表接口api
- * @description: 客户岗位表接口api
+ * @title: 客户岗位表接口api-web端
+ * @description: 客户岗位表接口api-web端
* @company: hugeinfo
* @author: liyj
- * @time: 2024-08-17 15:30:57
+ * @time: 2024-08-19 20:04:19
* @version: 1.0.0
*/
@Slf4j
@@ -36,6 +39,9 @@
@Autowired
private CtPostService service;
+
+ @Autowired
+ private CtUserService ctUserService;
/**
* 获取请求URL参数
@@ -63,7 +69,7 @@
if (StringUtils.isNotBlank(unitId)){
terms.put("unitId", unitId);
}
- // 删除状态,0:已删除,1:未删除
+ // 删除状态,0:未删除,1:已删除
String deleteStatus = request.getParameter("deleteStatus");
if (StringUtils.isNotBlank(deleteStatus)){
terms.put("deleteStatus", deleteStatus);
@@ -141,19 +147,15 @@
}
/**
- * 根据主键单个/批量删除
- * @url {ctx}/api/web/ctPost/deleteByIds
- * @param ids 主键编号
+ * 根据主键单个
+ * @url {ctx}/api/web/ctPost/deleteById
+ * @param id 主键编号
* @return Object
*/
- @GetMapping("/deleteByIds")
- public Object deleteByIds(@RequestParam(value = "ids") String ids) {
+ @GetMapping("/deleteById")
+ public Object deleteById(@RequestParam(value = "id") String id) {
try {
- if (ids.indexOf(",") != -1) {
- service.removeByIds(Stream.of(ids.split(",")).collect(Collectors.toList()));
- }else{
- service.removeById(ids);
- }
+ service.removeById(id);
return ReturnSucUtils.getRepInfo();
} catch (Exception e) {
return ReturnFailUtils.getRepInfo();
@@ -176,4 +178,24 @@
}
}
+ /**
+ * 根据单位编号查询所有岗位
+ * @url {ctx}/api/web/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