This commit is contained in:
esacpe
2024-07-17 21:04:17 +08:00
commit 1fa3303972
1291 changed files with 92328 additions and 0 deletions

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.37" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.37" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.0" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.7" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.7" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.1.5.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="module" module-name="common-base-starter" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.8.0" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.14" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.14" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.8.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.8.0" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.9" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.8.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.8.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.github.caspar-chen:swagger-ui-layer:1.1.3" level="project" />
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.7.20" level="project" />
<orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:transmittable-thread-local:2.11.5" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.2" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.13" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
<orderEntry type="module" module-name="common-redis-starter" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.3.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.3.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.3.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.3.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.3.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.49.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="module" module-name="common-token-starter" />
<orderEntry type="library" name="Maven: com.auth0:java-jwt:3.8.1" level="project" />
<orderEntry type="library" name="Maven: com.vividsolutions:jts:1.13" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.18" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.4" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.8.0" level="project" />
</component>
</module>

View File

@ -0,0 +1,116 @@
<?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>mosty-common</artifactId>
<groupId>com.mosty</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common-config-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-dependencies.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.0</version>
<!-- <optional>true</optional>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>${spring-boot-dependencies.version}</version>
<optional>true</optional>
</dependency>
<!-- 自定义验证注解 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>${spring-boot-dependencies.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
<dependency>
<groupId>com.mosty</groupId>
<artifactId>common-base-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mosty</groupId>
<artifactId>common-redis-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mosty</groupId>
<artifactId>common-token-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.baomidou</groupId>-->
<!-- <artifactId>mybatis-plus</artifactId>-->
<!-- <version>3.5.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>mosty-nexus-releases</id>
<name>release version</name>
<url>http://47.108.232.77:8181/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>mosty-nexus-snapshots</id>
<name>snapshots version</name>
<url>http://47.108.232.77:8181/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,18 @@
package com.mosty.common.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* 代码生成自动装配
* @author kevin
* @date 2022/2/3 3:34 PM
* @since 1.0.0
*/
@Configuration
@MapperScan("com.mosty.common.config.mapper")
//@ComponentScan(basePackages = "com.mosty.common.config")
public class CommonConfigAutoConfiguration {
}

View File

@ -0,0 +1,35 @@
package com.mosty.common.config;
import com.mosty.common.base.util.SpringIocContext;
import com.mosty.common.config.service.SysDictItemService;
import com.mosty.common.config.service.SysDictService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
/**
* 单体服务或基础微服务 使用的服务工厂
* @author kevin
* @date 2022/2/9 10:57 PM
* @since 1.0.0
*/
@Slf4j
@Component
@AllArgsConstructor
public class ConfigServiceFactory implements InitializingBean {
public static SysDictService sysDictService;
public static SysDictItemService sysDictItemService;
@Override
public void afterPropertiesSet() throws Exception {
// ConfigServiceFactory.sysDictService = SpringIocContext.getBean(SysDictService.class);
// log.info("需要调用字典服务使用ConfigServiceFactory.sysDictService");
// ConfigServiceFactory.sysDictItemService = SpringIocContext.getBean(SysDictItemService.class);
// log.info("需要调用字典明细服务使用ConfigServiceFactory.sysDictItemService");
}
}

View File

@ -0,0 +1,131 @@
package com.mosty.common.config.Excel;
import java.util.Collection;
import java.util.List;
import com.mosty.common.base.constant.Constants;
import com.mosty.common.base.entity.log.SpringUtils;
import com.mosty.common.base.entity.log.StringUtils;
import com.mosty.common.config.entity.SysDictItem;
import com.mosty.common.redis.service.RedisService;
/**
* 字典工具类
*
* @author ruoyi
*/
public class DictUtils
{
/**
* 设置字典缓存
*
* @param key 参数键
* @param dictDatas 字典数据列表
*/
public static void setDictCache(String key, List<SysDictItem> dictDatas)
{
SpringUtils.getBean(RedisService.class).setCacheObject(getCacheKey(key), dictDatas);
}
/**
* 获取字典缓存
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static List<SysDictItem> getDictCache(String key)
{
Object cacheObj = SpringUtils.getBean(RedisService.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
{
List<SysDictItem> dictItems = StringUtils.cast(cacheObj);
return dictItems;
}
return null;
}
/**
* 清空字典缓存
*/
public static void clearDictCache()
{
Collection<String> keys = SpringUtils.getBean(RedisService.class).keys(Constants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisService.class).deleteObject(keys);
}
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
public static String getCacheKey(String configKey)
{
return Constants.SYS_DICT_KEY + configKey;
}
/**
* 根据指定的type value 获取 label
* @param value
* @param type
* @param defaultLabel 默认label
* @return
*/
public static String getDictLabelByTypeAndValue(String value, String type, String defaultLabel){
if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(value)){
for (SysDictItem dict : getDictCache(type)){
if (type.equals(dict.getZdbh()) && value.equals(dict.getDm())){
return dict.getZdmc();
}
}
}
return defaultLabel;
}
/**
* 根据type,label 获取value
*
* @param label
* @param type
* @param defaultValue
* @return
*/
public static String getDictValueByTypeAndLabel(String label,String type,String defaultValue) {
if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(label)){
for (SysDictItem dict : getDictCache(type)){
if(type.equals(dict.getZdbh()) && label.equals(dict.getZdmc())) {
return dict.getDm();
}
}
}
return defaultValue;
}
/**
* 根据 type 将 lable组成 string数组
* @param type
* @return
*/
public static String[] getLabelArr(String type) {
String[] arr0 = new String[0];
if (StringUtils.isNotBlank(type)) {
List<SysDictItem> dictList = getDictCache(type);
String[] strArr = new String[dictList.size()];
for (int i = 0 ; i < dictList.size() ; i ++) {
strArr[i] = dictList.get(i).getZdmc();
}
return strArr;
}
return arr0;
}
/**
* 删除指定字典缓存
*
* @param key 字典键
*/
public static void removeDictCache(String key)
{
SpringUtils.getBean(RedisService.class).deleteObject(getCacheKey(key));
}
}

View File

