yuxc
2023-03-28 43ac462d09de49a3e7fb6a8879fb56b8421c0434
新建omd微服务以及移植字典功能
已修改2个文件
已添加19个文件
1348 ■■■■■ 文件已修改
Source/BladeX/blade-service-api/blade-omd-api/pom.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/cache/DictBizCache.java 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/entity/DictBizM.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/enums/DictBizEnum.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/feign/IDictBizClient.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/feign/IDictBizClientFallback.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/vo/DictBizMVO.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/pom.xml 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/OmdApplication.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/controller/DictBizOmdController.java 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/feign/DictBizClient.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/mapper/DictBizMapper.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/mapper/DictBizMapper.xml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/service/IDictBizService.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/service/impl/DictBizServiceImpl.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/wrapper/DictBizWrapper.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/resources/application-dev.yml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/resources/application-prod.yml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/blade-omd/src/main/resources/application-test.yml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/BladeX/blade-service-api/blade-omd-api/pom.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>blade-service-api</artifactId>
        <groupId>org.springblade</groupId>
        <version>3.0.1.RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>blade-omd-api</artifactId>
    <name>${project.artifactId}</name>
    <version>${bladex.project.version}</version>
    <packaging>jar</packaging>
</project>
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/cache/DictBizCache.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,133 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.cache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.enums.DictBizEnum;
import org.springblade.omd.feign.IDictBizClient;
import java.util.List;
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
/**
 * ä¸šåŠ¡å­—å…¸ç¼“å­˜å·¥å…·ç±»
 *
 * @author Chill
 */
public class DictBizCache {
    private static final String DICT_ID = "dictBiz:id";
    private static final String DICT_VALUE = "dictBiz:value";
    private static final String DICT_LIST = "dictBiz:list";
    private static IDictBizClient dictClient;
    private static IDictBizClient getDictClient() {
        if (dictClient == null) {
            dictClient = SpringUtil.getBean(IDictBizClient.class);
        }
        return dictClient;
    }
    /**
     * èŽ·å–å­—å…¸å®žä½“
     *
     * @param id ä¸»é”®
     * @return DictBiz
     */
    public static DictBizM getById(Long id) {
        String keyPrefix = DICT_ID.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix, id, () -> {
            R<DictBizM> result = getDictClient().getById(id);
            return result.getData();
        });
    }
    /**
     * èŽ·å–å­—å…¸å€¼
     *
     * @param code    å­—典编号枚举
     * @param dictKey Integer型字典键
     * @return String
     */
    public static String getValue(DictBizEnum code, Integer dictKey) {
        return getValue(code.getName(), dictKey);
    }
    /**
     * èŽ·å–å­—å…¸å€¼
     *
     * @param code    å­—典编号
     * @param dictKey Integer型字典键
     * @return String
     */
    public static String getValue(String code, Integer dictKey) {
        String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, String.valueOf(dictKey), () -> {
            R<String> result = getDictClient().getValue(code, String.valueOf(dictKey));
            return result.getData();
        });
    }
    /**
     * èŽ·å–å­—å…¸å€¼
     *
     * @param code    å­—典编号枚举
     * @param dictKey String型字典键
     * @return String
     */
    public static String getValue(DictBizEnum code, String dictKey) {
        return getValue(code.getName(), dictKey);
    }
    /**
     * èŽ·å–å­—å…¸å€¼
     *
     * @param code    å­—典编号
     * @param dictKey String型字典键
     * @return String
     */
    public static String getValue(String code, String dictKey) {
        String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> {
            R<String> result = getDictClient().getValue(code, dictKey);
            return result.getData();
        });
    }
    /**
     * èŽ·å–å­—å…¸é›†åˆ
     *
     * @param code å­—典编号
     * @return List<DictBiz>
     */
    public static List<DictBizM> getList(String code) {
        String keyPrefix = DICT_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> {
            R<List<DictBizM>> result = getDictClient().getList(code);
            return result.getData();
        });
    }
}
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/entity/DictBizM.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,108 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
 * å®žä½“ç±»
 *
 * @author Chill
 */
