zzw
2023-11-17 d33e687ff5b3fdb50e3dccf50e3a276baf2e6c5c
编号
6个文件已修改
38 ■■■■ 已修改文件
web/src/views/layout/main.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/pages/login.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zt/common/src/main/java/com/zt/core/sys/dto/DictItemDto.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zt/core/src/main/java/com/zt/core/config/shiro/ShiroConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zt/core/src/main/java/com/zt/modules/sys/controller/SysDictTypeController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zt/core/src/main/java/com/zt/modules/sys/service/SysDictTypeService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/layout/main.vue
@@ -88,7 +88,7 @@
    },
    methods: {
      async kwReplacement() {
        let res = await this.$http.get(`/sys/keyword/replacement`)
        let res = await this.$http.get(`sys/dict/type/getDictMap`,{params:{dictType:"key_word"}})
        if (res.data != null) {
          this.$store.state.word = res.data
        }
web/src/views/pages/login.vue
@@ -138,7 +138,7 @@
        this.$refs['changePassword'].$refs['dialog'].init()
      },
      async kwReplacement() {
        let res = await this.$http.get(`/sys/keyword/replacement`)
        let res = await this.$http.get(`sys/dict/type/getDictMap`,{params:{dictType:"key_word"}})
        if (res.data != null) {
          this.$store.state.word = res.data
        }
zt/common/src/main/java/com/zt/core/sys/dto/DictItemDto.java
@@ -21,12 +21,13 @@
public class DictItemDto implements Serializable {
    private String dictLabel;
    private String dictValue;
    private String remark;
    public DictItemDto() {
    }
    public DictItemDto(String dictLabel, String dictValue) {
    public DictItemDto(String dictLabel, String dictValue, String remark) {
        this.dictLabel = dictLabel;
        this.dictValue = dictValue;
        this.remark = remark;
    }
}
zt/core/src/main/java/com/zt/core/config/shiro/ShiroConfig.java
@@ -97,9 +97,9 @@
        filterMap.put("/sys/oss/content2","anon");
        filterMap.put("/sys/dict/type/all", "anon");
        filterMap.put("/sys/keyword/replacement", "anon");
        filterMap.put("/sys/dict/type/getDictMap", "anon");
        filterMap.put("/captcha", "anon");
        filterMap.put("/sys/config","anon");
zt/core/src/main/java/com/zt/modules/sys/controller/SysDictTypeController.java
@@ -20,6 +20,9 @@
import com.zt.core.shiro.ImportErrDto;
import com.zt.core.shiro.ImportUtil;
import com.zt.core.sys.dto.DictDto;
import com.zt.core.sys.dto.DictItemDto;
import com.zt.core.sys.dto.DictLeafDto;
import com.zt.modules.sys.model.SysDictData;
import com.zt.modules.sys.model.SysDictType;
import com.zt.modules.sys.service.SysDictTypeService;
import io.swagger.annotations.Api;
@@ -30,8 +33,10 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * 字典类型
@@ -142,4 +147,22 @@
        return Result.ok(sysDictTypeService.getDicts());
    }
    /**
     * 将获取到的关键词存入map
     * @return
     */
    @GetMapping("getDictMap")
    @ApiOperation("字典Map")
    public Map<String, String> getDictMap(@RequestParam String dictType) {
        List<DictDto> userDicts = sysDictTypeService.getUserDicts();
        DictDto dict = userDicts.stream()
                .filter(c -> c.getDictType().equals(dictType))
                .collect(Collectors.toList()).get(0);
        Map<String, String> keywordMap = new HashMap<>();
        for (DictItemDto dictItemDto : ((DictLeafDto) dict).getDataList()) {
            keywordMap.put(dictItemDto.getDictLabel(), dictItemDto.getRemark());
        }
        return keywordMap;
    }
}
zt/core/src/main/java/com/zt/modules/sys/service/SysDictTypeService.java
@@ -352,7 +352,7 @@
                    List<SysDictData> datas = sysDictDataService.getByType(type.getId());
                    if (datas.size() > 0) {
                        for (SysDictData data : datas) {
                            DictItemDto itemDto = new DictItemDto(data.getDictLabel(), String.valueOf(data.getDictValue()));
                            DictItemDto itemDto = new DictItemDto(data.getDictLabel(), String.valueOf(data.getDictValue()), data.getRemark());
                            ((DictLeafDto) dto).getDataList().add(itemDto);
                        }
                        list.add(dto);
@@ -375,7 +375,7 @@
                dto = new DictLeafDto(type.getDictType(), type.getDictName());
                List<SysDictData> datas = sysDictDataService.getByType(type.getId());
                for (SysDictData data : datas) {
                    DictItemDto itemDto = new DictItemDto(data.getDictLabel(), String.valueOf(data.getDictValue()));
                    DictItemDto itemDto = new DictItemDto(data.getDictLabel(), String.valueOf(data.getDictValue()),data.getRemark());
                    ((DictLeafDto) dto).getDataList().add(itemDto);
                }
            }