@ -0,0 +1,50 @@
package com.mosty.common.config.Excel;
import java.util.List;
public class ExcelExp {
private String fileName;// sheet的名称
private String[] handers;// sheet里的标题
private List dataset;// sheet里的数据集
private Class clazz;
public ExcelExp(String fileName, List dataset, Class clazz) {
this.fileName = fileName;
this.dataset = dataset;
this.clazz = clazz;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String[] getHanders() {
return handers;
}
public void setHanders(String[] handers) {
this.handers = handers;
}
public List getDataset() {
return dataset;
}
public void setDataset(List dataset) {
this.dataset = dataset;
}
public Class getClazz() {
return clazz;
}
public void setClazz(Class clazz) {
this.clazz = clazz;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,958 @@
package com.mosty.common.config.Excel;
import com.mosty.common.base.entity.log.*;
import com.mosty.common.base.entity.log.Excel.ColumnType;
import com.mosty.common.base.entity.log.Excel.Type;
import com.mosty.common.base.util.DateUtils;
import com.mosty.common.base.util.FileTypeUtils;
import com.mosty.common.base.util.ImageUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* Excel相关处理
*
* @author ruoyi
*/
public class ExcelUtilManySheet<T> {
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
/**
* Excel sheet最大行数默认65536
*/
public static final int sheetSize = 65536;
/**
* 工作表名称
*/
private String sheetName;
/**
* 导出类型EXPORT:导出数据IMPORT导入模板
*/
private Type type;
/**
* 工作薄对象
*/
private Workbook wb;
/**
* 工作表对象
*/
private Sheet sheet;
/**
* 样式列表
*/
private Map<String, CellStyle> styles;
/**
* 导入导出数据列表
*/
private List<T> list;
/**
* 注解列表
*/
private List<Object[]> fields;
/**
* 最大高度
*/
private short maxHeight;
/**
* 统计列表
*/
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
/**
* 数字格式
*/
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
/**
* 实体对象
*/
public Class<T> clazz;
public List<ExcelExp> clazzlist;
public ExcelUtilManySheet(List<ExcelExp> clazzlist) {
this.clazzlist = clazzlist;
}
public void init(List<T> list, String sheetName, Type type) {
if (list == null) {
list = new ArrayList<T>();
}
this.list = list;
this.sheetName = sheetName;
this.type = type;
createExcelField();
}
/**
* 对excel表单默认第一个索引名转换成list
*
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(InputStream is) throws Exception {
return importExcel(StringUtils.EMPTY, is);
}
/**
* 对excel表单指定表格索引名转换成list
*
* @param sheetName 表格索引名
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(String sheetName, InputStream is) throws Exception {
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName)) {
// 如果指定sheet名,则取指定sheet中的内容.
sheet = wb.getSheet(sheetName);
} else {
// 如果传入的sheet名不存在则默认指向第1个sheet.
sheet = wb.getSheetAt(0);
}
if (sheet == null) {
throw new IOException("文件sheet不存在");
}
int rows = sheet.getPhysicalNumberOfRows();
if (rows > 0) {
// 定义一个map用于存放excel列的序号和field.
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(0);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell)) {
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
} else {
cellMap.put(null, i);
}
}
// 有数据时才处理 得到类的所有field.
Field[] allFields = clazz.getDeclaredFields();
// 定义一个map用于存放列的序号和field.
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
for (int col = 0; col < allFields.length; col++) {
Field field = allFields[col];
Excel attr = field.getAnnotation(Excel.class);
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
// 设置类的私有字段属性可访问.
field.setAccessible(true);
Integer column = cellMap.get(attr.name());
if (column != null) {
fieldsMap.put(column, field);
}
}
}
for (int i = 1; i < rows; i++) {
// 从第2行开始取数据,默认第一行是表头.
Row row = sheet.getRow(i);
T entity = null;
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet()) {
Object val = this.getCellValue(row, entry.getKey());
// 如果不存在实例则新建.
entity = (entity == null ? clazz.newInstance() : entity);
// 从map中得到对应列的field.
Field field = fieldsMap.get(entry.getKey());
// 取得类型,并根据对象类型设置值.
Class<?> fieldType = field.getType();
if (String.class == fieldType) {
String s = Convert.toStr(val);
if (StringUtils.endsWith(s, ".0")) {
val = StringUtils.substringBefore(s, ".0");
} else {
String dateFormat = field.getAnnotation(Excel.class).dateFormat();
if (StringUtils.isNotEmpty(dateFormat)) {
val = DateUtils.parseDateToStr(dateFormat, (Date) val);
} else {
val = Convert.toStr(val);
}
}
} else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) {
val = Convert.toInt(val);
} else if (Long.TYPE == fieldType || Long.class == fieldType) {
val = Convert.toLong(val);
} else if (Double.TYPE == fieldType || Double.class == fieldType) {
val = Convert.toDouble(val);
} else if (Float.TYPE == fieldType || Float.class == fieldType) {
val = Convert.toFloat(val);
} else if (BigDecimal.class == fieldType) {
val = Convert.toBigDecimal(val);
} else if (Date.class == fieldType) {
if (val instanceof String) {
val = DateUtils.parseDate(val);
} else if (val instanceof Double) {
val = DateUtil.getJavaDate((Double) val);
}
} else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
val = Convert.toBool(val, false);
}
if (StringUtils.isNotNull(fieldType)) {
Excel attr = field.getAnnotation(Excel.class);
String propertyName = field.getName();
if (StringUtils.isNotEmpty(attr.targetAttr())) {
propertyName = field.getName() + "." + attr.targetAttr();
} else if (StringUtils.isNotEmpty(attr.readConverterExp())) {
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
}
ReflectUtils.invokeSetter(entity, propertyName, val);
}
}
list.add(entity);
}
}
return list;
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
* @throws IOException
*/
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) throws IOException {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
this.init(list, sheetName, Type.EXPORT);
exportExcel(response.getOutputStream());
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param response 返回数据
* @param list 导出数据集合
* @return 结果
* @throws IOException
*/
public void exportExcelManySheet(HttpServletResponse response, List<ExcelExp> list) throws IOException {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
try {
createWorkbook();
for (int index = 0; index < list.size(); index++) {
this.clazz = list.get(index).getClazz();
this.init(list.get(index).getDataset(), list.get(index).getFileName(), Type.EXPORT);
// 取出一共有多少个sheet.
// double sheetNo = Math.ceil(list.size() / sheetSize);
createSheetManySheet(index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields) {
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type)) {
fillExcelData(index, row);
addStatisticsRow();
}
}
wb.write(response.getOutputStream());
} catch (IOException e) {
log.error("导出Excel异常{}", e.getMessage());
} finally {
if (wb != null) {
try {
wb.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (response.getOutputStream() != null) {
try {
response.getOutputStream().close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
// exportExcel(response.getOutputStream());
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param sheetName 工作表的名称
* @return 结果
*/
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
this.init(null, sheetName, Type.IMPORT);
exportExcel(response.getOutputStream());
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public void exportExcel(OutputStream outputStream) {
try {
// 取出一共有多少个sheet.
double sheetNo = Math.ceil(list.size() / sheetSize);
for (int index = 0; index <= sheetNo; index++) {
createSheet(sheetNo, index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields) {
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type)) {
fillExcelData(index, row);
addStatisticsRow();
}
}
wb.write(outputStream);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
} finally {
if (wb != null) {
try {
wb.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
/**
* 填充excel数据
*
* @param index 序号
* @param row 单元格行
*/
public void fillExcelData(int index, Row row) {
// int startNo = index * sheetSize;
// int endNo = Math.min(startNo + sheetSize, list.size());
for (int i = 0; i < list.size(); i++) {
row = sheet.createRow(i + 1);
// 得到导出对象.
T vo = (T) list.get(i);
int column = 0;
for (Object[] os : fields) {
Field field = (Field) os[0];
Excel excel = (Excel) os[1];
// 设置实体类私有属性可访问
field.setAccessible(true);
this.addCell(excel, row, vo, field, column++);
}
}
}
/**
* 创建表格样式
*
* @param wb 工作薄对象
* @return 样式列表
*/
private Map<String, CellStyle> createStyles(Workbook wb) {
// 写入各条记录,每条记录对应excel表中的一行
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
CellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
Font dataFont = wb.createFont();
dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10);
style.setFont(dataFont);
styles.put("data", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = wb.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true);
headerFont.setColor(IndexedColors.WHITE.getIndex());
style.setFont(headerFont);
styles.put("header", style);
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
Font totalFont = wb.createFont();
totalFont.setFontName("Arial");
totalFont.setFontHeightInPoints((short) 10);
style.setFont(totalFont);
styles.put("total", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.LEFT);
styles.put("data1", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
styles.put("data2", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.RIGHT);
styles.put("data3", style);
return styles;
}
/**
* 创建单元格
*/
public Cell createCell(Excel attr, Row row, int column) {
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
cell.setCellValue(attr.name());
setDataValidation(attr, row, column);
cell.setCellStyle(styles.get("header"));
return cell;
}
/**
* 设置单元格信息
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
*/
public void setCellVo(Object value, Excel attr, Cell cell) {
if (ColumnType.STRING == attr.cellType()) {
cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
} else if (ColumnType.NUMERIC == attr.cellType()) {
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
} else if (ColumnType.IMAGE == attr.cellType()) {
ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
cell.getRow().getRowNum() + 1);
String imagePath = Convert.toStr(value);
if (StringUtils.isNotEmpty(imagePath)) {
byte[] data = ImageUtils.getImage(imagePath);
getDrawingPatriarch(cell.getSheet()).createPicture(anchor,
cell.getSheet().getWorkbook().addPicture(data, getImageType(data)));
}
}
}
/**
* 获取画布
*/
public static Drawing<?> getDrawingPatriarch(Sheet sheet) {
if (sheet.getDrawingPatriarch() == null) {
sheet.createDrawingPatriarch();
}
return sheet.getDrawingPatriarch();
}
/**
* 获取图片类型,设置图片插入类型
*/
public int getImageType(byte[] value) {
String type = FileTypeUtils.getFileExtendName(value);
if ("JPG".equalsIgnoreCase(type)) {
return Workbook.PICTURE_TYPE_JPEG;
} else if ("PNG".equalsIgnoreCase(type)) {
return Workbook.PICTURE_TYPE_PNG;
}
return Workbook.PICTURE_TYPE_JPEG;
}
/**
* 创建表格样式
*/
public void setDataValidation(Excel attr, Row row, int column) {
if (attr.name().indexOf("注:") >= 0) {
sheet.setColumnWidth(column, 6000);
} else {
// 设置列宽
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
}
// 如果设置了提示信息则鼠标放上去提示.
if (StringUtils.isNotEmpty(attr.prompt())) {
// 这里默认设了2-101列提示.
setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
}
// 如果设置了combo属性则本列只能选择不能输入
if (attr.combo().length > 0) {
// 这里默认设了2-101列只能选择不能输入.
setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
}
}
/**
* 添加单元格
*/
public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
Cell cell = null;
try {
// 设置行高
row.setHeight(maxHeight);
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport()) {
String dictType = attr.dictType();
// 创建cell
cell = row.createCell(column);
cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor())));
// 用于读取对象中的属性
Object value = getTargetValue(vo, field, attr);
String dateFormat = attr.dateFormat();
String readConverterExp = attr.readConverterExp();
String separator = attr.separator();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) {
cell.setCellValue(parseDateToStr(dateFormat, value));
} else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) {
cell.setCellValue(getDictLabelByTypeAndValue(String.valueOf(value), dictType));
} else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) {
cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator));
} else if (value instanceof BigDecimal && -1 != attr.scale()) {
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue());
} else if (!attr.handler().equals(ExcelHandlerAdapter.class)) {
cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell));
} else {
// 设置列类型
setCellVo(value, attr, cell);
}
addStatisticsData(column, Convert.toStr(value), attr);
}
} catch (Exception e) {
log.error("导出Excel失败{}", e);
}
return cell;
}
/**
* 格式化不同类型的日期对象
*
* @param dateFormat 日期格式
* @param val 被格式化的日期对象
* @return 格式化后的日期字符
*/
public String parseDateToStr(String dateFormat, Object val) {
if (val == null) {
return "";
}
String str;
if (val instanceof Date) {
str = DateUtils.parseDateToStr(dateFormat, (Date) val);
} else if (val instanceof LocalDateTime) {
str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val));
} else if (val instanceof LocalDate) {
str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val));
} else {
str = val.toString();
}
return str;
}
/**
* 根据指定的type value 获取 label
*
* @param value
* @param dictType
* @return
* @throws Exception
*/
public static String getDictLabelByTypeAndValue(String value, String dictType) throws Exception {
String label = value;
try {
label = DictUtils.getDictLabelByTypeAndValue(value, dictType, value);
} catch (Exception e) {
throw e;
}
return label;
}
/**
* 数据处理器
*
* @param value 数据值
* @param excel 数据注解
* @return
*/
public String dataFormatHandlerAdapter(Object value, Excel excel, Cell cell) {
try {
Object instance = excel.handler().newInstance();
Method formatMethod = excel.handler().getMethod("format", new Class[]{Object.class, String[].class, Cell.class, Workbook.class});
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
} catch (Exception e) {
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
}
return Convert.toStr(value);
}
/**
* 设置 POI XSSFSheet 单元格提示
*
* @param sheet 表单
* @param promptTitle 提示标题
* @param promptContent 提示内容
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
*/
public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
DataValidation dataValidation = helper.createValidation(constraint, regions);
dataValidation.createPromptBox(promptTitle, promptContent);
dataValidation.setShowPromptBox(true);
sheet.addValidationData(dataValidation);
}
/**
* 设置某些列的值只能输入预制的数据,显示下拉框.
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
* @return 设置好的sheet.
*/
public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
// 加载下拉列表内容
DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
// 数据有效性对象
DataValidation dataValidation = helper.createValidation(constraint, regions);
// 处理Excel兼容性问题
if (dataValidation instanceof XSSFDataValidation) {
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
} else {
dataValidation.setSuppressDropDownArrow(false);
}
sheet.addValidationData(dataValidation);
}
/**
* 解析导出值 0=男,1=女,2=未知
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
* @return 解析后值
*/
public static String convertByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(separator, propertyValue)) {
for (String value : propertyValue.split(separator)) {
if (itemArray[0].equals(value)) {
propertyString.append(itemArray[1] + separator);
break;
}
}
} else {
if (itemArray[0].equals(propertyValue)) {
return itemArray[1];
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
/**
* 反向解析值 男=0,女=1,未知=2
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
* @return 解析后值
*/
public static String reverseByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(separator, propertyValue)) {
for (String value : propertyValue.split(separator)) {
if (itemArray[1].equals(value)) {
propertyString.append(itemArray[0] + separator);
break;
}
}
} else {
if (itemArray[1].equals(propertyValue)) {
return itemArray[0];
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
/**
* 合计统计信息
*/
private void addStatisticsData(Integer index, String text, Excel entity) {
if (entity != null && entity.isStatistics()) {
Double temp = 0D;
if (!statistics.containsKey(index)) {
statistics.put(index, temp);
}
try {
temp = Double.valueOf(text);
} catch (NumberFormatException e) {
}
statistics.put(index, statistics.get(index) + temp);
}
}
/**
* 创建统计行
*/
public void addStatisticsRow() {
if (statistics.size() > 0) {
Cell cell = null;
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
Set<Integer> keys = statistics.keySet();
cell = row.createCell(0);
cell.setCellStyle(styles.get("total"));
cell.setCellValue("合计");
for (Integer key : keys) {
cell = row.createCell(key);
cell.setCellStyle(styles.get("total"));
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
}
statistics.clear();
}
}
/**
* 获取bean中的属性值
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
* @return 最终的属性值
* @throws Exception
*/
private Object getTargetValue(T vo, Field field, Excel excel) throws Exception {
Object o = field.get(vo);
if (StringUtils.isNotEmpty(excel.targetAttr())) {
String target = excel.targetAttr();
if (target.indexOf(".") > -1) {
String[] targets = target.split("[.]");
for (String name : targets) {
o = getValue(o, name);
}
} else {
o = getValue(o, target);
}
}
return o;
}
/**
* 以类的属性的get方法方法形式获取值
*
* @param o
* @param name
* @return value
* @throws Exception
*/
private Object getValue(Object o, String name) throws Exception {
if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) {
Class<?> clazz = o.getClass();
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
o = field.get(o);
}
return o;
}
/**
* 得到所有定义字段
*/
private void createExcelField() {
this.fields = new ArrayList<Object[]>();
List<Field> tempFields = new ArrayList<>();
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
for (Field field : tempFields) {
// 单注解
if (field.isAnnotationPresent(Excel.class)) {
putToField(field, field.getAnnotation(Excel.class));
}
// 多注解
if (field.isAnnotationPresent(Excels.class)) {
Excels attrs = field.getAnnotation(Excels.class);
Excel[] excels = attrs.value();
for (Excel excel : excels) {
putToField(field, excel);
}
}
}
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
this.maxHeight = getRowHeight();
}
/**
* 根据注解获取最大行高
*/
public short getRowHeight() {
double maxHeight = 0;
for (Object[] os : this.fields) {
Excel excel = (Excel) os[1];
maxHeight = maxHeight > excel.height() ? maxHeight : excel.height();
}
return (short) (maxHeight * 20);
}
/**
* 放到字段集合中
*/
private void putToField(Field field, Excel attr) {
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
this.fields.add(new Object[]{field, attr});
}
}
/**
* 创建一个工作簿
*/
public void createWorkbook() {
this.wb = new SXSSFWorkbook(500);
}
/**
* 创建工作表
*
* @param sheetNo sheet数量
* @param index 序号
*/
public void createSheet(double sheetNo, int index) {
this.sheet = wb.createSheet();
this.styles = createStyles(wb);
// 设置工作表的名称.
if (sheetNo == 0) {
wb.setSheetName(index, sheetName);
} else {
wb.setSheetName(index, sheetName + index);
}
}
/**
* 创建工作表
*
* @param index 序号
*/
public void createSheetManySheet(int index) {
this.sheet = wb.createSheet();
this.styles = createStyles(wb);
wb.setSheetName(index, sheetName);
}
/**
* 获取单元格值
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
*/
public Object getCellValue(Row row, int column) {
if (row == null) {
return row;
}
Object val = "";
try {
Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell)) {
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
} else {
if ((Double) val % 1 != 0) {
val = new BigDecimal(val.toString());
} else {
val = new DecimalFormat("0").format(val);
}
}
} else if (cell.getCellType() == CellType.STRING) {
val = cell.getStringCellValue();
} else if (cell.getCellType() == CellType.BOOLEAN) {
val = cell.getBooleanCellValue();
} else if (cell.getCellType() == CellType.ERROR) {
val = cell.getErrorCellValue();
}
}
} catch (Exception e) {
return val;
}
return val;
}
}

