forked from DataLinkDC/dinky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
3,370 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# dlink | ||
# Dlink | ||
|
||
## 简介 | ||
|
||
Dlink 为 Apache Flink 而生。它是一个敏捷的 FlinkSQL 开发运维平台,可以在线开发、预览、提交作业。 | ||
|
||
与此同时,Dlink 也是 DataLink 数据中台生态的核心组件。 | ||
|
||
DataLink 开源项目及社区正在建设,希望本项目可以帮助你更快发展。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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>dlink</artifactId> | ||
<groupId>com.dlink</groupId> | ||
<version>0.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>dlink-admin</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>druid-spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.baomidou</groupId> | ||
<artifactId>mybatis-plus-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
dlink-admin/src/main/java/com/dlink/common/result/PageResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.dlink.common.result; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* 分页结果 | ||
* | ||
* @author wenmo | ||
* @since 2021/5/3 20:03 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class PageResult<T> implements Serializable { | ||
private static final long serialVersionUID = -5143774412936881374L; | ||
/** | ||
* 总数 | ||
*/ | ||
private Long count; | ||
/** | ||
* 是否成功:0 成功、1 失败 | ||
*/ | ||
private int code; | ||
/** | ||
* 当前页结果集 | ||
*/ | ||
private List<T> data; | ||
} |
43 changes: 43 additions & 0 deletions
43
dlink-admin/src/main/java/com/dlink/common/result/ProTableResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.dlink.common.result; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* Ant Design Pro ProTable Query Result | ||
* | ||
* @author wenmo | ||
* @since 2021/5/18 21:54 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ProTableResult<T> implements Serializable { | ||
private static final long serialVersionUID = -6377431009117000655L; | ||
/** | ||
* 总数 | ||
*/ | ||
private Long total; | ||
/** | ||
* 是否成功:true 成功、false 失败 | ||
*/ | ||
private boolean success; | ||
/** | ||
* 当前页码 | ||
*/ | ||
private Integer current; | ||
/** | ||
* 当前每页记录数 | ||
*/ | ||
private Integer pageSize; | ||
/** | ||
* 当前页结果集 | ||
*/ | ||
private List<T> data; | ||
} |
48 changes: 48 additions & 0 deletions
48
dlink-admin/src/main/java/com/dlink/common/result/Result.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.dlink.common.result; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* 返回对象 | ||
* | ||
* @author wenmo | ||
* @since 2021/5/3 19:56 | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Result<T> implements Serializable { | ||
|
||
private T datas; | ||
private Integer code; | ||
private String msg; | ||
|
||
public static <T> Result<T> succeed(String msg) { | ||
return of(null, CodeEnum.SUCCESS.getCode(), msg); | ||
} | ||
|
||
public static <T> Result<T> succeed(T model, String msg) { | ||
return of(model, CodeEnum.SUCCESS.getCode(), msg); | ||
} | ||
|
||
public static <T> Result<T> succeed(T model) { | ||
return of(model, CodeEnum.SUCCESS.getCode(), ""); | ||
} | ||
|
||
public static <T> Result<T> of(T datas, Integer code, String msg) { | ||
return new Result<>(datas, code, msg); | ||
} | ||
|
||
public static <T> Result<T> failed(String msg) { | ||
return of(null, CodeEnum.ERROR.getCode(), msg); | ||
} | ||
|
||
public static <T> Result<T> failed(T model, String msg) { | ||
return of(model, CodeEnum.ERROR.getCode(), msg); | ||
} | ||
} | ||
|
41 changes: 41 additions & 0 deletions
41
dlink-admin/src/main/java/com/dlink/db/config/MybatisPlusConfigure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.dlink.db.config; | ||
|
||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | ||
import com.baomidou.mybatisplus.core.parser.ISqlParser; | ||
import com.baomidou.mybatisplus.core.parser.ISqlParserFilter; | ||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; | ||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler; | ||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser; | ||
import com.dlink.db.handler.DateMetaObjectHandler; | ||
import com.dlink.db.properties.MybatisPlusFillProperties; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
/** | ||
* MybatisPlusConfigure | ||
* | ||
* @author wenmo | ||
* @since 2021/5/25 | ||
**/ | ||
@EnableConfigurationProperties(MybatisPlusFillProperties.class) | ||
public class MybatisPlusConfigure { | ||
|
||
@Autowired | ||
private MybatisPlusFillProperties autoFillProperties; | ||
|
||
@Bean | ||
public PaginationInterceptor paginationInterceptor() { | ||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); | ||
return paginationInterceptor; | ||
} | ||
|
||
@Bean | ||
@ConditionalOnMissingBean | ||
@ConditionalOnProperty(prefix = "dlink.mybatis-plus.fill", name = "enabled", havingValue = "true", matchIfMissing = true) | ||
public MetaObjectHandler metaObjectHandler() { | ||
return new DateMetaObjectHandler(autoFillProperties); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
dlink-admin/src/main/java/com/dlink/db/handler/DateMetaObjectHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.dlink.db.handler; | ||
|
||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | ||
import com.dlink.db.properties.MybatisPlusFillProperties; | ||
import org.apache.ibatis.reflection.MetaObject; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* DateMetaObjectHandler | ||
* | ||
* @author wenmo | ||
* @since 2021/5/25 | ||
**/ | ||
public class DateMetaObjectHandler implements MetaObjectHandler { | ||
private MybatisPlusFillProperties mybatisPlusFillProperties; | ||
|
||
public DateMetaObjectHandler(MybatisPlusFillProperties mybatisPlusFillProperties) { | ||
this.mybatisPlusFillProperties = mybatisPlusFillProperties; | ||
} | ||
|
||
@Override | ||
public boolean openInsertFill() { | ||
return mybatisPlusFillProperties.getEnableInsertFill(); | ||
} | ||
|
||
@Override | ||
public boolean openUpdateFill() { | ||
return mybatisPlusFillProperties.getEnableUpdateFill(); | ||
} | ||
|
||
@Override | ||
public void insertFill(MetaObject metaObject) { | ||
Object createTime = getFieldValByName(mybatisPlusFillProperties.getCreateTimeField(), metaObject); | ||
Object updateTime = getFieldValByName(mybatisPlusFillProperties.getUpdateTimeField(), metaObject); | ||
if (createTime == null) { | ||
setFieldValByName(mybatisPlusFillProperties.getCreateTimeField(), LocalDateTime.now(), metaObject); | ||
} | ||
if (updateTime == null) { | ||
setFieldValByName(mybatisPlusFillProperties.getUpdateTimeField(), LocalDateTime.now(), metaObject); | ||
} | ||
} | ||
|
||
@Override | ||
public void updateFill(MetaObject metaObject) { | ||
setFieldValByName(mybatisPlusFillProperties.getUpdateTimeField(), LocalDateTime.now(), metaObject); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
dlink-admin/src/main/java/com/dlink/db/mapper/SuperMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.dlink.db.mapper; | ||
|
||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import com.baomidou.mybatisplus.core.toolkit.Constants; | ||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
import org.apache.ibatis.annotations.Param; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* SuperMapper | ||
* | ||
* @author wenmo | ||
* @since 2021/5/25 | ||
**/ | ||
public interface SuperMapper<T> extends BaseMapper<T> { | ||
|
||
List<T> selectForProTable(Page<T> page, @Param(Constants.WRAPPER) Wrapper<T> queryWrapper, @Param("param") Map<String, Object> param); | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
dlink-admin/src/main/java/com/dlink/db/properties/MybatisPlusFillProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.dlink.db.properties; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
/** | ||
* MybatisPlusFillProperties | ||
* | ||
* @author wenmo | ||
* @since 2021/5/25 | ||
**/ | ||
@Setter | ||
@Getter | ||
@ConfigurationProperties(prefix = "dlink.mybatis-plus.fill") | ||
public class MybatisPlusFillProperties { | ||
|
||
private Boolean enabled = true; | ||
|
||
private Boolean enableInsertFill = true; | ||
|
||
private Boolean enableUpdateFill = true; | ||
|
||
private String createTimeField = "createTime"; | ||
|
||
private String updateTimeField = "updateTime"; | ||
} |
18 changes: 18 additions & 0 deletions
18
dlink-admin/src/main/java/com/dlink/db/service/ISuperService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.dlink.db.service; | ||
|
||
import com.baomidou.mybatisplus.extension.service.IService; | ||
import com.dlink.common.result.ProTableResult; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
|
||
/** | ||
* ISuperService | ||
* | ||
* @author wenmo | ||
* @since 2021/5/25 | ||
**/ | ||
public interface ISuperService<T> extends IService<T> { | ||
|
||
ProTableResult<T> selectForProTable(JsonNode para); | ||
|
||
} |
Oops, something went wrong.