From 6588756cf95e8295a93a2826137322b2e7fc6e80 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期三, 19 十月 2022 14:27:47 +0800
Subject: [PATCH] 修改【角色管理】无法搜索 bug
---
flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
index f5950d9..d8b2ecc 100644
--- a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
+++ b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
@@ -6,11 +6,12 @@
import com.dg.core.annotation.CurrentUser;
import com.dg.core.db.gen.entity.ReplyTemplateEntity;
import com.dg.core.db.gen.entity.SysUser;
+import com.dg.core.service.IOrganizationChartService;
import com.dg.core.service.IReplyTemplateService;
-import com.dg.core.util.StringUtils;
import com.dg.core.util.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -25,19 +26,26 @@
@Autowired
IReplyTemplateService iReplyTemplateService;
+ @Autowired
+ IOrganizationChartService iOrganizationChartService;
+
+
/**
* 获取模板列表
* @return
*/
@ApiOperation("获取模板列表")
@GetMapping("/getlist")
+ @Authorization
public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum,
@RequestParam(value = "pageSize",required = false) Integer pageSize,
- @RequestParam(value = "Name",required = false) String Name)
+ @RequestParam(value = "name",required = false) String Name,
+ @CurrentUser SysUser sysUser)
{
Page<ReplyTemplateEntity> pageParam = new Page<>(pageNum,pageSize);
- List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name);
- int num=iReplyTemplateService.countNum(Name);
+ List<String> ids=iOrganizationChartService.getIds(sysUser.getDepartmentId());
+ List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids);
+ int num=iReplyTemplateService.countNum(Name,ids);
return getDataTable(list,num);
}
@@ -48,6 +56,7 @@
*/
@ApiOperation("获取详情")
@GetMapping("/getdata")
+ @Authorization
public ResultData selectConfigData(@RequestParam(value = "Id",required = false) String Id)
{
if(StringUtils.isEmpty(Id))
@@ -77,6 +86,19 @@
return ResultData.error("模板名称不能为空");
}
+ if(StringUtils.isEmpty(sysUser.getDepartmentId()))
+ {
+ return ResultData.error("部门id不能为空 请分配部门id");
+ }
+
+ List<String> ids=iOrganizationChartService.getIds(sysUser.getDepartmentId());
+ int num=iReplyTemplateService.countNum(entity.getName(),ids);
+
+ if(num>0)
+ {
+ return ResultData.error("部门里办事名称重复!");
+ }
+
entity.setId(null);
entity.setDepartmentId(sysUser.getDepartmentId());
entity.setCreateUserId(sysUser.getUserId()+"");
@@ -91,6 +113,7 @@
*/
@ApiOperation("更新模板")
@PostMapping("/update")
+ @Authorization
public ResultData updateConfig(@RequestBody ReplyTemplateEntity entity)
{
if(entity==null)
@@ -112,6 +135,7 @@
*/
@ApiOperation("删除模板")
@DeleteMapping("/delete")
+ @Authorization
public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id)
{
return toAjax(iReplyTemplateService.deleteConfigById(Id));
@@ -125,6 +149,7 @@
*/
@ApiOperation("复制模板")
@PostMapping("/copy")
+ @Authorization
public ResultData copy(@RequestParam(value = "Id",required = false) String Id)
{
if(StringUtils.isEmpty(Id))
@@ -138,6 +163,7 @@
{
return ResultData.error("模板不存在!");
}
+ entity.setName(entity.getName()+"(副本)");
entity.setId(null);
return toAjax(iReplyTemplateService.insertConfig(entity));
}
--
Gitblit v1.7.1