View File

@ -0,0 +1,84 @@
package com.mosty.common.config.config;
import com.mosty.common.base.util.SpringIocContext;
import com.mosty.common.config.constant.enums.DictElementEnum;
import lombok.Data;
import lombok.SneakyThrows;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.lang.reflect.Field;
/**
* 字典组件编码配置
* @author kevin
* @date 2022/2/10 11:08 PM
* @since 1.0.0
*/
@Data
@Configuration
public class DictElementConfig {
/** 民族 */
@Value("${dict.element.nation:nation}")
private String nation;
/** 性别 */
@Value("${dict.element.gender:gender}")
private String gender;
/** 血型 */
@Value("${dict.element.blood-type:bloodType}")
private String bloodType;
/** 学历 */
@Value("${dict.element.education:education}")
private String education;
/** 政治面貌 */
@Value("${dict.element.political-outlook:politicalOutlook}")
private String politicalOutlook;
/** 婚姻状况 */
@Value("${dict.element.marital-status:maritalStatus}")
private String maritalStatus;
/** 亲属关系 */
@Value("${dict.element.relationship:relationship}")
private String relationship;
/** 车辆型号 */
@Value("${dict.element.vehicle-model:vehicleModel}")
private String vehicleModel;
/** 车辆颜色 */
@Value("${dict.element.vehicle-color:vehicleColor}")
private String vehicleColor;
/** 机动车号牌种类 */
@Value("${dict.element.vehicle-number-type:vehicleNumberType}")
private String vehicleNumberType;
/** 车牌号 */
@Value("${dict.element.car-number:carNumber}")
private String carNumber;
/** 权限列表 */
@Value("${dict.element.permission-list:permissionList}")
private String permissionList;
/**
* 获取当前字典的编码
* @param elementEnum 组件类型枚举
* @return 组件字典编码
*/
@SneakyThrows
public static String getDictCode(DictElementEnum elementEnum) {
String code = elementEnum.code;
DictElementConfig config = SpringIocContext.getBean(DictElementConfig.class);
Field codeField = DictElementConfig.class.getDeclaredField(code);
return (String)codeField.get(config);
}
}

View File

@ -0,0 +1,21 @@
package com.mosty.common.config.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* 系统配置
* @author kevin
* @date 2022/3/22 10:22 PM
* @since 1.0.0
*/
@Data
@Configuration
public class SystemConfig {
/** 密码登陆 */
@Value("${config.defaultPassword:123456}")
private String defaultPassword;
}

View File

@ -0,0 +1,39 @@
package com.mosty.common.config.constant.enums;
import lombok.AllArgsConstructor;
/**
* 字典组件枚举
* @author kevin
* @date 2022/2/10 10:33 PM
* @since 1.0.0
*/
@AllArgsConstructor
public enum DictElementEnum {
NATION("nation", "民族"),
GENDER("gender", "性别"),
BLOOD_TYPE("bloodType", "血型"),
EDUCATION("education", "学历"),
POLITICAL_OUTLOOK("politicalOutlook", "政治面貌"),
MARITAL_STATUS("maritalStatus", "婚姻状况"),
RELATIONSHIP("relationship", "亲属关系"),
VEHICLE_MODEL("vehicleModel", "车辆型号"),
VEHICLE_COLOR("vehicleColor", "车辆颜色"),
VEHICLE_NUMBER_TYPE("vehicleNumberType", "机动车号牌种类"),
CAR_NUMBER("carNumber", "车牌号"),
PERMISSION_LIST("permissionList", "车牌号"),
;
/**
* 字典编码
*/
public final String code;
/**
* 字典描述
*/
public final String desc;
}

View File