@Data
@TableName("pl_sys_dict_biz")
@ApiModel(value = "DictBiz对象", description = "DictBiz对象")
public class DictBizM implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * ç§Ÿæˆ·ID
     */
    @ApiModelProperty(value = "租户ID")
    private String tenantId;
    /**
     * çˆ¶ä¸»é”®
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "父主键")
    private Long parentId;
    /**
     * å­—典码
     */
    @ApiModelProperty(value = "字典码")
    private String code;
    /**
     * å­—典值
     */
    @ApiModelProperty(value = "字典值")
    private String dictKey;
    /**
     * å­—典名称
     */
    @ApiModelProperty(value = "字典名称")
    private String dictValue;
    /**
     * æŽ’序
     */
    @ApiModelProperty(value = "排序")
    private Integer sort;
    /**
     * å­—典备注
     */
    @ApiModelProperty(value = "字典备注")
    private String remark;
    /**
     * æ˜¯å¦å·²å°å­˜
     */
    @ApiModelProperty(value = "是否已封存")
    private Integer isSealed;
    /**
     * æ˜¯å¦å·²åˆ é™¤
     */
    @TableLogic
    @ApiModelProperty(value = "是否已删除")
    private Integer isDeleted;
}
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/enums/DictBizEnum.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * ä¸šåŠ¡å­—å…¸æžšä¸¾ç±»
 *
 * @author Chill
 */
@Getter
@AllArgsConstructor
public enum DictBizEnum {
    /**
     * æµ‹è¯•
     */
    TEST("test"),
    ;
    final String name;
}
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/feign/IDictBizClient.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,84 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.feign;
import org.springblade.core.tool.api.R;
import org.springblade.omd.entity.DictBizM;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import java.util.List;
/**
 * Feign接口类
 *
 * @author Chill
 */
@FeignClient(
    value = "blade-omd",
    fallback = IDictBizClientFallback.class
)
public interface IDictBizClient {
    String API_PREFIX = "/client";
    String GET_BY_ID = API_PREFIX + "/dict-biz/get-by-id";
    String GET_VALUE = API_PREFIX + "/dict-biz/get-value";
    String GET_LIST = API_PREFIX + "/dict-biz/get-list";
    String CHECK_VALUE = API_PREFIX + "/dict-biz/check-value";
    /**
     * èŽ·å–å­—å…¸å®žä½“
     *
     * @param id ä¸»é”®
     * @return
     */
    @GetMapping(GET_BY_ID)
    R<DictBizM> getById(@RequestParam("id") Long id);
    /**
     * èŽ·å–å­—å…¸è¡¨å¯¹åº”å€¼
     *
     * @param code    å­—典编号
     * @param dictKey å­—典序号
     * @return
     */
    @GetMapping(GET_VALUE)
    R<String> getValue(@RequestParam("code") String code, @RequestParam("dictKey") String dictKey);
    /**
     * èŽ·å–å­—å…¸è¡¨
     *
     * @param code å­—典编号
     * @return
     */
    @GetMapping(GET_LIST)
    R<List<DictBizM>> getList(@RequestParam("code") String code);
    /**
     * æ£€æŸ¥å­—典是否存在,存在即返回,不存在新增
     *
     * @param dict å­—典数据
     * @return
     */
    @GetMapping(CHECK_VALUE)
    R getCheck(@Valid @RequestBody DictBizM dict);
}
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/feign/IDictBizClientFallback.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.feign;
import org.springblade.core.tool.api.R;
import org.springblade.omd.entity.DictBizM;
import org.springframework.stereotype.Component;
import java.util.List;
/**
 * Feign失败配置
 *
 * @author Chill
 */
@Component
public class IDictBizClientFallback implements IDictBizClient {
    @Override
    public R<DictBizM> getById(Long id) {
        return R.fail("获取数据失败");
    }
    @Override
    public R<String> getValue(String code, String dictKey) {
        return R.fail("获取数据失败");
    }
    @Override
    public R<List<DictBizM>> getList(String code) {
        return R.fail("获取数据失败");
    }
    @Override
    public R getCheck(DictBizM dict) {
        return R.fail("获取数据失败");
    }
}
Source/BladeX/blade-service-api/blade-omd-api/src/main/java/org/springblade/omd/vo/DictBizMVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.omd.entity.DictBizM;
import java.util.ArrayList;
import java.util.List;
/**
 * è§†å›¾å®žä½“ç±»
 *
 * @author Chill
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "DictBizVO对象", description = "DictBizVO对象")
public class DictBizMVO extends DictBizM implements INode<DictBizM> {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * çˆ¶èŠ‚ç‚¹ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;
    /**
     * å­å­™èŠ‚ç‚¹
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<DictBizM> children;
    @Override
    public List<DictBizM> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }
    /**
     * ä¸Šçº§å­—å…¸
     */
    private String parentName;
}
Source/BladeX/blade-service-api/pom.xml
@@ -22,6 +22,7 @@
        <module>blade-system-api</module>
        <module>blade-user-api</module>
        <module>blade-code-api</module>
        <module>blade-omd-api</module>
    </modules>
    <dependencies>
