master
zhang chengzhi 2024-08-22 16:17:49 +08:00
parent da8bef15d0
commit 1507e6cb9a
11 changed files with 311 additions and 23 deletions

View File

@ -0,0 +1,80 @@
package com.muyu.rule.common.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.rule.common.domain.req.EtlRuleAddReq;
import com.muyu.rule.common.domain.req.EtlRuleUpdReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.function.Supplier;
/**
* @Author
* @Packagecom.muyu.damain
* @Projectcloud-etl
* @nameRule
* @Date2024/8/21 11:33
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "etl_rule",autoResultMap = true)
public class EtlRule extends BaseEntity {
/**
*
*/
@TableId(value = "id" , type = IdType.AUTO)
private Long id ;
/** 规则名称 */
private String name ;
/** 规则类型 */
private String type ;
/** 全限定类名 */
private String fullClassName ;
/** 是否公开 0已激活 1未激活 */
private String open ;
/** 状态 0正常 1停用 */
private String status ;
public static EtlRule updBuild(EtlRuleUpdReq etlRule, Supplier<Long> longSupplier){
return EtlRule.builder().id(longSupplier.get())
.open(etlRule.getOpen())
.name(etlRule.getName())
.status(etlRule.getStatus())
.type(etlRule.getType())
.remark(etlRule.getRemark())
.build();
}
public static EtlRule addBuild(EtlRuleAddReq etlRule){
return EtlRule.builder()
.open(etlRule.getOpen())
.name(etlRule.getName())
.status(etlRule.getStatus())
.type(etlRule.getType())
.remark(etlRule.getRemark())
.build();
}
}

View File

@ -0,0 +1,48 @@
package com.muyu.rule.common.domain.req;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @Author
* @Packagecom.muyu.etl.common.domain.req
* @Projectcloud-etl
* @nameEtlRuleAddReq
* @Date2024/8/21 23:49
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "客户端规则添加请求对象")
public class EtlRuleAddReq {
/** 规则名称 */
private String name ;
/** 规则类型 */
private String type ;
/** 全限定类名 */
private String fullClassName ;
/** 规则说明 */
private String explain ;
/** 是否公开 0已激活 1未激活 */
private String open ;
/** 状态 0正常 1停用 */
private String status ;
/**
*
*/
private String remark;
}

View File

@ -0,0 +1,39 @@
package com.muyu.rule.common.domain.req;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @Author
* @Packagecom.muyu.etl.common.domain.req
* @Projectcloud-etl
* @nameEtlRuleListReq
* @Date2024/8/21 21:42
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "客户端规则列表请求对象")
public class EtlRuleListReq {
/** 数据来源类型 */
private String type ;
/** 数据来源名称 */
private String name ;
/** 是否公开 0已激活 1未激活 */
private String open ;
/** 状态 0正常 1停用 */
private String status ;
}

View File

@ -0,0 +1,47 @@
package com.muyu.rule.common.domain.req;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @Author
* @Packagecom.muyu.etl.common.domain.req
* @Projectcloud-etl
* @nameEtlRuleUpdReq
* @Date2024/8/21 23:48
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "客户端规则修改请求对象")
public class EtlRuleUpdReq {
/** 规则名称 */
private String name ;
/** 规则类型 */
private String type ;
/** 全限定类名 */
private String fullClassName ;
/** 是否公开 0已激活 1未激活 */
private String open ;
/** 状态 0正常 1停用 */
private String status ;
/**
*
*/
private String remark;
}

View File

@ -0,0 +1,73 @@
package com.muyu.rule.common.domain.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.rule.common.domain.EtlRule;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Author
* @Packagecom.muyu.etl.common.domain.resp
* @Projectcloud-etl
* @nameEtlRuleResp
* @Date2024/8/21 21:57
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "规则信息相应对象", description = "负责规则信息查询的响应结果")
public class EtlRuleResp {
/**
*
*/
@TableId(value = "id" , type = IdType.AUTO)
private Long id ;
/** 规则名称 */
private String name ;
/** 规则类型 */
private String type ;
/** 全限定类名 */
private String fullClassName ;
@Schema(description = "创建人", defaultValue = "muyu", type = "String")
private String createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间", defaultValue = "2024-8-1 0:22:36", type = "Date")
private Date createTime;
public static EtlRuleResp etlRuleRespBuilder(EtlRule etlRule){
return EtlRuleResp.builder()
.id(etlRule.getId())
.type(etlRule.getType())
.name(etlRule.getName())
.createBy(etlRule.getCreateBy())
.createTime(etlRule.getCreateTime()).build();
}
}

View File

@ -85,7 +85,7 @@
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-etl-common</artifactId>
<artifactId>cloud-rule-common</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>

View File

@ -1,4 +1,4 @@
package com.muyu.etl.server;
package com.muyu.rule.server;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
@ -14,8 +14,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomConfig
@EnableMyFeignClients
@SpringBootApplication
public class DataSourcesApplication {
public class EtlRuleApplication {
public static void main(String[] args) {
SpringApplication.run(DataSourcesApplication.class);
SpringApplication.run(EtlRuleApplication.class);
}
}

View File

@ -1,12 +1,13 @@
package com.muyu.etl.server.controller;
package com.muyu.rule.server.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.etl.common.domain.EtlRule;
import com.muyu.etl.common.domain.req.EtlRuleAddReq;
import com.muyu.etl.common.domain.req.EtlRuleListReq;
import com.muyu.etl.common.domain.req.EtlRuleUpdReq;
import com.muyu.etl.common.domain.resp.EtlRuleResp;
import com.muyu.etl.server.service.EtlRuleService;
import com.muyu.rule.common.domain.EtlRule;
import com.muyu.rule.common.domain.req.EtlRuleAddReq;
import com.muyu.rule.common.domain.req.EtlRuleListReq;
import com.muyu.rule.common.domain.req.EtlRuleUpdReq;
import com.muyu.rule.common.domain.resp.EtlRuleResp;
import com.muyu.rule.server.service.EtlRuleService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;

View File

@ -1,10 +1,10 @@
package com.muyu.etl.server.mapper;
package com.muyu.rule.server.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.muyu.etl.common.domain.EtlRule;
import com.muyu.rule.common.domain.EtlRule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

View File

@ -1,9 +1,9 @@
package com.muyu.etl.server.service;
package com.muyu.rule.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.common.domain.EtlRule;
import com.muyu.etl.common.domain.req.EtlRuleListReq;
import com.muyu.etl.common.domain.resp.EtlRuleResp;
import com.muyu.rule.common.domain.EtlRule;
import com.muyu.rule.common.domain.req.EtlRuleListReq;
import com.muyu.rule.common.domain.resp.EtlRuleResp;
import java.util.List;

View File

@ -1,13 +1,13 @@
package com.muyu.etl.server.service.impl;
package com.muyu.rule.server.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.etl.common.domain.EtlRule;
import com.muyu.etl.common.domain.req.EtlRuleListReq;
import com.muyu.etl.common.domain.resp.EtlRuleResp;
import com.muyu.etl.server.mapper.EtlRuleMapper;
import com.muyu.etl.server.service.EtlRuleService;
import com.muyu.rule.common.domain.EtlRule;
import com.muyu.rule.common.domain.req.EtlRuleListReq;
import com.muyu.rule.common.domain.resp.EtlRuleResp;
import com.muyu.rule.server.mapper.EtlRuleMapper;
import com.muyu.rule.server.service.EtlRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;