@ -0,0 +1,163 @@
package com.mosty.common.config.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.exception.Asserts;
import com.mosty.common.base.util.IpUtil;
import com.mosty.common.config.entity.SysConfig;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.vo.AddSysConfigVO;
import com.mosty.common.config.entity.vo.ConfigPage;
import com.mosty.common.config.entity.vo.DeleteVO;
import com.mosty.common.config.entity.vo.EditSysConfigVO;
import com.mosty.common.config.service.SysConfigService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
/**
* <p>
* 参数配置表 前端控制器
* </p>
*
* @author kevin
* @since 2022-02-10
*/
@RestController
@AllArgsConstructor
@SuppressWarnings("unused")
@RequestMapping("/sys-config")
@Api(tags = "系统配置接口")
public class SysConfigController {
private final SysConfigService sysConfigService;
/**
* 添加系统配置
* @param addSysConfigVO 添加系统配置请求
* @return 添加结果
*/
@JwtSysUser
@PostMapping("addSysConfig")
@Log(title = "系统配置功能", businessType = BusinessType.INSERT)
@ApiOperation(value = "添加系统配置", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> addSysConfig(@RequestBody @Valid AddSysConfigVO addSysConfigVO) {
SysConfig sysConfig = new SysConfig();
sysConfig.setPzj(addSysConfigVO.getPzj());
sysConfig.setPzz(addSysConfigVO.getPzz());
sysConfig.setPzmc(addSysConfigVO.getPzmc());
sysConfig.setBz(addSysConfigVO.getBz());
UserInfo userInfo = UserInfoManager.get();
sysConfig.setXtZxbz(DeletedEnum.NATURE.code);
sysConfig.setXtCjsj(new Date());
sysConfig.setXtZhxgsj(new Date());
sysConfig.setXtZhxgrid(userInfo.getUserId().toString());
sysConfig.setXtZhxgrxm(userInfo.getUserName());
sysConfig.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysConfig.setXtZhxgrbm(userInfo.getDeptName());
sysConfig.setXtLrsj(new Date());
sysConfig.setXtLrrid(userInfo.getUserId().toString());
sysConfig.setXtLrrxm(userInfo.getUserName());
sysConfig.setXtLrrbmid(userInfo.getDeptId().toString());
sysConfig.setXtLrrbm(userInfo.getDeptName());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
sysConfig.setXtLrip(ipAddress);
sysConfig.setXtZhxgip(ipAddress);
sysConfigService.getBaseMapper().insert(sysConfig);
return ResponseResult.success(Boolean.TRUE);
}
/**
* 修改系统配置
* @param editSysConfigVo 系统配置修改请求
* @return 修改结果
*/
@JwtSysUser
@PostMapping("updateSysConfig")
@Log(title = "系统配置功能", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改系统配置信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> updateSysConfig(@RequestBody @Valid EditSysConfigVO editSysConfigVo) {
Asserts.check(editSysConfigVo.getId() == null, "主键id不能为空");
SysConfig oldSysConfig = sysConfigService.getBaseMapper().selectById(editSysConfigVo.getId());
Asserts.check(oldSysConfig == null, "主键为 %s 的系统配置不存在", editSysConfigVo.getId());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
oldSysConfig.setXtZhxgip(ipAddress);
oldSysConfig.setPzj(editSysConfigVo.getPzj());
oldSysConfig.setPzz(editSysConfigVo.getPzz());
oldSysConfig.setPzmc(editSysConfigVo.getPzmc());
oldSysConfig.setBz(editSysConfigVo.getBz());
UserInfo userInfo = UserInfoManager.get();
oldSysConfig.setXtZhxgsj(new Date());
oldSysConfig.setXtZhxgrid(userInfo.getUserId().toString());
oldSysConfig.setXtZhxgrxm(userInfo.getUserName());
oldSysConfig.setXtZhxgrbmid(userInfo.getDeptId().toString());
oldSysConfig.setXtZhxgrbm(userInfo.getDeptName());
sysConfigService.getBaseMapper().updateById(oldSysConfig);
return ResponseResult.success(Boolean.TRUE);
}
/**
* 删除系统配置信息
* @param deleteVO 系统配置信息
* @return 删除结果
*/
@JwtSysUser
@PostMapping("deleteSysConfig")
@Log(title = "系统配置功能", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除系统配置信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> deleteSysConfig(@RequestBody DeleteVO deleteVO) {
SysConfig oldSysConfig = sysConfigService.getBaseMapper().selectById(deleteVO.getId());
Asserts.check(oldSysConfig == null, "主键为 %s 的系统配置信息不存在", deleteVO.getId());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
oldSysConfig.setXtZhxgip(ipAddress);
UserInfo userInfo = UserInfoManager.get();
oldSysConfig.setXtZhxgsj(new Date());
oldSysConfig.setXtZhxgrid(userInfo.getUserId().toString());
oldSysConfig.setXtZhxgrxm(userInfo.getUserName());
oldSysConfig.setXtZhxgrbmid(userInfo.getDeptId().toString());
oldSysConfig.setXtZhxgrbm(userInfo.getDeptName());
oldSysConfig.setXtZxbz(DeletedEnum.DELETED.code);
oldSysConfig.setXtZxyy(deleteVO.getZxyy());
sysConfigService.getBaseMapper().updateById(oldSysConfig);
return ResponseResult.success(Boolean.TRUE);
}
@GetMapping("selectPage")
@ApiOperation(value = "分页查询系统配置信息", httpMethod = "GET", response = SysConfig.class)
public ResponseResult<IPage<SysConfig>> selectPage(ConfigPage configPage) {
IPage<SysConfig> userIPage = sysConfigService.selectByPage(configPage);
return ResponseResult.success(userIPage);
}
}

View File

@ -0,0 +1,323 @@
package com.mosty.common.config.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.db.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.google.common.collect.Lists;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.base.constant.enums.DictTypeEnum;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.exception.Asserts;
import com.mosty.common.base.util.IpUtil;
import com.mosty.common.config.Excel.DictUtils;
import com.mosty.common.config.config.DictElementConfig;
import com.mosty.common.config.constant.enums.DictElementEnum;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.SysDictItem;
import com.mosty.common.config.entity.vo.*;
import com.mosty.common.config.service.SysDictItemService;
import com.mosty.common.config.service.SysDictService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import static com.mosty.common.config.config.DictElementConfig.getDictCode;
/**
* <p>
* 字典类别配置表 前端控制器
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@SuppressWarnings("unused")
@RestController
@AllArgsConstructor
@RequestMapping("/sysDict")
@Api(tags = "字典接口")
@Slf4j
public class SysDictController {
private final SysDictService sysDictService;
private final SysDictItemService sysDictItemService;
private final DictElementConfig dictElementConfig;
/**
* 添加字典信息
*
* @param addSysDictVO 字典对象
* @return 添加结果
*/
@JwtSysUser
@PostMapping("addSysDict")
@Log(title = "字典功能", businessType = BusinessType.INSERT)
@ApiOperation(value = "添加字典信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> addSysDict(@RequestBody @Valid AddSysDictVO addSysDictVO) {
SysDict sysDict = new SysDict();
sysDict.setZdmc(addSysDictVO.getZdmc());
sysDict.setZdywlb(addSysDictVO.getZdywlb());
sysDict.setZdbh(addSysDictVO.getZdbh());
sysDict.setYybz(addSysDictVO.getYybz());
sysDict.setBz(addSysDictVO.getBz());
sysDict.setZdlx(addSysDictVO.getZdlx());
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息不存在");
Asserts.checkAuth(userInfo.getDeptId() == null, "用户部门信息不存在");
Asserts.checkAuth(userInfo.getUserId() == null, "用户id信息不存在");
sysDict.setXtZxbz(DeletedEnum.NATURE.code);
sysDict.setXtZhxgsj(new Date());
sysDict.setXtZhxgrid(userInfo.getUserId().toString());
sysDict.setXtZhxgrxm(userInfo.getUserName());
sysDict.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysDict.setXtZhxgrbm(userInfo.getDeptName());
sysDict.setXtCjsj(new Date());
sysDict.setXtLrsj(new Date());
sysDict.setXtLrrid(userInfo.getUserId().toString());
sysDict.setXtLrrxm(userInfo.getUserName());
sysDict.setXtLrrbmid(userInfo.getDeptId().toString());
sysDict.setXtLrrbm(userInfo.getDeptName());
SysDict one = sysDictService.getOne(new LambdaQueryWrapper<SysDict>()
.eq(SysDict::getZdbh, sysDict.getZdbh()));
Asserts.check(Objects.nonNull(one), "当前字典编码已经存在!");
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
sysDict.setXtLrip(ipAddress);
sysDict.setXtZhxgip(ipAddress);
int insert = sysDictService.getBaseMapper().insert(sysDict);
if (insert > 0) {
DictUtils.setDictCache(sysDict.getZdbh(), null);
}
return ResponseResult.success(Boolean.TRUE);
}
/**
* 修改字典信息
*
* @param editSysDictVo 字典对象
* @return 添加结果
*/
@JwtSysUser
@PostMapping("updateSysDict")
@Log(title = "字典功能", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改字典信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> updateSysDict(@RequestBody @Valid EditSysDictVO editSysDictVo,
HttpServletRequest servletRequest) {
Asserts.check(editSysDictVo.getId() == null, "主键id不能为空");
SysDict oldSysDict = sysDictService.getBaseMapper().selectById(editSysDictVo.getId());
Asserts.check(oldSysDict == null, "主键为 %s 的字典信息不存在", editSysDictVo.getId());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
oldSysDict.setXtZhxgip(ipAddress);
oldSysDict.setZdmc(editSysDictVo.getZdmc());
oldSysDict.setZdywlb(editSysDictVo.getZdywlb());
oldSysDict.setZdbh(editSysDictVo.getZdbh());
oldSysDict.setYybz(editSysDictVo.getYybz());
oldSysDict.setBz(editSysDictVo.getBz());
oldSysDict.setZdlx(editSysDictVo.getZdlx());
oldSysDict.setXtZxbz(editSysDictVo.getXtZxbz());
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息不存在");
Asserts.checkAuth(userInfo.getDeptId() == null, "用户部门信息不存在");
Asserts.checkAuth(userInfo.getUserId() == null, "用户id信息不存在");
oldSysDict.setXtZhxgsj(new Date());
oldSysDict.setXtZhxgrid(userInfo.getUserId().toString());
oldSysDict.setXtZhxgrxm(userInfo.getUserName());
oldSysDict.setXtZhxgrbmid(userInfo.getDeptId().toString());
oldSysDict.setXtZhxgrbm(userInfo.getDeptName());
int i = sysDictService.getBaseMapper().updateById(oldSysDict);
if (i > 0) {
List<SysDictItem> dictDatas = this.sysDictItemService.getBaseMapper().selectList(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getXtZxbz, 0)
.eq(SysDictItem::getZdbh, oldSysDict.getZdbh())
);
DictUtils.setDictCache(oldSysDict.getZdbh(), dictDatas);
}
return ResponseResult.success(Boolean.TRUE);
}
/**
* 修改字典信息
*
* @param deleteVO 字典删除信息
* @return 删除结果
*/
@JwtSysUser
@PostMapping("deleteSysDict")
@Log(title = "字典功能", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除字典信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> deleteSysDict(@RequestBody DeleteVO deleteVO,
HttpServletRequest servletRequest) {
SysDict oldSysDict = sysDictService.getBaseMapper().selectById(deleteVO.getId());
Asserts.check(oldSysDict == null, "主键为 %s 的字典信息不存在", deleteVO.getId());
QueryWrapper<SysDictItem> childQuery = new QueryWrapper<>();
childQuery.and(wrapper -> wrapper.eq("zd_id", oldSysDict.getId()));
childQuery.and(wrapper -> wrapper.eq("xt_zxbz", DeletedEnum.NATURE.code));
List<SysDictItem> list = sysDictItemService.list(childQuery);
Asserts.check(CollectionUtils.isNotEmpty(list), "当前节点下有子节点,请先删除子节点!");
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
oldSysDict.setXtZhxgip(ipAddress);
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息不存在");
Asserts.checkAuth(userInfo.getDeptId() == null, "用户部门信息不存在");
Asserts.checkAuth(userInfo.getUserId() == null, "用户id信息不存在");
oldSysDict.setXtZhxgsj(new Date());
oldSysDict.setXtZhxgrid(userInfo.getUserId().toString());
oldSysDict.setXtZhxgrxm(userInfo.getUserName());
oldSysDict.setXtZhxgrbmid(userInfo.getDeptId().toString());
oldSysDict.setXtZhxgrbm(userInfo.getDeptName());
oldSysDict.setXtZxbz(DeletedEnum.DELETED.code);
oldSysDict.setXtZxyy(deleteVO.getZxyy());
sysDictService.getBaseMapper().updateById(oldSysDict);
//删除缓存
DictUtils.removeDictCache(oldSysDict.getZdbh());
return ResponseResult.success(Boolean.TRUE);
}
/**
* 根据字典编号查询字典信息
*
* @return 字典信息
*/
@GetMapping("getSysDictByCode")
@ApiOperation(value = "根据字典编号查询字典信息", httpMethod = "GET", response = SysDictVO.class)
public ResponseResult<SysDictVO> getSysDictByCode(SysDictQueryVo vo) {
Asserts.check(StringUtils.isBlank(vo.getDictCode()), "查询的字典编号不能为空!");
return getSysDictVOResponseResult(vo);
}
/**
* 根据字典组件枚举,查询字典信息
*
* @param dictElementEnum 字典组件枚举
* @return 字典信息
*/
@GetMapping("getElementSysDict")
@ApiOperation(value = "根据字典组件枚举,查询字典信息", httpMethod = "GET", response = SysDictVO.class)
public ResponseResult<SysDictVO> getElementSysDict(DictElementEnum dictElementEnum) {
// 获取组件编码,可以中配置中修改
String dictCode = getDictCode(dictElementEnum);
SysDictQueryVo vo = new SysDictQueryVo();
vo.setDictCode(dictCode);
return getSysDictVOResponseResult(vo);
}
/**
* 根据字典编码获取字典信息
*
* @return 字典信息
*/
private ResponseResult<SysDictVO> getSysDictVOResponseResult(SysDictQueryVo vo) {
QueryWrapper<SysDict> dictWrapper = new QueryWrapper<>();
dictWrapper.and(wrapper -> wrapper.eq("zdbh", vo.getDictCode()));
SysDict sysDict = sysDictService.getOne(dictWrapper);
Asserts.check(sysDict == null, "字典编号 %s 对应的字典不存在", vo.getDictCode());
SysDictVO sysDictVO = new SysDictVO();
BeanUtil.copyProperties(sysDict, sysDictVO, true);
//先查redis
List<SysDictItem> list = DictUtils.getDictCache(vo.getDictCode());
if (!CollectionUtils.isEmpty(list)) {
if (StringUtils.isNotBlank(vo.getZdmc())) {
list = list.stream().filter(v -> v.getZdmc().contains(vo.getZdmc())).collect(Collectors.toList());
}
} else {
QueryWrapper<SysDictItem> dictItemWrapper = new QueryWrapper<>();
dictItemWrapper.and(wrapper -> wrapper.eq("zdbh", vo.getDictCode()));
dictItemWrapper.and(wrapper -> wrapper.eq("xt_zxbz", DeletedEnum.NATURE.code)
.like(StringUtils.isNotBlank(vo.getZdmc()), "zdmc", vo.getZdmc()))
.orderByAsc("dm");
list = sysDictItemService.list(dictItemWrapper);
}
if (DictTypeEnum.NATURE.code.equals(sysDict.getZdlx())) {
int expectedSize = CollectionUtils.isEmpty(list) ? 2 : list.size();
List<SysDictItemVO> itemList = Lists.newArrayListWithExpectedSize(expectedSize);
if (CollectionUtils.isNotEmpty(list)) {
itemList = BeanUtil.copyToList(list, SysDictItemVO.class);
}
sysDictVO.setItemList(itemList);
} else {
if (CollectionUtils.isNotEmpty(list)) {
List<SysDictItemVO> natureList = list.stream().filter(dept -> DeletedEnum.NATURE.code.equals(dept.getXtZxbz()))
.map(dept -> BeanUtil.copyProperties(dept, SysDictItemVO.class)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(natureList)) {
// 递归树
wrapChildList(sysDictVO, null, natureList);
}
}
}
return ResponseResult.success(sysDictVO);
}
@GetMapping("selectPage")
@ApiOperation(value = "分页查询字典信息", httpMethod = "GET", response = SysDict.class)
public ResponseResult<IPage<SysDict>> selectPage(DictPage dictPage) {
IPage<SysDict> userIPage = sysDictService.selectByPage(dictPage);
return ResponseResult.success(userIPage);
}
/**
* 递归组装字典信息
*
* @param sysDictVO 字典信息
* @param sysDictItemVO 字典明细信息
* @param natureList 所有字典信息
*/
public void wrapChildList(SysDictVO sysDictVO, SysDictItemVO sysDictItemVO, List<SysDictItemVO> natureList) {
Long rootId = sysDictVO != null ? sysDictVO.getId() : sysDictItemVO.getId();
List<SysDictItemVO> collect = natureList.stream().filter(dept -> rootId.equals(dept.getZdId()))
.sorted(Comparator.comparing(SysDictItemVO::getPx).reversed()).collect(Collectors.toList());
if (sysDictVO != null) {
sysDictVO.setItemList(collect);
} else {
sysDictItemVO.setItemList(collect);
}
if (CollectionUtils.isNotEmpty(collect)) {
collect.forEach(dictItem -> wrapChildList(null, dictItem, natureList));
}
}
}

View File

@ -0,0 +1,321 @@
package com.mosty.common.config.controller;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.exception.Asserts;
import com.mosty.common.base.util.ChineseCharacterUtil;
import com.mosty.common.base.util.IpUtil;
import com.mosty.common.config.Excel.DictUtils;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.SysDictItem;
import com.mosty.common.config.entity.vo.*;
import com.mosty.common.config.service.SysDictItemService;
import com.mosty.common.config.service.SysDictService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 字典代码值表 前端控制器
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@SuppressWarnings("unused")
@RestController
@AllArgsConstructor
@RequestMapping("/sys-dict-item")
@Api(tags = "字典明细接口")
public class SysDictItemController {
private final SysDictService sysDictService;
private final SysDictItemService sysDictItemService;
/**
* 根据字典明细编号查询子字典明细信息
*
* @param dictItemCode 字典明细编码
* @return 字典信息
*/
@GetMapping("getChildItemByCode")
@ApiOperation(value = "根据字典明细编号查询子字典明细信息", httpMethod = "GET", response = SysDictItemVO.class)
public ResponseResult<List<SysDictItemVO>> getChildItemByCode(String dictItemCode) {
SysDictItem sysDictItem = checkAndGetItem(dictItemCode);
QueryWrapper<SysDictItem> queryChildWrapper = new QueryWrapper<>();
queryChildWrapper.eq("zd_id", sysDictItem.getId());
List<SysDictItem> list = sysDictItemService.list(queryChildWrapper);
if (CollectionUtils.isEmpty(list)) {
return ResponseResult.success(Lists.newArrayList());
}
List<SysDictItemVO> sysDictItemVOS = BeanUtil.copyToList(list, SysDictItemVO.class);
List<SysDictItemVO> collect = sysDictItemVOS.stream().sorted(Comparator.comparing(SysDictItemVO::getPx).reversed()).collect(Collectors.toList());
return ResponseResult.success(collect);
}
/**
* 根据字典明细编号,查询所有子字典明细信息
*
* @param dictItemCode 字典明细编码
* @return 字典信息
*/
@GetMapping("getAllChildItemByCode")
@ApiOperation(value = "根据字典明细编号,查询所有子字典明细信息", httpMethod = "GET", response = SysDictItemVO.class)
public ResponseResult<List<SysDictItemVO>> getAllChildItemByCode(String dictItemCode) {
SysDictItem sysDictItem = checkAndGetItem(dictItemCode);
SysDictItemVO sysDictItemVO = BeanUtil.copyProperties(sysDictItem, SysDictItemVO.class);
QueryWrapper<SysDictItem> queryChildWrapper = new QueryWrapper<>();
queryChildWrapper.eq("root_path", sysDictItem.getRootPath());
List<SysDictItem> allDict = sysDictItemService.list(queryChildWrapper);
List<SysDictItemVO> resultList = Lists.newArrayList();
if (CollectionUtils.isEmpty(allDict)) {
return ResponseResult.success(resultList);
}
List<SysDictItemVO> natureList = allDict.stream().filter(dept -> DeletedEnum.NATURE.code.equals(dept.getXtZxbz()))
.map(dept -> BeanUtil.copyProperties(dept, SysDictItemVO.class)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(natureList)) {
// 递归组织组织机构树
wrapChildList(sysDictItemVO, natureList);
}
return ResponseResult.success(sysDictItemVO.getItemList());
}
/**
* 递归组装字典信息
*
* @param sysDictItemVO 字典明细信息
* @param natureList 所有字典信息
*/
public void wrapChildList(SysDictItemVO sysDictItemVO, List<SysDictItemVO> natureList) {
Long rootId = sysDictItemVO.getId();
List<SysDictItemVO> collect = natureList.stream().filter(dept -> rootId.equals(dept.getZdId()))
.sorted(Comparator.comparing(SysDictItemVO::getPx).reversed()).collect(Collectors.toList());
sysDictItemVO.setItemList(collect);
if (CollectionUtils.isNotEmpty(collect)) {
collect.forEach(dictItem -> wrapChildList(dictItem, natureList));
}
}
/**
* 检查并获取字典明细信息
*
* @param dictItemCode 字典明细编码
*/
private SysDictItem checkAndGetItem(String dictItemCode) {
Asserts.check(StringUtils.isBlank(dictItemCode), "查询的字典明细编码不能为空!");
QueryWrapper<SysDictItem> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("zdbh", dictItemCode);
SysDictItem sysDictItem = sysDictItemService.getOne(queryWrapper);
Asserts.check(sysDictItem == null || DeletedEnum.DELETED.code.equals(sysDictItem.getXtZxbz()),
"字典编码对应的字典不存在或已删除");
return sysDictItem;
}
/**
* 添加字典明细信息
*
* @param addDictItemVo 字典明细信息对象
* @return 添加结果
*/
@JwtSysUser
@PostMapping("addSysDictItem")
@Log(title = "字典明细功能", businessType = BusinessType.INSERT)
@ApiOperation(value = "添加字典明细信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> addSysDictItem(@RequestBody @Valid AddDictItemVO addDictItemVo,
HttpServletRequest servletRequest) {
Long parentId = addDictItemVo.getParentId();
SysDict sysDict = sysDictService.getById(parentId);
String rootPath = null;
if (sysDict == null) {
SysDictItem sysDictItem = sysDictItemService.getById(parentId);
Asserts.check(sysDictItem == null, "传入的父id对应的字典信息不存在");
rootPath = sysDictItem.getRootPath() + "_";
addDictItemVo.setZdbh(sysDictItem.getZdbh());
} else {
rootPath = sysDict.getId() + "_";
addDictItemVo.setZdbh(sysDict.getZdbh());
}
//拼音
addDictItemVo.setPy(ChineseCharacterUtil.getUpperCase(addDictItemVo.getZdmc(), false));
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
sysDictItemService.addSysDictItem(addDictItemVo, rootPath, ipAddress);
return ResponseResult.success(Boolean.TRUE);
}
@GetMapping("selectPage")
@ApiOperation(value = "", httpMethod = "GET", response = SysDictVO.class)
public ResponseResult<IPage<SysDictItem>> selectPageDict(SysDictQueryPage vo) {
Asserts.check(StringUtils.isBlank(vo.getDictCode()), "查询的字典编号不能为空!");
LambdaQueryWrapper<SysDictItem> wrapper = new LambdaQueryWrapper<SysDictItem>()
.like(StringUtils.isNotBlank(vo.getZdmc()), SysDictItem::getZdmc, vo.getZdmc())
.eq(StringUtils.isNotBlank(vo.getDictCode()), SysDictItem::getZdbh, vo.getDictCode())
.eq(SysDictItem::getXtZxbz, "0");
return ResponseResult.success(this.sysDictItemService.page(vo, wrapper));
}
/**
* 修改字典明细信息
*
* @param editDictItemVO 字典对象
* @return 修改结果
*/
@JwtSysUser
@PostMapping("updateSysDictItem")
@Log(title = "字典明细功能", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改字典明细信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> updateSysDictItem(@RequestBody @Valid EditDictItemVO editDictItemVO,
HttpServletRequest servletRequest) {
Asserts.check(editDictItemVO.getId() == null, "主键id不能为空");
SysDictItem oldSysDictItem = sysDictItemService.getBaseMapper().selectById(editDictItemVO.getId());
Asserts.check(oldSysDictItem == null, "主键为 %s 的字典明细信息不存在", editDictItemVO.getId());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息为空,请登陆");
oldSysDictItem.setXtZhxgsj(new Date());
oldSysDictItem.setXtZhxgrid(userInfo.getUserId().toString());
oldSysDictItem.setXtZhxgrxm(userInfo.getUserName());
oldSysDictItem.setXtZhxgrbmid(userInfo.getDeptId().toString());
oldSysDictItem.setXtZhxgrbm(userInfo.getDeptName());
oldSysDictItem.setXtZhxgip(ipAddress);
oldSysDictItem.setBz(editDictItemVO.getBz());
oldSysDictItem.setDm(editDictItemVO.getDm());
oldSysDictItem.setPy(editDictItemVO.getPy());
oldSysDictItem.setPx(editDictItemVO.getPx());
oldSysDictItem.setZdbh(editDictItemVO.getZdbh());
oldSysDictItem.setZdmc(editDictItemVO.getZdmc());
oldSysDictItem.setPy(ChineseCharacterUtil.getUpperCase(oldSysDictItem.getZdmc(), false));
int i = sysDictItemService.getBaseMapper().updateById(oldSysDictItem);
if (i > 0) {
List<SysDictItem> dictDatas = this.sysDictItemService.getBaseMapper().selectList(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getXtZxbz, 0)
.eq(SysDictItem::getZdbh, oldSysDictItem.getZdbh())
);
DictUtils.setDictCache(oldSysDictItem.getZdbh(), dictDatas);
}
return ResponseResult.success(Boolean.TRUE);
}
/**
* 修改字典明细信息
*
* @param deleteVO 字典主键
* @return 删除结果
*/
@JwtSysUser
@PostMapping("deleteSysDictItem")
@Log(title = "字典明细功能", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除字典明细信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> deleteSysDictItem(@RequestBody DeleteVO deleteVO, HttpServletRequest servletRequest) {
SysDictItem sysDictItem = sysDictItemService.getBaseMapper().selectById(deleteVO.getId());
Asserts.check(sysDictItem == null, "主键为 %s 的字典明细信息不存在", deleteVO.getId());
QueryWrapper<SysDictItem> childQuery = new QueryWrapper<>();
childQuery.and(wrapper -> wrapper.eq("zd_id", sysDictItem.getId()));
childQuery.and(wrapper -> wrapper.eq("xt_zxbz", DeletedEnum.NATURE.code));
List<SysDictItem> list = sysDictItemService.list(childQuery);
Asserts.check(CollectionUtils.isNotEmpty(list), "当前节点下有子节点,请先删除子节点!");
sysDictItem.setXtZxbz(DeletedEnum.DELETED.code);
sysDictItem.setXtZxyy(deleteVO.getZxyy());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息为空,请登陆");
sysDictItem.setXtZhxgsj(new Date());
sysDictItem.setXtZhxgrid(userInfo.getUserId().toString());
sysDictItem.setXtZhxgrxm(userInfo.getUserName());
sysDictItem.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysDictItem.setXtZhxgrbm(userInfo.getDeptName());
sysDictItem.setXtZhxgip(ipAddress);
int i = sysDictItemService.getBaseMapper().updateById(sysDictItem);
if (i > 0) {
List<SysDictItem> dictDatas = this.sysDictItemService.getBaseMapper().selectList(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getXtZxbz, 0)
.eq(SysDictItem::getZdbh, sysDictItem.getZdbh())
);
DictUtils.setDictCache(sysDictItem.getZdbh(), dictDatas);
}
return ResponseResult.success(Boolean.TRUE);
}
@JwtSysUser
@PostMapping("deleteSysDictItemBatch")
@Log(title = "字典明细功能", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除字典明细信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> deleteSysDictItemBatch(@RequestBody List<Long> ids, HttpServletRequest servletRequest) {
if (!CollectionUtils.isEmpty(ids)) {
for (Long id : ids) {
SysDictItem sysDictItem = sysDictItemService.getBaseMapper().selectById(id);
Asserts.check(sysDictItem == null, "主键为 %s 的字典明细信息不存在", id);
QueryWrapper<SysDictItem> childQuery = new QueryWrapper<>();
childQuery.and(wrapper -> wrapper.eq("zd_id", sysDictItem.getId()));
childQuery.and(wrapper -> wrapper.eq("xt_zxbz", DeletedEnum.NATURE.code));
List<SysDictItem> list = sysDictItemService.list(childQuery);
Asserts.check(CollectionUtils.isNotEmpty(list), "当前节点下有子节点,请先删除子节点!");
sysDictItem.setXtZxbz(DeletedEnum.DELETED.code);
sysDictItem.setXtZxyy(null);
// 获取ip地址
String ipAddress = IpUtil.getIpAddress(servletRequest);
UserInfo userInfo = UserInfoManager.get();
Asserts.checkAuth(userInfo == null, "用户信息为空,请登陆");
sysDictItem.setXtZhxgsj(new Date());
sysDictItem.setXtZhxgrid(userInfo.getUserId().toString());
sysDictItem.setXtZhxgrxm(userInfo.getUserName());
sysDictItem.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysDictItem.setXtZhxgrbm(userInfo.getDeptName());
sysDictItem.setXtZhxgip(ipAddress);
int i = sysDictItemService.getBaseMapper().updateById(sysDictItem);
if (i > 0) {
List<SysDictItem> dictDatas = this.sysDictItemService.getBaseMapper().selectList(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getXtZxbz, 0)
.eq(SysDictItem::getZdbh, sysDictItem.getZdbh())
);
DictUtils.setDictCache(sysDictItem.getZdbh(), dictDatas);
}
}
}
return ResponseResult.success(Boolean.TRUE);
}
}

View File

@ -0,0 +1,168 @@
package com.mosty.common.config.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.exception.Asserts;
import com.mosty.common.base.util.IpUtil;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.SysVersionManage;
import com.mosty.common.config.entity.vo.AddVersionManageVO;
import com.mosty.common.config.entity.vo.EditVersionManageVO;
import com.mosty.common.config.entity.vo.VersionManagePage;
import com.mosty.common.config.service.SysVersionManageService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 版本管理表 前端控制器
* </p>
*
* @author kevin
* @since 2022-02-21
*/
@Slf4j
@AllArgsConstructor
@RestController
@SuppressWarnings("unused")
@RequestMapping("/sys-version-manage")
@Api(tags = "系统版本管理接口")
public class SysVersionManageController {
private final SysVersionManageService sysVersionManageService;
/**
* 添加系统版本管理
* @param addVersionManageVo 添加系统版本管理请求
* @return 添加结果
*/
@JwtSysUser
@PostMapping("addVersionManage")
@Log(title = "系统版本管理功能", businessType = BusinessType.INSERT)
@ApiOperation(value = "添加系统版本管理", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> addVersionManage(@RequestBody @Valid AddVersionManageVO addVersionManageVo) {
SysVersionManage sysVersionManage = new SysVersionManage();
sysVersionManage.setSysVersion(addVersionManageVo.getSysVersion());
sysVersionManage.setPublishTime(addVersionManageVo.getPublishTime());
sysVersionManage.setAddFunction(addVersionManageVo.getAddFunction());
sysVersionManage.setFixBug(addVersionManageVo.getFixBug());
sysVersionManage.setBz(addVersionManageVo.getBz());
UserInfo userInfo = UserInfoManager.get();
sysVersionManage.setXtZxbz(DeletedEnum.NATURE.code);
sysVersionManage.setXtCjsj(LocalDateTime.now());
sysVersionManage.setXtZhxgsj(LocalDateTime.now());
sysVersionManage.setXtZhxgrid(userInfo.getUserId().toString());
sysVersionManage.setXtZhxgrxm(userInfo.getUserName());
sysVersionManage.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysVersionManage.setXtZhxgrbm(userInfo.getDeptName());
sysVersionManage.setXtLrsj(LocalDateTime.now());
sysVersionManage.setXtLrrid(userInfo.getUserId().toString());
sysVersionManage.setXtLrrxm(userInfo.getUserName());
sysVersionManage.setXtLrrbmid(userInfo.getDeptId().toString());
sysVersionManage.setXtLrrbm(userInfo.getDeptName());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
sysVersionManage.setXtLrip(ipAddress);
sysVersionManage.setXtZhxgip(ipAddress);
sysVersionManageService.getBaseMapper().insert(sysVersionManage);
return ResponseResult.success(Boolean.TRUE);
}
/**
* 修改系统版本管理
* @param editVersionManageVo 修改系统版本管理请求
* @return 修改结果
*/
@JwtSysUser
@PostMapping("updateVersionManage")
@Log(title = "系统版本管理功能", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改系统版本管理", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> updateVersionManage(@RequestBody @Valid EditVersionManageVO editVersionManageVo) {
Asserts.check(editVersionManageVo.getId() == null, "主键id不能为空");
SysVersionManage sysVersionManage = sysVersionManageService.getBaseMapper().selectById(editVersionManageVo.getId());
Asserts.check(sysVersionManage == null, "主键为 %s 的系统版本管理信息不存在", editVersionManageVo.getId());
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
sysVersionManage.setXtZhxgip(ipAddress);
sysVersionManage.setSysVersion(editVersionManageVo.getSysVersion());
sysVersionManage.setPublishTime(editVersionManageVo.getPublishTime());
sysVersionManage.setAddFunction(editVersionManageVo.getAddFunction());
sysVersionManage.setFixBug(editVersionManageVo.getFixBug());
sysVersionManage.setBz(editVersionManageVo.getBz());
UserInfo userInfo = UserInfoManager.get();
sysVersionManage.setXtZhxgsj(LocalDateTime.now());
sysVersionManage.setXtZhxgrid(userInfo.getUserId().toString());
sysVersionManage.setXtZhxgrxm(userInfo.getUserName());
sysVersionManage.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysVersionManage.setXtZhxgrbm(userInfo.getDeptName());
sysVersionManageService.getBaseMapper().updateById(sysVersionManage);
return ResponseResult.success(Boolean.TRUE);
}
/**
* 删除系统版本管理信息
* @param id 系统版本管理信息id
* @return 删除结果
*/
@JwtSysUser
@GetMapping("deleteVersionManage")
@Log(title = "系统版本管理功能", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除系统版本管理信息", httpMethod = "POST", response = Boolean.class)
public ResponseResult<Boolean> deleteVersionManage(@RequestParam("id") Long id) {
SysVersionManage sysVersionManage = sysVersionManageService.getBaseMapper().selectById(id);
Asserts.check(sysVersionManage == null, "主键为 %s 的系统版本管理信息不存在", id);
// 获取ip地址
String ipAddress = IpUtil.getIpAddress();
sysVersionManage.setXtZhxgip(ipAddress);
UserInfo userInfo = UserInfoManager.get();
sysVersionManage.setXtZhxgsj(LocalDateTime.now());
sysVersionManage.setXtZhxgrid(userInfo.getUserId().toString());
sysVersionManage.setXtZhxgrxm(userInfo.getUserName());
sysVersionManage.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysVersionManage.setXtZhxgrbm(userInfo.getDeptName());
sysVersionManage.setXtZxbz(DeletedEnum.DELETED.code);
sysVersionManage.setXtZxyy("");
sysVersionManageService.getBaseMapper().updateById(sysVersionManage);
return ResponseResult.success(Boolean.TRUE);
}
@GetMapping("selectPage")
@ApiOperation(value = "分页查询字典信息", httpMethod = "GET", response = SysVersionManage.class)
public ResponseResult<IPage<SysVersionManage>> selectPage(VersionManagePage versionManagePage) {
IPage<SysVersionManage> versionManageIPage = sysVersionManageService.selectByPage(versionManagePage);
return ResponseResult.success(versionManageIPage);
}
}

View File

@ -0,0 +1,93 @@
package com.mosty.common.config.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 参数配置表
* </p>
*
* @author kevin
* @since 2022-02-10
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mosty_base.sys_config")
@ApiModel(value="SysConfig对象", description="参数配置表")
public class SysConfig implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "配置名称")
private String pzmc;
@ApiModelProperty(value = "配置键")
private String pzj;
@ApiModelProperty(value = "配置值")
private String pzz;
@ApiModelProperty(value = "备注")
private String bz;
@ApiModelProperty(value = "采集时间")
private Date xtCjsj;
@ApiModelProperty(value = "录入时间")
private Date xtLrsj;
@ApiModelProperty(value = "录入人姓名")
private String xtLrrxm;
@ApiModelProperty(value = "录入人ID")
private String xtLrrid;
@ApiModelProperty(value = "录入人部门")
private String xtLrrbm;
@ApiModelProperty(value = "录入人部门ID")
private String xtLrrbmid;
@ApiModelProperty(value = "录入IP")
private String xtLrip;
@ApiModelProperty(value = "最后修改时间")
private Date xtZhxgsj;
@ApiModelProperty(value = "最后修改人姓名")
private String xtZhxgrxm;
@ApiModelProperty(value = "最后修改人ID")
private String xtZhxgrid;
@ApiModelProperty(value = "最后修改人部门")
private String xtZhxgrbm;
@ApiModelProperty(value = "最后修改人部门ID")
private String xtZhxgrbmid;
@ApiModelProperty(value = "最后修改IP")
private String xtZhxgip;
@ApiModelProperty(value = "注销标志0正常 1.注销")
private Integer xtZxbz;
@ApiModelProperty(value = "注销原因")
private String xtZxyy;
}

View File

@ -0,0 +1,109 @@
package com.mosty.common.config.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mosty.common.base.constant.enums.DictTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 字典类别配置表
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mosty_base.sys_dict")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="SysDict对象", description="字典类别配置表")
public class SysDict implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "字典名称")
private String zdmc;
/**
* 字典类型
*@see DictTypeEnum
*/
@ApiModelProperty(value = "是否树形字典1、不是列表 2、树形")
private Integer zdlx;
@ApiModelProperty(value = "字典业务类别")
private String zdywlb;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "引用标准")
private String yybz;
@ApiModelProperty(value = "备注")
private String bz;
@ApiModelProperty(value = "采集时间")
private Date xtCjsj;
@ApiModelProperty(value = "录入时间")
private Date xtLrsj;
@ApiModelProperty(value = "录入人姓名")
private String xtLrrxm;
@ApiModelProperty(value = "录入人ID")
private String xtLrrid;
@ApiModelProperty(value = "录入人部门")
private String xtLrrbm;
@ApiModelProperty(value = "录入人部门ID")
private String xtLrrbmid;
@ApiModelProperty(value = "录入IP")
private String xtLrip;
@ApiModelProperty(value = "最后修改时间")
private Date xtZhxgsj;
@ApiModelProperty(value = "最后修改人姓名")
private String xtZhxgrxm;
@ApiModelProperty(value = "最后修改人ID")
private String xtZhxgrid;
@ApiModelProperty(value = "最后修改人部门")
private String xtZhxgrbm;
@ApiModelProperty(value = "最后修改人部门ID")
private String xtZhxgrbmid;
@ApiModelProperty(value = "最后修改IP")
private String xtZhxgip;
@ApiModelProperty(value = "注销标志0正常 1.注销")
private Integer xtZxbz;
@ApiModelProperty(value = "注销原因")
private String xtZxyy;
}