Source/BladeX/blade-service/blade-omd/pom.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,93 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.springblade</groupId>
        <artifactId>blade-service</artifactId>
        <version>3.0.1.RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>blade-omd</artifactId>
    <name>${project.artifactId}</name>
    <version>${bladex.project.version}</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-core-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-omd-api</artifactId>
            <version>${bladex.project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-flow-api</artifactId>
            <version>${bladex.project.version}</version>
        </dependency>
        <!--Oss-->
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-oss</artifactId>
        </dependency>
        <!--MinIO-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
        </dependency>
        <!--QiNiu-->
        <dependency>
            <groupId>com.qiniu</groupId>
            <artifactId>qiniu-java-sdk</artifactId>
        </dependency>
        <!--<dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-transaction</artifactId>
        </dependency>-->
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.easyproject</groupId>
            <artifactId>orai18n</artifactId>
            <version>${orai18n.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <configuration>
                    <username>${docker.username}</username>
                    <password>${docker.password}</password>
                    <repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository>
                    <tag>${project.version}</tag>
                    <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
                    <buildArgs>
                        <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                    <skip>false</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/OmdApplication.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
/**
 * ç³»ç»Ÿæ¨¡å—启动器
 * @author Chill
 */
@BladeCloudApplication
public class OmdApplication {
    public static void main(String[] args) {
        BladeApplication.run("blade-omd", OmdApplication.class, args);
    }
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/controller/DictBizOmdController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,189 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.service.IDictBizService;
import org.springblade.omd.vo.DictBizMVO;
import org.springblade.omd.wrapper.DictBizWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
/**
 * æŽ§åˆ¶å™¨
 *
 * @author Chill
 */
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping("/dict-biz")
@Api(value = "业务字典", tags = "业务字典")
public class DictBizOmdController extends BladeController {
    private final IDictBizService dictService;
    /**
     * è¯¦æƒ…
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入dict")
    public R<DictBizMVO> detail(DictBizM dict) {
        DictBizM detail = dictService.getOne(Condition.getQueryWrapper(dict));
        return R.data(DictBizWrapper.build().entityVO(detail));
    }
    /**
     * åˆ—表
     */
    @GetMapping("/list")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
        @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
    })
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "列表", notes = "传入dict")
    public R<List<DictBizMVO>> list(@ApiIgnore @RequestParam Map<String, Object> dict) {
        List<DictBizM> list = dictService.list(Condition.getQueryWrapper(dict, DictBizM.class).lambda().orderByAsc(DictBizM::getSort));
        return R.data(DictBizWrapper.build().listNodeVO(list));
    }
    /**
     * é¡¶çº§åˆ—表
     */
    @GetMapping("/parent-list")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
        @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
    })
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "列表", notes = "传入dict")
    public R<IPage<DictBizMVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict, Query query) {
        return R.data(dictService.parentList(dict, query));
    }
    /**
     * å­åˆ—表
     */
    @GetMapping("/child-list")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
        @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string"),
        @ApiImplicitParam(name = "parentId", value = "字典名称", paramType = "query", dataType = "string")
    })
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "列表", notes = "传入dict")
    public R<List<DictBizMVO>> childList(@ApiIgnore @RequestParam Map<String, Object> dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) {
        return R.data(dictService.childList(dict, parentId));
    }
    /**
     * èŽ·å–å­—å…¸æ ‘å½¢ç»“æž„
     */
    @GetMapping("/tree")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "树形结构", notes = "树形结构")
    public R<List<DictBizMVO>> tree() {
        List<DictBizMVO> tree = dictService.tree();
        return R.data(tree);
    }
    /**
     * èŽ·å–å­—å…¸æ ‘å½¢ç»“æž„
     */
    @GetMapping("/parent-tree")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "树形结构", notes = "树形结构")
    public R<List<DictBizMVO>> parentTree() {
        List<DictBizMVO> tree = dictService.parentTree();
        return R.data(tree);
    }
    /**
     * æ–°å¢žæˆ–修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入dict")
    public R submit(@Valid @RequestBody DictBizM dict) {
        CacheUtil.clear(DICT_CACHE);
        return R.status(dictService.submit(dict));
    }
    /**
     * åˆ é™¤
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        CacheUtil.clear(DICT_CACHE);
        return R.status(dictService.removeDict(ids));
    }
    /**
     * èŽ·å–å­—å…¸
     */
    @GetMapping("/dictionary")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "获取字典", notes = "获取字典")
    public R<List<DictBizM>> dictionary(String code) {
        List<DictBizM> tree = dictService.getList(code);
        return R.data(tree);
    }
    /**
     * èŽ·å–å­—å…¸æ ‘
     */
    @GetMapping("/dictionary-tree")
    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "获取字典树", notes = "获取字典树")
    public R<List<DictBizMVO>> dictionaryTree(String code) {
        List<DictBizM> tree = dictService.getList(code);
        return R.data(DictBizWrapper.build().listNodeVO(tree));
    }
    /**
     * æ£€æŸ¥å­—典是否存在,存在即返回,不存在新增
     */
    @PostMapping("/check")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入dict")
    public R checkOrInsert(@Valid @RequestBody DictBizM dict) {
        CacheUtil.clear(DICT_CACHE);
        return dictService.checkOrInsert(dict);
    }
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/feign/DictBizClient.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.feign;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.service.IDictBizService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
 * å­—典服务Feign实现类
 *
 * @author Chill
 */
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
public class DictBizClient implements IDictBizClient {
    private final IDictBizService service;
    @Override
    @GetMapping(GET_BY_ID)
    public R<DictBizM> getById(Long id) {
        return R.data(service.getById(id));
    }
    @Override
    @GetMapping(GET_VALUE)
    public R<String> getValue(String code, String dictKey) {
        return R.data(service.getValue(code, dictKey));
    }
    @Override
    @GetMapping(GET_LIST)
    public R<List<DictBizM>> getList(String code) {
        return R.data(service.getList(code));
    }
    @Override
    @GetMapping(CHECK_VALUE)
    public R getCheck(DictBizM dict) {
        return service.checkOrInsert(dict);
    }
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/mapper/DictBizMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.vo.DictBizMVO;
import java.util.List;
/**
 * Mapper æŽ¥å£
 *
 * @author Chill
 */
public interface DictBizMapper extends BaseMapper<DictBizM> {
    /**
     * èŽ·å–å­—å…¸è¡¨å¯¹åº”ä¸­æ–‡
     *
     * @param code    å­—典编号
     * @param dictKey å­—典序号
     * @return
     */
    String getValue(String code, String dictKey);
    /**
     * èŽ·å–å­—å…¸è¡¨
     *
     * @param code å­—典编号
     * @return
     */
    List<DictBizM> getList(String code);
    /**
     * èŽ·å–æ ‘å½¢èŠ‚ç‚¹
     *
     * @return
     */
    List<DictBizMVO> tree();
    /**
     * èŽ·å–æ ‘å½¢èŠ‚ç‚¹
     *
     * @return
     */
    List<DictBizMVO> parentTree();
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/mapper/DictBizMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.omd.mapper.DictBizMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="dictResultMap" type="org.springblade.omd.entity.DictBizM">
        <id column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="parent_id" property="parentId"/>
        <result column="code" property="code"/>
        <result column="dict_key" property="dictKey"/>
        <result column="dict_value" property="dictValue"/>
        <result column="sort" property="sort"/>
        <result column="remark" property="remark"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
        <id column="id" property="id"/>
        <result column="parent_id" property="parentId"/>
        <result column="title" property="title"/>
        <result column="value" property="value"/>
        <result column="key" property="key"/>
    </resultMap>
    <select id="getValue" resultType="java.lang.String">
        select
            dict_value
        from pl_sys_dict_biz where code = #{param1} and dict_key = #{param2} and is_deleted = 0
    </select>
    <!-- oracle ç‰ˆæœ¬ -->
    <!--<select id="getValue" resultType="java.lang.String">
        select
            dict_value
        from pl_sys_dict_biz where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} and dict_key >= 0  rownum 1
    </select>-->
    <select id="getList" resultMap="dictResultMap">
        select id, tenant_id, parent_id, code, dict_key, dict_value, sort, remark from pl_sys_dict_biz where code = #{param1} and parent_id > 0 and is_sealed = 0 and is_deleted = 0
    </select>
    <select id="tree" resultMap="treeNodeResultMap">
        select id, parent_id, dict_value as title, id as "value", id as "key" from pl_sys_dict_biz where is_deleted = 0
    </select>
    <select id="parentTree" resultMap="treeNodeResultMap">
        select id, parent_id, dict_value as title, id as "value", id as "key" from pl_sys_dict_biz where is_deleted = 0 and parent_id = 0
    </select>
</mapper>
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/service/IDictBizService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,109 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.vo.DictBizMVO;
import java.util.List;
import java.util.Map;
/**
 * æœåŠ¡ç±»
 *
 * @author Chill
 */
public interface IDictBizService extends IService<DictBizM> {
    /**
     * æ ‘形结构
     *
     * @return
     */
    List<DictBizMVO> tree();
    /**
     * æ ‘形结构
     *
     * @return
     */
    List<DictBizMVO> parentTree();
    /**
     * èŽ·å–å­—å…¸è¡¨å¯¹åº”ä¸­æ–‡
     *
     * @param code    å­—典编号
     * @param dictKey å­—典序号
     * @return
     */
    String getValue(String code, String dictKey);
    /**
     * èŽ·å–å­—å…¸è¡¨
     *
     * @param code å­—典编号
     * @return
     */
    List<DictBizM> getList(String code);
    /**
     * æ–°å¢žæˆ–修改
     *
     * @param dict
     * @return
     */
    boolean submit(DictBizM dict);
    /**
     * åˆ é™¤å­—å…¸
     *
     * @param ids
     * @return
     */
    boolean removeDict(String ids);
    /**
     * é¡¶çº§åˆ—表
     *
     * @param dict
     * @param query
     * @return
     */
    IPage<DictBizMVO> parentList(Map<String, Object> dict, Query query);
    /**
     * å­åˆ—表
     *
     * @param dict
     * @param parentId
     * @return
     */
    List<DictBizMVO> childList(Map<String, Object> dict, Long parentId);
    /**
     * æ–°å¢žæˆ–修改
     *
     * @param dict
     * @return
     */
    R checkOrInsert(DictBizM dict);
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/service/impl/DictBizServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,142 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.omd.cache.DictBizCache;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.mapper.DictBizMapper;
import org.springblade.omd.service.IDictBizService;
import org.springblade.omd.vo.DictBizMVO;
import org.springblade.omd.wrapper.DictBizWrapper;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
/**
 * æœåŠ¡å®žçŽ°ç±»
 *
 * @author Chill
 */
@Service
public class DictBizServiceImpl extends ServiceImpl<DictBizMapper, DictBizM> implements IDictBizService {
    @Override
    public List tree() {
        return  ForestNodeMerger.merge((List)baseMapper.tree());
    }
    @Override
    public List<DictBizMVO> parentTree() {
        return ForestNodeMerger.merge((List)baseMapper.parentTree());
    }
    @Override
    public String getValue(String code, String dictKey) {
        return Func.toStr(baseMapper.getValue(code, dictKey), StringPool.EMPTY);
    }
    @Override
    public List<DictBizM> getList(String code) {
        return baseMapper.getList(code);
    }
    @Override
    public boolean submit(DictBizM dict) {
        LambdaQueryWrapper<DictBizM> lqw = Wrappers.<DictBizM>query().lambda().eq(DictBizM::getCode, dict.getCode()).eq(DictBizM::getDictKey, dict.getDictKey());
        Long cnt = baseMapper.selectCount((Func.isEmpty(dict.getId())) ? lqw : lqw.notIn(DictBizM::getId, dict.getId()));
        if (cnt > 0L) {
            throw new ServiceException("当前字典键值已存在!");
        }
        // ä¿®æ”¹é¡¶çº§å­—典后同步更新下属字典的编号
        if (Func.isNotEmpty(dict.getId()) && dict.getParentId().longValue() == BladeConstant.TOP_PARENT_ID) {
            DictBizM parent = DictBizCache.getById(dict.getId());
            this.update(Wrappers.<DictBizM>update().lambda().set(DictBizM::getCode, dict.getCode()).eq(DictBizM::getCode, parent.getCode()).ne(DictBizM::getParentId, BladeConstant.TOP_PARENT_ID));
        }
        if (Func.isEmpty(dict.getParentId())) {
            dict.setParentId(BladeConstant.TOP_PARENT_ID);
        }
        dict.setIsDeleted(BladeConstant.DB_NOT_DELETED);
        CacheUtil.clear(DICT_CACHE);
        return saveOrUpdate(dict);
    }
    @Override
    public boolean removeDict(String ids) {
        Long cnt = baseMapper.selectCount(Wrappers.<DictBizM>query().lambda().in(DictBizM::getParentId, Func.toLongList(ids)));
        if (cnt > 0L) {
            throw new ServiceException("请先删除子节点!");
        }
        return removeByIds(Func.toLongList(ids));
    }
    @Override
    public IPage<DictBizMVO> parentList(Map<String, Object> dict, Query query) {
        IPage<DictBizM> page = this.page(Condition.getPage(query), Condition.getQueryWrapper(dict, DictBizM.class).lambda().eq(DictBizM::getParentId, CommonConstant.TOP_PARENT_ID).orderByAsc(DictBizM::getSort));
        return DictBizWrapper.build().pageVO(page);
    }
    @Override
    public List<DictBizMVO> childList(Map<String, Object> dict, Long parentId) {
        if (parentId < 0) {
            return new ArrayList<>();
        }
        dict.remove("parentId");
        DictBizM parentDict = DictBizCache.getById(parentId);
        List<DictBizM> list = this.list(Condition.getQueryWrapper(dict, DictBizM.class).lambda().ne(DictBizM::getId, parentId).eq(DictBizM::getCode, parentDict.getCode()).orderByAsc(DictBizM::getSort));
        return DictBizWrapper.build().listNodeVO(list);
    }
    @Override
    public R checkOrInsert(DictBizM dict) {
        LambdaQueryWrapper<DictBizM> lqw = Wrappers.<DictBizM>query().lambda().eq(DictBizM::getCode, dict.getCode()).eq(DictBizM::getDictKey, dict.getDictKey());
        Long cnt = baseMapper.selectCount((Func.isEmpty(dict.getId())) ? lqw : lqw.notIn(DictBizM::getId, dict.getId()));
        if (cnt > 0L) {
            return R.fail("字典已经存在!");
        }
        if (Func.isEmpty(dict.getParentId())) {
            dict.setParentId(BladeConstant.TOP_PARENT_ID);
        }
        dict.setIsDeleted(BladeConstant.DB_NOT_DELETED);
        CacheUtil.clear(DICT_CACHE);
        if(saveOrUpdate(dict) == true){
            return R.success("操作成功!");
        }
        return R.fail("操作失败!");
    }
}
Source/BladeX/blade-service/blade-omd/src/main/java/org/springblade/omd/wrapper/DictBizWrapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.omd.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.omd.cache.DictBizCache;
import org.springblade.omd.entity.DictBizM;
import org.springblade.omd.vo.DictBizMVO;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * åŒ…装类,返回视图层所需的字段
 *
 * @author Chill
 */
public class DictBizWrapper extends BaseEntityWrapper<DictBizM, DictBizMVO> {
    public static DictBizWrapper build() {
        return new DictBizWrapper();
    }
    @Override
    public DictBizMVO entityVO(DictBizM dict) {
        DictBizMVO dictVO = Objects.requireNonNull(BeanUtil.copy(dict, DictBizMVO.class));
        if (Func.equals(dict.getParentId(), BladeConstant.TOP_PARENT_ID)) {
            dictVO.setParentName(BladeConstant.TOP_PARENT_NAME);
        } else {
            DictBizM parent = DictBizCache.getById(dict.getParentId());
            dictVO.setParentName(parent.getDictValue());
        }
        return dictVO;
    }
    public List<DictBizMVO> listNodeVO(List<DictBizM> list) {
        List<DictBizMVO> collect = list.stream().map(dict -> BeanUtil.copy(dict, DictBizMVO.class)).collect(Collectors.toList());
        return ForestNodeMerger.merge((List)collect);
    }
}
Source/BladeX/blade-service/blade-omd/src/main/resources/application-dev.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
#服务器端口
server:
  port: 36015
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.dev.url}
    username: ${blade.datasource.dev.username}
    password: ${blade.datasource.dev.password}
Source/BladeX/blade-service/blade-omd/src/main/resources/application-prod.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
#服务器端口
server:
  port: 8105
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.prod.url}
    username: ${blade.datasource.prod.username}
    password: ${blade.datasource.prod.password}
Source/BladeX/blade-service/blade-omd/src/main/resources/application-test.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
#服务器端口
server:
  port: 8105
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.test.url}
    username: ${blade.datasource.test.username}
    password: ${blade.datasource.test.password}
Source/BladeX/blade-service/pom.xml
@@ -22,6 +22,7 @@
        <module>blade-system</module>
        <module>blade-user</module>
        <module>blade-code</module>
        <module>blade-omd</module>
    </modules>
    <dependencies>