From f1295e244ec841de1b1f623b3fb2d6853299d5c3 Mon Sep 17 00:00:00 2001 From: mors <3067699729@qq.com> Date: Sat, 15 Apr 2023 16:17:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/modulex/ModulexList.vue | 11 +++---- .../src/views/projectx/ProjectxList.vue | 2 +- .../modulex/controller/ModulexController.java | 29 +++++++++++++++++-- .../jeecg/modules/modulex/entity/Modulex.java | 8 +++++ .../modules/modulex/mapper/ModulexMapper.java | 3 ++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue index 561330d..710dd09 100644 --- a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue +++ b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue @@ -176,11 +176,12 @@ export default { // align: "center", // dataIndex: 'pmDescribe' // }, - // { - // title:'责任人', - // align:"center", - // dataIndex: 'managerUsers' - // }, + { + title:'责任人', + align:"center", + // dataIndex: 'managerUsers' + dataIndex: 'managerUsers_dictText' + }, { title: '任务等级', align: "center", diff --git a/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue b/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue index 1cec1ae..aeac38d 100644 --- a/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue +++ b/ant-design-vue-jeecg/src/views/projectx/ProjectxList.vue @@ -7,7 +7,7 @@ - + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java index d98c113..b9d15a2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java @@ -13,17 +13,17 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.modulex.entity.Modulex; +import org.jeecg.modules.modulex.mapper.ModulexMapper; import org.jeecg.modules.modulex.service.IModulexService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -39,6 +39,8 @@ import java.util.stream.Collectors; public class ModulexController extends JeecgController { @Autowired private IModulexService modulexService; + @Resource + private ModulexMapper modulexMapper; /** * 分页列表查询 @@ -59,6 +61,27 @@ public class ModulexController extends JeecgController QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(modulex, req.getParameterMap()); Page page = new Page(pageNo, pageSize); IPage pageList = modulexService.page(page, queryWrapper); + List modulexList = pageList.getRecords(); + for (Modulex modu :modulexList) { + if (!StringUtils.hasText(modu.getManagerUsers())){ + break; + }else { + String[] split = modu.getManagerUsers().split(","); + List stringList = Arrays.asList(split); + List strings = new ArrayList<>(); + stringList.forEach(manager -> { + String realName = modulexMapper.getRealName(manager); + if (StringUtils.hasText(realName)) { + strings.add(realName); + } else { + strings.add(manager); + } + }); + String toString = strings.toString(); + String substring = toString.substring(1, toString.length() - 1); + modu.setManagerUsers_dictText(substring); + } + } return Result.OK(pageList); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java index b64cb8a..c725616 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java @@ -2,6 +2,7 @@ package org.jeecg.modules.modulex.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -96,6 +97,13 @@ public class Modulex implements Serializable { @Excel(name = "责任人", width = 15) @ApiModelProperty(value = "责任人") private String managerUsers; + + /** + * 上面的字段 本身的数据字典无法翻译 也不能直接把原来的字段替换掉 + * 故 用这个字段代表 翻译后的值 不改变原先的 + */ + @TableField(exist = false) + private String managerUsers_dictText; /** * 任务等级 * 值:1、2、3、4、5,默认2 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/mapper/ModulexMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/mapper/ModulexMapper.java index b2e6424..0f5b27a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/mapper/ModulexMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/mapper/ModulexMapper.java @@ -2,6 +2,7 @@ package org.jeecg.modules.modulex.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Select; import org.jeecg.modules.modulex.entity.Modulex; /** @@ -12,4 +13,6 @@ import org.jeecg.modules.modulex.entity.Modulex; */ public interface ModulexMapper extends BaseMapper { + @Select("SELECT realname FROM sys_user WHERE id = #{id}") + String getRealName(String id); }