View File

@ -0,0 +1,114 @@
package com.mosty.common.config.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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 字典代码值表
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mosty_base.sys_dict_item")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="SysDictItem对象", description="字典代码值表")
public class SysDictItem implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "字典上级编号")
private Long zdId;
/**
* 根节点开始的id路径
*/
@TableField(value = "root_path")
private String rootPath;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "字典名称")
private String zdmc;
@ApiModelProperty(value = "字典代码")
private String dm;
@ApiModelProperty(value = "字典拼音")
private String py;
@ApiModelProperty(value = "排序字典100在1前面倒序")
private Integer px;
@ApiModelProperty(value = "备注")
private String bz;
@ApiModelProperty(value = "采集时间")
private Date xtCjsj;
@ApiModelProperty(value = "录入时间")
private Date xtLrsj;
@ApiModelProperty(value = "录入人姓名")
private String xtLrrxm;
@ApiModelProperty(value = "录入人ID")
private String xtLrrid;
@ApiModelProperty(value = "录入人部门")
private String xtLrrbm;
@ApiModelProperty(value = "录入人部门ID")
private String xtLrrbmid;
@ApiModelProperty(value = "录入IP")
private String xtLrip;
@ApiModelProperty(value = "最后修改时间")
private Date xtZhxgsj;
@ApiModelProperty(value = "最后修改人姓名")
private String xtZhxgrxm;
@ApiModelProperty(value = "最后修改人ID")
private String xtZhxgrid;
@ApiModelProperty(value = "最后修改人部门")
private String xtZhxgrbm;
@ApiModelProperty(value = "最后修改人部门ID")
private String xtZhxgrbmid;
@ApiModelProperty(value = "最后修改IP")
private String xtZhxgip;
@ApiModelProperty(value = "注销标志0正常 1.注销")
private Integer xtZxbz;
@ApiModelProperty(value = "注销原因")
private String xtZxyy;
}

View File

@ -0,0 +1,100 @@
package com.mosty.common.config.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 版本管理表
* </p>
*
* @author kevin
* @since 2022-02-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mosty_base.sys_version_manage")
@ApiModel(value="SysVersionManage对象", description="版本管理表")
public class SysVersionManage implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "版本")
private String sysVersion;
@ApiModelProperty(value = "发布时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime publishTime;
@ApiModelProperty(value = "新增功能")
private String addFunction;
@ApiModelProperty(value = "修复bug")
private String fixBug;
@ApiModelProperty(value = "备注")
private String bz;
@ApiModelProperty(value = "采集时间")
private LocalDateTime xtCjsj;
@ApiModelProperty(value = "录入时间")
private LocalDateTime xtLrsj;
@ApiModelProperty(value = "录入人姓名")
private String xtLrrxm;
@ApiModelProperty(value = "录入人ID")
private String xtLrrid;
@ApiModelProperty(value = "录入人部门")
private String xtLrrbm;
@ApiModelProperty(value = "录入人部门ID")
private String xtLrrbmid;
@ApiModelProperty(value = "录入IP")
private String xtLrip;
@ApiModelProperty(value = "最后修改时间")
private LocalDateTime xtZhxgsj;
@ApiModelProperty(value = "最后修改人姓名")
private String xtZhxgrxm;
@ApiModelProperty(value = "最后修改人ID")
private String xtZhxgrid;
@ApiModelProperty(value = "最后修改人部门")
private String xtZhxgrbm;
@ApiModelProperty(value = "最后修改人部门ID")
private String xtZhxgrbmid;
@ApiModelProperty(value = "最后修改IP")
private String xtZhxgip;
@ApiModelProperty(value = "注销标志0正常 1.注销")
private Integer xtZxbz;
@ApiModelProperty(value = "注销原因")
private String xtZxyy;
}

View File

@ -0,0 +1,45 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 添加字典信息请求
* @author kevin
* @date 2022/2/20 9:24 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
public class AddDictItemVO {
@NotNull(message = "父节点id不能为空")
@ApiModelProperty(value = "父id 可能是字典表id可能是字典明细表id")
private Long parentId;
@ApiModelProperty(value = "字典编号", hidden = true)
@Size(max = 50,message = "字典编码长度不能超过50")
private String zdbh;
@ApiModelProperty(value = "字典名称")
@Size(max = 100,message = "字典名称长度不能超过50")
private String zdmc;
@ApiModelProperty(value = "字典代码")
@Size(max = 50,message = "字典代码长度不能超过50")
private String dm;
@ApiModelProperty(value = "字典拼音")
private String py;
@ApiModelProperty(value = "排序字典100在1前面倒序")
private Integer px;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,38 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
/**
* 添加岗位信息对象
* @author kevin
* @date 2022/2/21 12:47 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
public class AddPositionVO {
@NotEmpty(message = "岗位编码不能为空")
@ApiModelProperty(value = "岗位编码")
@Size(max = 30,message = "岗位编码长度不能超过50")
private String postCode;
@NotEmpty(message = "岗位名称不能为空")
@ApiModelProperty(value = "岗位名称")
@Size(max = 30,message = "岗位名称长度不能超过50")
private String postName;
@ApiModelProperty(value = "岗位描述")
@Size(max = 200,message = "岗位描述长度不能超过50")
private String postDesc;
@ApiModelProperty(value = "备注")
@Size(max = 200,message = "备注长度不能超过50")
private String bz;
}

View File

@ -0,0 +1,49 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
/**
* 添加系统配置对象
* @author kevin
* @date 2022/2/21 8:13 PM
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "添加系统配置对象")
public class AddSysConfigVO implements Serializable {
private static final long serialVersionUID = 1L;
@NotEmpty(message = "配置名称不能为空")
@ApiModelProperty(value = "配置名称")
@Size(max = 50,message = "配置名称不能超过50")
private String pzmc;
@NotEmpty(message = "配置键不能为空")
@ApiModelProperty(value = "配置键")
@Size(max = 500,message = "配置键长度不能超过500")
private String pzj;
@NotEmpty(message = "配置值不能为空")
@ApiModelProperty(value = "配置值")
@Size(max = 1000,message = "配置键长度不能超过1000")
private String pzz;
@ApiModelProperty(value = "备注")
@Size(max = 200,message = "备注长度不能超过200")
private String bz;
}

View File

@ -0,0 +1,49 @@
package com.mosty.common.config.entity.vo;
import com.mosty.common.base.constant.enums.DictTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 添加字典信息VO
* @author kevin
* @date 2022/2/9 8:20 PM
* @since 1.0.0
*/
@Data
public class AddSysDictVO {
@ApiModelProperty(value = "字典名称")
@NotEmpty(message = "字典名称不能为空")
@Size(max = 50,message = "字典名称长度不能超过50")
private String zdmc;
/**
* 字典类型
*@see DictTypeEnum
*/
@NotNull(message = "字典类型不能为空")
@ApiModelProperty(value = "是否树形字典1、不是列表 2、树形")
private Integer zdlx;
@ApiModelProperty(value = "字典业务类别")
@Size(max = 2,message = "字典业务类别长度不能超过50")
private String zdywlb;
@NotEmpty(message = "字典编号不能为空")
@ApiModelProperty(value = "字典编号")
@Size(max = 50,message = "字典编号长度不能超过50")
private String zdbh;
@ApiModelProperty(value = "引用标准")
private String yybz;
@ApiModelProperty(value = "备注")
@Size(max = 200,message = "备注长度不能超过200")
private String bz;
}

View File

@ -0,0 +1,50 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 添加系统版本管理请求
* @author kevin
* @date 2022/2/21 9:06 PM
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "添加系统版本管理对象")
public class AddVersionManageVO implements Serializable {
/** 序列化标识 */
private static final long serialVersionUID = 8136954123595145099L;
@ApiModelProperty(value = "系统版本管理id")
private Long id;
@ApiModelProperty(value = "版本")
private String sysVersion;
@ApiModelProperty(value = "发布时间")
private LocalDateTime publishTime;
@ApiModelProperty(value = "新增功能")
private String addFunction;
@ApiModelProperty(value = "修复bug")
private String fixBug;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,29 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 分页查询系统配置信息
* @author kevin
* @date 2022/2/9 8:53 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class ConfigPage extends Page {
/**
* 配置名称
*/
private String configName;
/**
* 配置键
*/
private String configKey;
}

View File

@ -0,0 +1,24 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "删除VO")
public class DeleteVO implements Serializable {
@ApiModelProperty(value = "主键id")
@NotNull(message = "主键id不能为空")
private Long id;
@ApiModelProperty(value = "注销原因")
@NotEmpty(message = "注销原因不能为空")
private String zxyy;
}

View File

@ -0,0 +1,34 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 分页查询字典信息
* @author kevin
* @date 2022/2/9 8:53 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class DictPage extends Page {
/**
* 字典名称
*/
private String dictName;
/**
* 字典编码
*/
private String dictCode;
/**
* 删除标志
*/
private Integer xtZxbz;
}

View File

@ -0,0 +1,42 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* 修改字典信息请求
* @author kevin
* @date 2022/2/20 9:24 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
public class EditDictItemVO {
@NotNull(message = "主键id不能为空")
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "字典名称")
private String zdmc;
@ApiModelProperty(value = "字典代码")
private String dm;
@ApiModelProperty(value = "字典拼音")
private String py;
@ApiModelProperty(value = "排序字典100在1前面倒序")
private Integer px;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,38 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* 修改岗位信息对象
* @author kevin
* @date 2022/2/21 12:47 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
public class EditPositionVO {
@NotNull(message = "岗位id不能为空")
@ApiModelProperty(value = "主键id")
private Long id;
@NotEmpty(message = "岗位编码不能为空")
@ApiModelProperty(value = "岗位编码")
private String postCode;
@NotEmpty(message = "岗位名称不能为空")
@ApiModelProperty(value = "岗位名称")
private String postName;
@ApiModelProperty(value = "岗位描述")
private String postDesc;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,47 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 修改系统配置对象
* @author kevin
* @date 2022/2/21 8:13 PM
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "添加系统配置对象")
public class EditSysConfigVO implements Serializable {
/** 序列化标识 */
private static final long serialVersionUID = -3185962159720155709L;
@NotNull(message = "系统配置id不能为空")
@ApiModelProperty("id")
private Long id;
@NotEmpty(message = "配置名称不能为空")
@ApiModelProperty(value = "配置名称")
private String pzmc;
@NotEmpty(message = "配置键不能为空")
@ApiModelProperty(value = "配置键")
private String pzj;
@NotEmpty(message = "配置值不能为空")
@ApiModelProperty(value = "配置值")
private String pzz;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,48 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 修改字典明细信息
* @author kevin
* @date 2022/2/20 5:24 PM
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "字典明细信息")
public class EditSysDictItemVO implements Serializable {
/**
* 序列化标识
*/
private static final long serialVersionUID = -3202056339726922311L;
@NotNull(message = "主键id不能为空")
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "字典名称")
private String zdmc;
@ApiModelProperty(value = "字典代码")
private String dm;
@ApiModelProperty(value = "字典拼音")
private String py;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,51 @@
package com.mosty.common.config.entity.vo;
import com.mosty.common.base.constant.enums.DictTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* 修改字典信息VO
* @author kevin
* @date 2022/2/9 8:20 PM
* @since 1.0.0
*/
@Data
public class EditSysDictVO {
@NotNull(message = "字典id不能为空")
@ApiModelProperty("字典id")
private Long id;
@ApiModelProperty(value = "字典名称")
@NotEmpty(message = "字典名称不能为空")
private String zdmc;
/**
* 字典类型
*@see DictTypeEnum
*/
@NotNull(message = "字典类型不能为空")
@ApiModelProperty(value = "是否树形字典1、不是列表 2、树形")
private Integer zdlx;
@ApiModelProperty(value = "字典业务类别")
private String zdywlb;
@NotEmpty(message = "字典编号不能为空")
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "引用标准")
private String yybz;
@ApiModelProperty(value = "备注")
private String bz;
@ApiModelProperty(value = "注销标志0正常 1.注销")
private Integer xtZxbz;
}

View File

@ -0,0 +1,47 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 修改系统版本管理请求
* @author kevin
* @date 2022/2/21 9:06 PM
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "修改系统版本管理对象")
public class EditVersionManageVO implements Serializable {
/** 序列化标识 */
private static final long serialVersionUID = 4182901351269001103L;
@ApiModelProperty(value = "系统版本管理id")
private Long id;
@ApiModelProperty(value = "版本")
private String sysVersion;
@ApiModelProperty(value = "发布时间")
private LocalDateTime publishTime;
@ApiModelProperty(value = "新增功能")
private String addFunction;
@ApiModelProperty(value = "修复bug")
private String fixBug;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,58 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* <p>
* 字典明细
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="字典信息", description="字典代码值表")
public class SysDictItemVO implements Serializable {
private static final long serialVersionUID=1L;
/**
* 字典明细信息
*/
@ApiModelProperty(value = "字典明细信息")
private List<SysDictItemVO> itemList;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "字典上级编号")
private Long zdId;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "字典名称")
private String zdmc;
@ApiModelProperty(value = "字典代码")
private String dm;
@ApiModelProperty(value = "字典拼音")
private String py;
@ApiModelProperty(value = "排序字典100在1前面倒序")
private Integer px;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,26 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 根据字典编号查询字典信息
* @author kevin
* @date 2022/2/9 8:53 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode
public class SysDictQueryPage extends Page implements Serializable {
// 字典编码
private String dictCode;
// 字典名称
private String zdmc;
}

View File

@ -0,0 +1,26 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 根据字典编号查询字典信息
* @author kevin
* @date 2022/2/9 8:53 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode
public class SysDictQueryVo implements Serializable {
// 字典编码
private String dictCode;
// 字典名称
private String zdmc;
}

View File

@ -0,0 +1,43 @@
package com.mosty.common.config.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 字典信息VO
* @author kevin
* @date 2022/2/9 8:20 PM
* @since 1.0.0
*/
@Data
public class SysDictVO {
/**
* 字典明细信息
*/
private List<SysDictItemVO> itemList;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "字典名称")
private String zdmc;
@ApiModelProperty(value = "是否树形字典1、不是列表 2、树形")
private Integer zdlx;
@ApiModelProperty(value = "字典业务类别")
private String zdywlb;
@ApiModelProperty(value = "字典编号")
private String zdbh;
@ApiModelProperty(value = "引用标准")
private String yybz;
@ApiModelProperty(value = "备注")
private String bz;
}

View File

@ -0,0 +1,34 @@
package com.mosty.common.config.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 版本管理分页请求
* @author kevin
* @date 2022/2/9 8:53 PM
* @since 1.0.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class VersionManagePage extends Page {
/**
* 版本
*/
private String sysVersion;
/**
* 发布开始时间
*/
private String startPublishTime;
/**
* 发布结束时间
*/
private String endPublishTime;
}

View File

@ -0,0 +1,16 @@
package com.mosty.common.config.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.common.config.entity.SysConfig;
/**
* <p>
* 参数配置表 Mapper 接口
* </p>
*
* @author kevin
* @since 2022-02-10
*/
public interface SysConfigMapper extends BaseMapper<SysConfig> {
}

View File

@ -0,0 +1,16 @@
package com.mosty.common.config.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.common.config.entity.SysDictItem;
/**
* <p>
* 字典代码值表 Mapper 接口
* </p>
*
* @author kevin
* @since 2022-02-09
*/
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
}

View File

@ -0,0 +1,21 @@
package com.mosty.common.config.mapper;
//import cn.hutool.db.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mosty.common.config.entity.SysDict;
/**
* <p>
* 字典类别配置表 Mapper 接口
* </p>
*
* @author kevin
* @since 2022-02-09
*/
public interface SysDictMapper extends BaseMapper<SysDict> {
// IPage<SysDict> selectByPage(Page page);
}

View File

@ -0,0 +1,16 @@
package com.mosty.common.config.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.common.config.entity.SysVersionManage;
/**
* <p>
* 版本管理表 Mapper 接口
* </p>
*
* @author kevin
* @since 2022-02-21
*/
public interface SysVersionManageMapper extends BaseMapper<SysVersionManage> {
}

View File

@ -0,0 +1,29 @@
package com.mosty.common.config.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mosty.common.base.constant.enums.ConfigKeyEnum;
import com.mosty.common.config.entity.SysConfig;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.vo.ConfigPage;
import com.mosty.common.config.entity.vo.DictPage;
/**
* <p>
* 参数配置表 服务类
* </p>
*
* @author kevin
* @since 2022-02-10
*/
public interface SysConfigService extends IService<SysConfig> {
IPage<SysConfig> selectByPage(ConfigPage page);
/**
* 根据配制键获取值
* @param passwordLevel
* @return
*/
SysConfig getOneByKey(ConfigKeyEnum passwordLevel);
}

View File

@ -0,0 +1,26 @@
package com.mosty.common.config.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mosty.common.config.entity.SysDictItem;
import com.mosty.common.config.entity.vo.AddDictItemVO;
import lombok.Data;
/**
* <p>
* 字典代码值表 服务类
* </p>
*
* @author kevin
* @since 2022-02-09
*/
public interface SysDictItemService extends IService<SysDictItem> {
/**
* 添加字典明细信息
* @param addDictItemVo 待添加的信息
* @param rootPath 父根节点开始的路口当前还不包含自己的id
* @param ipAddress ip地址
*/
void addSysDictItem(AddDictItemVO addDictItemVo, String rootPath, String ipAddress);
}

View File

@ -0,0 +1,21 @@
package com.mosty.common.config.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.vo.DictPage;
/**
* <p>
* 字典类别配置表 服务类
* </p>
*
* @author kevin
* @since 2022-02-09
*/
public interface SysDictService extends IService<SysDict> {
IPage<SysDict> selectByPage(DictPage page);
}

View File

@ -0,0 +1,25 @@
package com.mosty.common.config.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mosty.common.config.entity.SysVersionManage;
import com.mosty.common.config.entity.vo.VersionManagePage;
/**
* <p>
* 版本管理表 服务类
* </p>
*
* @author kevin
* @since 2022-02-21
*/
public interface SysVersionManageService extends IService<SysVersionManage> {
/**
* 版本管理功能分页
* @param versionManagePage 分页请求
* @return 分页数据
*/
IPage<SysVersionManage> selectByPage(VersionManagePage versionManagePage);
}

View File

@ -0,0 +1,56 @@
package com.mosty.common.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.base.constant.enums.ConfigKeyEnum;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.config.entity.SysConfig;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.vo.ConfigPage;
import com.mosty.common.config.entity.vo.DictPage;
import com.mosty.common.config.mapper.SysConfigMapper;
import com.mosty.common.config.mapper.SysDictMapper;
import com.mosty.common.config.service.SysConfigService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 参数配置表 服务实现类
* </p>
*
* @author kevin
* @since 2022-02-10
*/
@Service
@AllArgsConstructor
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {
private final SysConfigMapper sysConfigMapper;
@Override
public IPage<SysConfig> selectByPage(ConfigPage page) {
QueryWrapper<SysConfig> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(page.getConfigName())) {
queryWrapper.and(wrapper -> wrapper.like("pzmc", page.getConfigName()));
}
if (StringUtils.isNotBlank(page.getConfigKey())) {
queryWrapper.and(wrapper -> wrapper.eq("pzj", page.getConfigKey()));
}
queryWrapper.and(wrapper -> wrapper.eq("xt_zxbz", DeletedEnum.NATURE.code));
// LambdaQueryWrapper<SysConfig> eq = new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getPzmc, page.getConfigName());
return getBaseMapper().selectPage(page, queryWrapper);
}
@Override
public SysConfig getOneByKey(ConfigKeyEnum passwordLevel) {
SysConfig one = this.getOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getPzj, passwordLevel.code)
.eq(SysConfig::getXtZxbz, DeletedEnum.NATURE.code));
return one;
}
}

View File

@ -0,0 +1,101 @@
package com.mosty.common.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.config.Excel.DictUtils;
import com.mosty.common.base.exception.Asserts;
import com.mosty.common.config.entity.SysDictItem;
import com.mosty.common.config.entity.vo.AddDictItemVO;
import com.mosty.common.config.mapper.SysDictItemMapper;
import com.mosty.common.config.service.SysDictItemService;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 字典代码值表 服务实现类
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@Slf4j
@Service
@AllArgsConstructor
public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDictItem> implements SysDictItemService {
private final SysDictItemMapper sysDictItemMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void addSysDictItem(AddDictItemVO addDictItemVo, String rootPath, String ipAddress) {
SysDictItem one = sysDictItemMapper.selectOne(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getZdbh, addDictItemVo.getZdbh())
.eq(SysDictItem::getDm, addDictItemVo.getDm())
.eq(SysDictItem::getXtZxbz, "0")
);
Asserts.check(one != null, "当前字典编码 %s 下的字典代码 %s 已经存在!",
addDictItemVo.getZdbh(), addDictItemVo.getDm());
SysDictItem sysDictItem = new SysDictItem();
sysDictItem.setRootPath(rootPath);
sysDictItem.setZdId(addDictItemVo.getParentId());
sysDictItem.setZdmc(addDictItemVo.getZdmc());
sysDictItem.setPy(addDictItemVo.getPy());
sysDictItem.setPx(addDictItemVo.getPx());
sysDictItem.setBz(addDictItemVo.getBz());
sysDictItem.setDm(addDictItemVo.getDm());
sysDictItem.setZdbh(addDictItemVo.getZdbh());
UserInfo userInfo = UserInfoManager.get();
sysDictItem.setXtZxbz(DeletedEnum.NATURE.code);
sysDictItem.setXtCjsj(new Date());
sysDictItem.setXtZhxgsj(new Date());
sysDictItem.setXtZhxgrid(userInfo.getUserId().toString());
sysDictItem.setXtZhxgrxm(userInfo.getUserName());
sysDictItem.setXtZhxgrbmid(userInfo.getDeptId().toString());
sysDictItem.setXtZhxgrbm(userInfo.getDeptName());
sysDictItem.setXtLrsj(new Date());
sysDictItem.setXtLrrid(userInfo.getUserId().toString());
sysDictItem.setXtLrrxm(userInfo.getUserName());
sysDictItem.setXtLrrbmid(userInfo.getDeptId().toString());
sysDictItem.setXtLrrbm(userInfo.getDeptName());
sysDictItem.setXtLrip(ipAddress);
sysDictItem.setXtZhxgip(ipAddress);
// 先保存信息返回当前的主键id
sysDictItemMapper.insert(sysDictItem);
// 根据主键id修改rootPath
SysDictItem updateEntity = new SysDictItem();
updateEntity.setRootPath(sysDictItem.getRootPath() + sysDictItem.getId());
updateEntity.setId(sysDictItem.getId());
int row = sysDictItemMapper.updateById(updateEntity);
if (row > 0) {
List<SysDictItem> dictDatas = sysDictItemMapper.selectList(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getXtZxbz, 0)
.eq(SysDictItem::getZdbh, sysDictItem.getZdbh())
);
DictUtils.setDictCache(sysDictItem.getZdbh(), dictDatas);
}
}
}

View File

@ -0,0 +1,43 @@
package com.mosty.common.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.vo.DictPage;
import com.mosty.common.config.mapper.SysDictMapper;
import com.mosty.common.config.service.SysDictService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 字典类别配置表 服务实现类
* </p>
*
* @author kevin
* @since 2022-02-09
*/
@Service
@AllArgsConstructor
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService {
private final SysDictMapper sysDictMapper;
@Override
public IPage<SysDict> selectByPage(DictPage page) {
QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(page.getDictName())) {
queryWrapper.and(wrapper -> wrapper.like("zdmc", page.getDictName()));
}
if (StringUtils.isNotBlank(page.getDictCode())) {
queryWrapper.and(wrapper -> wrapper.like("zdbh", page.getDictCode()));
}
if (page.getXtZxbz() != null) {
queryWrapper.and(wrapper -> wrapper.eq("xt_zxbz", page.getXtZxbz()));
}
return getBaseMapper().selectPage(page, queryWrapper);
}
}

View File

@ -0,0 +1,46 @@
package com.mosty.common.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.base.constant.enums.DeletedEnum;
import com.mosty.common.config.entity.SysDict;
import com.mosty.common.config.entity.SysVersionManage;
import com.mosty.common.config.entity.vo.VersionManagePage;
import com.mosty.common.config.mapper.SysVersionManageMapper;
import com.mosty.common.config.service.SysVersionManageService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 版本管理表 服务实现类
* </p>
*
* @author kevin
* @since 2022-02-21
*/
@Service
@AllArgsConstructor
public class SysVersionManageServiceImpl extends ServiceImpl<SysVersionManageMapper, SysVersionManage> implements SysVersionManageService {
private final SysVersionManageMapper sysVersionManageMapper;
@Override
public IPage<SysVersionManage> selectByPage(VersionManagePage versionManagePage) {
QueryWrapper<SysVersionManage> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(versionManagePage.getSysVersion())) {
queryWrapper.and(wrapper -> wrapper.like("sys_version", versionManagePage.getSysVersion()));
}
if (StringUtils.isNotBlank(versionManagePage.getStartPublishTime())) {
queryWrapper.and(wrapper -> wrapper.gt("publish_time", versionManagePage.getStartPublishTime()));
}
if (StringUtils.isNotBlank(versionManagePage.getEndPublishTime())) {
queryWrapper.and(wrapper -> wrapper.le("publish_time", versionManagePage.getEndPublishTime()));
}
queryWrapper.and(wrapper -> wrapper.le("xt_zxbz", DeletedEnum.NATURE.code));
queryWrapper.orderByDesc("publish_time");
return getBaseMapper().selectPage(versionManagePage, queryWrapper);
}
}

View File

@ -0,0 +1,5 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.mosty.common.config.CommonConfigAutoConfiguration,\
com.mosty.common.config.ConfigServiceFactory,\
com.mosty.common.config.config.DictElementConfig,\
com.mosty.common.config.config.SystemConfig

View File

@ -0,0 +1,5 @@
<?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="com.mosty.common.config.mapper.SysConfigMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?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="com.mosty.common.config.mapper.SysDictItemMapper">
</mapper>

View File

@ -0,0 +1,17 @@
<?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="com.mosty.common.config.mapper.SysDictMapper">
<select id="selectByPage" resultType="com.mosty.common.config.entity.SysDict" parameterType="com.mosty.common.config.entity.vo.DictPage">
select * FROM sys_dict
<where>
<if test="dictName != null and dictName != '' ">
zdmc like CONCAT('%',#{dictName,jdbcType=VARCHAR},'%')
</if>
<if test="dictCode != null and dictCode != '' ">
zdmc = #{dictCode}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,5 @@
<?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="com.mosty.common.config.mapper.SysVersionManageMapper">
</mapper>

View File

@ -0,0 +1,5 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.mosty.common.config.CommonConfigAutoConfiguration,\
com.mosty.common.config.ConfigServiceFactory,\
com.mosty.common.config.config.DictElementConfig,\
com.mosty.common.config.config.SystemConfig

Some files were not shown because too many files have changed in this diff Show More