feat():规则引擎模块
parent
9b76b6fae4
commit
8a33e76f51
|
@ -3,12 +3,16 @@ package com.muyu.common.system.remote;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务
|
* 用户服务
|
||||||
*
|
*
|
||||||
|
@ -37,4 +41,24 @@ public interface RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/register")
|
@PostMapping("/user/register")
|
||||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户对象
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/user/list")
|
||||||
|
public Result<List<SysUser>> list (@RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/dept/{deptId}")
|
||||||
|
public Result<SysDept> getInfo (@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
@PostMapping(value = "/dept/list")
|
||||||
|
Result<List<SysDept>> list(@RequestBody SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
package com.muyu.common.system.remote.factory;
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
|
||||||
import com.muyu.common.system.domain.SysUser;
|
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务降级处理
|
* 用户服务降级处理
|
||||||
*
|
*
|
||||||
|
@ -19,18 +22,33 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
|
private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteUserService create (Throwable throwable) {
|
public RemoteUserService create(Throwable throwable) {
|
||||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteUserService() {
|
return new RemoteUserService() {
|
||||||
@Override
|
@Override
|
||||||
public Result<LoginUser> getUserInfo (String username, String source) {
|
public Result<LoginUser> getUserInfo(String username, String source) {
|
||||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
public Result<Boolean> registerUserInfo(SysUser sysUser, String source) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<SysUser>> list(SysUser user, String source) {
|
||||||
|
return Result.error("用户列表获取失败" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<SysDept> getInfo(Long deptId, String source) {
|
||||||
|
return Result.error("用户获取失败" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<SysDept>> list(SysDept dept, String source) {
|
||||||
|
return Result.error("部门列表获取失败" + throwable.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-ruleEngine</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-ruleEngine-common</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.engine.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎对象 rule_engine
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-05-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class RuleEngine extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则名称 */
|
||||||
|
@Excel(name = "规则名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 规则类型 */
|
||||||
|
@Excel(name = "规则类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 规则作用域 */
|
||||||
|
@Excel(name = "规则作用域")
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
/** 引擎编码 */
|
||||||
|
@Excel(name = "引擎编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/** 描述 */
|
||||||
|
@Excel(name = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 是否激活 */
|
||||||
|
@Excel(name = "是否激活")
|
||||||
|
private String isActivate;
|
||||||
|
|
||||||
|
/** 规则状态 */
|
||||||
|
@Excel(name = "规则状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-ruleEngine</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-ruleEngine-remote</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-ruleEngine</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-ruleEngine-service</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.3.8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-ruleEngine-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.fox.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.muyu.engine.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.engine.domain.RuleEngine;
|
||||||
|
import com.muyu.engine.service.RuleEngineService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎Controller
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-05-03
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/engine")
|
||||||
|
public class RuleEngineController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RuleEngineService ruleEngineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出规则引擎列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:export")
|
||||||
|
@Log(title = "规则引擎", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||||
|
ExcelUtil<RuleEngine> util = new ExcelUtil<RuleEngine>(RuleEngine.class);
|
||||||
|
util.exportExcel(response, list, "规则引擎数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取规则引擎详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(ruleEngineService.selectRuleEngineById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:add")
|
||||||
|
@Log(title = "规则引擎", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
return toAjax(ruleEngineService.insertRuleEngine(ruleEngine));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:edit")
|
||||||
|
@Log(title = "规则引擎", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
return toAjax(ruleEngineService.updateRuleEngine(ruleEngine));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("engine:engine:remove")
|
||||||
|
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(ruleEngineService.deleteRuleEngineByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.engine.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.engine.domain.RuleEngine;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎Mapper接口
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-05-03
|
||||||
|
*/
|
||||||
|
public interface RuleEngineMapper extends BaseMapper<RuleEngine>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询规则引擎
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 规则引擎
|
||||||
|
*/
|
||||||
|
public RuleEngine selectRuleEngineById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎列表
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 规则引擎集合
|
||||||
|
*/
|
||||||
|
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertRuleEngine(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateRuleEngine(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRuleEngineById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRuleEngineByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.engine.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.engine.domain.RuleEngine;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎Service接口
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-05-03
|
||||||
|
*/
|
||||||
|
public interface RuleEngineService extends IService<RuleEngine>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询规则引擎
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 规则引擎
|
||||||
|
*/
|
||||||
|
public RuleEngine selectRuleEngineById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎列表
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 规则引擎集合
|
||||||
|
*/
|
||||||
|
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertRuleEngine(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateRuleEngine(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的规则引擎主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRuleEngineByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎信息
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRuleEngineById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.muyu.engine.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.engine.domain.RuleEngine;
|
||||||
|
import com.muyu.engine.mapper.RuleEngineMapper;
|
||||||
|
import com.muyu.engine.service.RuleEngineService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-05-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper,RuleEngine> implements RuleEngineService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RuleEngineMapper ruleEngineMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 规则引擎
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RuleEngine selectRuleEngineById(Long id)
|
||||||
|
{
|
||||||
|
return ruleEngineMapper.selectRuleEngineById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎列表
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 规则引擎
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
return ruleEngineMapper.selectRuleEngineList(ruleEngine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertRuleEngine(RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
ruleEngine.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return ruleEngineMapper.insertRuleEngine(ruleEngine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎
|
||||||
|
*
|
||||||
|
* @param ruleEngine 规则引擎
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateRuleEngine(RuleEngine ruleEngine)
|
||||||
|
{
|
||||||
|
ruleEngine.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return ruleEngineMapper.updateRuleEngine(ruleEngine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的规则引擎主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteRuleEngineByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ruleEngineMapper.deleteRuleEngineByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎信息
|
||||||
|
*
|
||||||
|
* @param id 规则引擎主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteRuleEngineById(Long id)
|
||||||
|
{
|
||||||
|
return ruleEngineMapper.deleteRuleEngineById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9206
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: muyu-engine
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 43.142.100.73:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 43.142.100.73:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.etl.mapper: DEBUG
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?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.muyu.engine.mapper.RuleEngineMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.engine.domain.RuleEngine" id="RuleEngineResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="level" column="level" />
|
||||||
|
<result property="code" column="code" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="isActivate" column="isActivate" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectRuleEngineVo">
|
||||||
|
select id, name, type, level, code,description, isActivate, status, remark, create_by, create_time, update_by, update_time from rule_engine
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectRuleEngineList" parameterType="com.muyu.engine.domain.RuleEngine" resultMap="RuleEngineResult">
|
||||||
|
<include refid="selectRuleEngineVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||||
|
<if test="level != null and level != ''"> and level = #{level}</if>
|
||||||
|
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||||
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||||
|
<if test="isActivate != null and isActivate != ''"> and isActivate = #{isActivate}</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRuleEngineById" parameterType="Long" resultMap="RuleEngineResult">
|
||||||
|
<include refid="selectRuleEngineVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertRuleEngine" parameterType="com.muyu.engine.domain.RuleEngine">
|
||||||
|
insert into rule_engine
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
<if test="level != null">level,</if>
|
||||||
|
<if test="code != null">code,</if>
|
||||||
|
<if test="description != null">description,</if>
|
||||||
|
<if test="isActivate != null">isActivate,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
|
<if test="level != null">#{level},</if>
|
||||||
|
<if test="code != null">#{code},</if>
|
||||||
|
<if test="description != null">#{description},</if>
|
||||||
|
<if test="isActivate != null">#{isActivate},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRuleEngine" parameterType="com.muyu.engine.domain.RuleEngine">
|
||||||
|
update rule_engine
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
|
<if test="level != null">level = #{level},</if>
|
||||||
|
<if test="code != null">code = #{code},</if>
|
||||||
|
<if test="description != null">description = #{description},</if>
|
||||||
|
<if test="isActivate != null">isActivate = #{isActivate},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteRuleEngineById" parameterType="Long">
|
||||||
|
delete from rule_engine where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteRuleEngineByIds" parameterType="String">
|
||||||
|
delete from rule_engine where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-ruleEngine</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>muyu-ruleEngine-common</module>
|
||||||
|
<module>muyu-ruleEngine-remote</module>
|
||||||
|
<module>muyu-ruleEngine-service</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -34,7 +34,7 @@ public class SysDeptController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result list (SysDept dept) {
|
public Result<List<SysDept>> list (SysDept dept) {
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
return success(depts);
|
return success(depts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.muyu.etl.domain;
|
||||||
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -37,7 +39,13 @@ public class AssetImpower extends BaseEntity {
|
||||||
* 部门id
|
* 部门id
|
||||||
*/
|
*/
|
||||||
@Excel(name = "部门id")
|
@Excel(name = "部门id")
|
||||||
private Long typeId;
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入id
|
||||||
|
*/
|
||||||
|
@Excel(name = "接入id")
|
||||||
|
private Long basicId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
|
@ -45,4 +53,13 @@ public class AssetImpower extends BaseEntity {
|
||||||
@Excel(name = "用户id")
|
@Excel(name = "用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
public static AssetImpower saveAssetImpower(Long deptId,Long userId,AssetImpower assetImpower){
|
||||||
|
return AssetImpower.builder()
|
||||||
|
.basicId(assetImpower.getBasicId())
|
||||||
|
.tableId(assetImpower.getTableId())
|
||||||
|
.deptId(deptId)
|
||||||
|
.userId(userId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,11 @@ public class TableInfo extends TreeEntity
|
||||||
@Excel(name = "表备注")
|
@Excel(name = "表备注")
|
||||||
private String tableRemark;
|
private String tableRemark;
|
||||||
|
|
||||||
|
/** 表备注 */
|
||||||
|
@Excel(name = "数据来源类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
/** 数据量 */
|
/** 数据量 */
|
||||||
@Excel(name = "数据量")
|
@Excel(name = "数据量")
|
||||||
private Long dataNum;
|
private Long dataNum;
|
||||||
|
|
|
@ -34,11 +34,17 @@ public class AssetImpowerReq {
|
||||||
@Excel(name = "表id")
|
@Excel(name = "表id")
|
||||||
private Long tableId;
|
private Long tableId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入id
|
||||||
|
*/
|
||||||
|
@Excel(name = "接入id")
|
||||||
|
private Long basicId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门id
|
* 部门id
|
||||||
*/
|
*/
|
||||||
@Excel(name = "部门id")
|
@Excel(name = "部门id")
|
||||||
private Long typeId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.etl.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入--表基础信息(授权)
|
||||||
|
*
|
||||||
|
* @ClassName BasicTableInfoResp
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/30 11:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class BasicTableInfoResp {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入id
|
||||||
|
*/
|
||||||
|
private Long basicId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据接入名
|
||||||
|
*/
|
||||||
|
private String dataResourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据接入系统名
|
||||||
|
*/
|
||||||
|
private String dataSourcesSystemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库名
|
||||||
|
*/
|
||||||
|
private String databaseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名(中文)
|
||||||
|
*/
|
||||||
|
private String tableRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表明
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据条数
|
||||||
|
*/
|
||||||
|
private Long totalNum;
|
||||||
|
|
||||||
|
}
|
|
@ -45,10 +45,14 @@ public class TableInfoStructureResp
|
||||||
/** 数据量 */
|
/** 数据量 */
|
||||||
@Excel(name = "数据量")
|
@Excel(name = "数据量")
|
||||||
private Long dataNum;
|
private Long dataNum;
|
||||||
|
/** 表备注 */
|
||||||
|
@Excel(name = "数据来源类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
/** 是否核心 'Y'是 'N'不是 */
|
/** 是否核心 'Y'是 'N'不是 */
|
||||||
@Excel(name = "是否核心 'Y'是 'N'不是")
|
@Excel(name = "是否核心 'Y'是 'N'不是")
|
||||||
private String center;
|
private String center;
|
||||||
|
|
||||||
private String databaseType;
|
private String databaseType;
|
||||||
|
|
||||||
private List<Structure> structureList;
|
private List<Structure> structureList;
|
||||||
|
|
|
@ -11,10 +11,18 @@
|
||||||
|
|
||||||
<artifactId>muyu-etl-remote</artifactId>
|
<artifactId>muyu-etl-remote</artifactId>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
<artifactId>muyu-common-swagger</artifactId>
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -5,10 +5,12 @@ import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
|
@EnableFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class MuYuEtlApplication {
|
public class MuYuEtlApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -101,4 +101,19 @@ public class AssetImpowerController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(assetImpowerService.deleteAssetImpowerByIds(ids));
|
return toAjax(assetImpowerService.deleteAssetImpowerByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除资产赋权
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("etl:impower:list")
|
||||||
|
@Log(title = "资产赋权", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("getPowerByTableId/{tableId}")
|
||||||
|
public Result getPowerByTableId(@PathVariable Long tableId)
|
||||||
|
{
|
||||||
|
return Result.success(assetImpowerService.getPowerByTableId(tableId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,18 @@ public class BasicConfigInfoController extends BaseController {
|
||||||
return Result.success(dictInfoService.insertDictInfo(dictInfo));
|
return Result.success(dictInfoService.insertDictInfo(dictInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取具体表的所有基础信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("etl:table:list")
|
||||||
|
@Log(title = "获取具体表的所有基础信息")
|
||||||
|
@GetMapping("/getBasicTableInfo/{tableId}")
|
||||||
|
public Result getBasicTableInfo(@PathVariable Long tableId) throws ServletException {
|
||||||
|
return Result.success(basicConfigInfoService.getBasicTableInfo(tableId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改资产结构中字典信息
|
* 修改资产结构中字典信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -60,4 +60,6 @@ public interface AssetImpowerService extends IService<AssetImpower>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAssetImpowerById(Long id);
|
public int deleteAssetImpowerById(Long id);
|
||||||
|
|
||||||
|
List<AssetImpower> getPowerByTableId(Long tableId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.etl.domain.BasicConfigInfo;
|
import com.muyu.etl.domain.BasicConfigInfo;
|
||||||
|
import com.muyu.etl.domain.resp.BasicTableInfoResp;
|
||||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||||
import com.muyu.etl.domain.resp.TableTreeResp;
|
import com.muyu.etl.domain.resp.TableTreeResp;
|
||||||
|
|
||||||
|
@ -73,4 +74,6 @@ public interface BasicConfigInfoService extends IService<BasicConfigInfo>
|
||||||
List<TableTreeResp> getTableTree();
|
List<TableTreeResp> getTableTree();
|
||||||
|
|
||||||
TableInfoStructureResp getTableInfo(Long tableId);
|
TableInfoStructureResp getTableInfo(Long tableId);
|
||||||
|
|
||||||
|
BasicTableInfoResp getBasicTableInfo(Long tableId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
package com.muyu.etl.service.impl;
|
package com.muyu.etl.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
|
import com.muyu.etl.domain.AssetImpower;
|
||||||
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
import com.muyu.etl.mapper.AssetImpowerMapper;
|
||||||
|
import com.muyu.etl.service.AssetImpowerService;
|
||||||
|
import com.muyu.etl.service.TableInfoService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.etl.mapper.AssetImpowerMapper;
|
|
||||||
import com.muyu.etl.domain.AssetImpower;
|
import java.util.ArrayList;
|
||||||
import com.muyu.etl.service.AssetImpowerService;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产赋权Service业务层处理
|
* 资产赋权Service业务层处理
|
||||||
|
@ -17,10 +26,14 @@ import com.muyu.etl.service.AssetImpowerService;
|
||||||
* @date 2024-04-28
|
* @date 2024-04-28
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,AssetImpower> implements AssetImpowerService
|
@Log4j2
|
||||||
{
|
public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper, AssetImpower> implements AssetImpowerService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetImpowerMapper assetImpowerMapper;
|
private AssetImpowerMapper assetImpowerMapper;
|
||||||
|
@Autowired
|
||||||
|
private TableInfoService tableInfoService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询资产赋权
|
* 查询资产赋权
|
||||||
|
@ -29,8 +42,7 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 资产赋权
|
* @return 资产赋权
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AssetImpower selectAssetImpowerById(Long id)
|
public AssetImpower selectAssetImpowerById(Long id) {
|
||||||
{
|
|
||||||
return assetImpowerMapper.selectAssetImpowerById(id);
|
return assetImpowerMapper.selectAssetImpowerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +53,7 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 资产赋权
|
* @return 资产赋权
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower)
|
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower) {
|
||||||
{
|
|
||||||
return assetImpowerMapper.selectAssetImpowerList(assetImpower);
|
return assetImpowerMapper.selectAssetImpowerList(assetImpower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +64,58 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertAssetImpower(AssetImpower assetImpower)
|
public int insertAssetImpower(AssetImpower assetImpower) {
|
||||||
{
|
List<AssetImpower> rows = new ArrayList<>();
|
||||||
assetImpower.setCreateTime(DateUtils.getNowDate());
|
assetImpower.setCreateTime(DateUtils.getNowDate());
|
||||||
return assetImpowerMapper.insertAssetImpower(assetImpower);
|
//创建一个部门容器和用户容器
|
||||||
|
List<SysDept> deptList = remoteUserService.list(new SysDept(), SecurityConstants.INNER).getData();
|
||||||
|
System.out.println(remoteUserService.list(new SysDept(), SecurityConstants.INNER));
|
||||||
|
//单表单个用户赋权
|
||||||
|
if (assetImpower.getTableId() != null && assetImpower.getUserId() != null) {
|
||||||
|
rows.add(assetImpower);
|
||||||
|
}
|
||||||
|
//单表多用户赋权
|
||||||
|
if (assetImpower.getTableId() != null) {
|
||||||
|
//根据id过滤部门
|
||||||
|
SysDept dept = remoteUserService.getInfo(assetImpower.getDeptId(), SecurityConstants.INNER).getData();
|
||||||
|
deptList.addAll(getChildSysDept(deptList, dept));
|
||||||
|
List<AssetImpower> finalRows = rows;
|
||||||
|
deptList.stream().distinct().forEach(sysDept -> {
|
||||||
|
//该部门下的用户列表
|
||||||
|
remoteUserService.list(new SysUser() {{
|
||||||
|
setDeptId(sysDept.getDeptId());
|
||||||
|
}}, SecurityConstants.INNER).getData()
|
||||||
|
.forEach(sysUser -> finalRows.add(AssetImpower.saveAssetImpower(sysDept.getDeptId(), sysUser.getUserId(), assetImpower)));
|
||||||
|
});
|
||||||
|
rows = rows.stream().distinct().toList();
|
||||||
|
}
|
||||||
|
//多表单用户赋权
|
||||||
|
if (assetImpower.getUserId() != null) {
|
||||||
|
List<TableInfo> tableInfoList = tableInfoService.selectTableInfoList(new TableInfo() {{
|
||||||
|
setBasicId(assetImpower.getBasicId());
|
||||||
|
}});
|
||||||
|
List<AssetImpower> finalRows = rows;
|
||||||
|
tableInfoList.forEach(tableInfo -> finalRows.add(AssetImpower.saveAssetImpower(
|
||||||
|
assetImpower.getDeptId(), assetImpower.getUserId(), new AssetImpower() {{
|
||||||
|
setBasicId(assetImpower.getBasicId());
|
||||||
|
setTableId(tableInfo.getId());
|
||||||
|
}})));
|
||||||
|
}
|
||||||
|
boolean b = this.saveBatch(rows);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//递归获取子级部门
|
||||||
|
public List<SysDept> getChildSysDept(List<SysDept> deptList, SysDept sysDept) {
|
||||||
|
List<SysDept> list = new ArrayList<>();
|
||||||
|
List<SysDept> deptChildList = new ArrayList<>(deptList);
|
||||||
|
list.addAll(deptChildList.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(dept -> dept.getParentId().equals(sysDept.getDeptId())).toList());
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
list.forEach(sysDeptChild -> deptChildList.addAll(this.getChildSysDept(deptChildList, sysDeptChild)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,8 +125,7 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateAssetImpower(AssetImpower assetImpower)
|
public int updateAssetImpower(AssetImpower assetImpower) {
|
||||||
{
|
|
||||||
assetImpower.setUpdateTime(DateUtils.getNowDate());
|
assetImpower.setUpdateTime(DateUtils.getNowDate());
|
||||||
return assetImpowerMapper.updateAssetImpower(assetImpower);
|
return assetImpowerMapper.updateAssetImpower(assetImpower);
|
||||||
}
|
}
|
||||||
|
@ -79,8 +137,7 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAssetImpowerByIds(Long[] ids)
|
public int deleteAssetImpowerByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return assetImpowerMapper.deleteAssetImpowerByIds(ids);
|
return assetImpowerMapper.deleteAssetImpowerByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +148,14 @@ public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper,Asse
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAssetImpowerById(Long id)
|
public int deleteAssetImpowerById(Long id) {
|
||||||
{
|
|
||||||
return assetImpowerMapper.deleteAssetImpowerById(id);
|
return assetImpowerMapper.deleteAssetImpowerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AssetImpower> getPowerByTableId(Long tableId) {
|
||||||
|
return this.selectAssetImpowerList(new AssetImpower() {{
|
||||||
|
setTableId(tableId);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.etl.domain.BasicConfigInfo;
|
import com.muyu.etl.domain.BasicConfigInfo;
|
||||||
import com.muyu.etl.domain.Structure;
|
import com.muyu.etl.domain.Structure;
|
||||||
import com.muyu.etl.domain.TableInfo;
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
import com.muyu.etl.domain.resp.BasicTableInfoResp;
|
||||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||||
import com.muyu.etl.domain.resp.TableTreeResp;
|
import com.muyu.etl.domain.resp.TableTreeResp;
|
||||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||||
|
@ -116,6 +117,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试连接并同步
|
* 测试连接并同步
|
||||||
|
*
|
||||||
* @param basicConfigInfo
|
* @param basicConfigInfo
|
||||||
* @return
|
* @return
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
|
@ -142,6 +144,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
.parentId(0L)
|
.parentId(0L)
|
||||||
.tableRemark("")
|
.tableRemark("")
|
||||||
.center("Y")
|
.center("Y")
|
||||||
|
.type("dataSource")
|
||||||
.tableName(basicConfigInfo.getDataSourcesSystemName() + "(" + databaseName + ")")
|
.tableName(basicConfigInfo.getDataSourcesSystemName() + "(" + databaseName + ")")
|
||||||
.createBy(SecurityUtils.getUsername())
|
.createBy(SecurityUtils.getUsername())
|
||||||
.createTime(new Date())
|
.createTime(new Date())
|
||||||
|
@ -173,6 +176,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
//bug点,tableRemark为空,造成空指针异常
|
//bug点,tableRemark为空,造成空指针异常
|
||||||
.tableRemark(tableRemark == null ? "" : tableRemark)
|
.tableRemark(tableRemark == null ? "" : tableRemark)
|
||||||
.parentId(tableInfo.getId())
|
.parentId(tableInfo.getId())
|
||||||
|
.type("dataTable")
|
||||||
.center("Y")
|
.center("Y")
|
||||||
.updateBy(SecurityUtils.getUsername())
|
.updateBy(SecurityUtils.getUsername())
|
||||||
.dataNum(rowCount)
|
.dataNum(rowCount)
|
||||||
|
@ -186,7 +190,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
//线程池
|
//线程池
|
||||||
ExecutorService threadPool = Executors.newCachedThreadPool();
|
ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
threadPool.submit(()->{
|
threadPool.submit(() -> {
|
||||||
try {
|
try {
|
||||||
syncData(finalConn, databaseName, table);
|
syncData(finalConn, databaseName, table);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -223,6 +227,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步数据
|
* 同步数据
|
||||||
|
*
|
||||||
* @param conn
|
* @param conn
|
||||||
* @param databaseName
|
* @param databaseName
|
||||||
* @param table
|
* @param table
|
||||||
|
@ -310,12 +315,12 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
}}).stream().map(info -> {
|
}}).stream().map(info -> {
|
||||||
TableInfoStructureResp tableInfoStructureResp = null;
|
TableInfoStructureResp tableInfoStructureResp = null;
|
||||||
Future<TableInfoStructureResp> submit = threadPool.submit(() -> {
|
Future<TableInfoStructureResp> submit = threadPool.submit(() -> {
|
||||||
// List<Structure> structureList = structureService.list(new LambdaQueryWrapper<Structure>().eq(Structure::getTableId, info.getId()));
|
|
||||||
return TableInfoStructureResp.builder()
|
return TableInfoStructureResp.builder()
|
||||||
.id(info.getId())
|
.id(info.getId())
|
||||||
.tableName(info.getTableName())
|
.tableName(info.getTableName())
|
||||||
.center(info.getCenter())
|
.center(info.getCenter())
|
||||||
.tableRemark(info.getTableRemark())
|
.tableRemark(info.getTableRemark())
|
||||||
|
.type(info.getType())
|
||||||
.dataNum(info.getDataNum())
|
.dataNum(info.getDataNum())
|
||||||
.parentId(info.getParentId())
|
.parentId(info.getParentId())
|
||||||
.databaseType(basicConfigInfo.getDatabaseType())
|
.databaseType(basicConfigInfo.getDatabaseType())
|
||||||
|
@ -362,5 +367,44 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasicTableInfoResp getBasicTableInfo(Long tableId) {
|
||||||
|
TableInfo tableInfo = tableInfoService.selectTableInfoById(tableId);
|
||||||
|
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
|
||||||
|
String host = basicConfigInfo.getHost();
|
||||||
|
String port = basicConfigInfo.getPort();
|
||||||
|
String databaseName = basicConfigInfo.getDatabaseName();
|
||||||
|
String databaseType = basicConfigInfo.getDatabaseType();
|
||||||
|
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + basicConfigInfo.getConnectionParams();
|
||||||
|
String user = basicConfigInfo.getUsername();
|
||||||
|
String password = basicConfigInfo.getPassword();
|
||||||
|
Long totalNum = null;
|
||||||
|
BasicTableInfoResp basicTableInfoResp = null;
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
|
PreparedStatement ps = conn.prepareStatement("select Count(0) from " + tableInfo.getTableName());
|
||||||
|
ResultSet resultSet = ps.executeQuery();
|
||||||
|
while (resultSet.next()){
|
||||||
|
String a = String.valueOf(resultSet.getObject(1));
|
||||||
|
totalNum = resultSet.getLong(1);
|
||||||
|
}
|
||||||
|
basicTableInfoResp = BasicTableInfoResp.builder()
|
||||||
|
.dataResourceName(basicConfigInfo.getDataResourceName())
|
||||||
|
.dataSourcesSystemName(basicConfigInfo.getDataSourcesSystemName())
|
||||||
|
.databaseName(basicConfigInfo.getDatabaseName())
|
||||||
|
.tableName(tableInfo.getTableName())
|
||||||
|
.tableRemark(tableInfo.getTableRemark())
|
||||||
|
.id(tableId)
|
||||||
|
.basicId(basicConfigInfo.getId())
|
||||||
|
.totalNum(totalNum)
|
||||||
|
.build();
|
||||||
|
ps.close();
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return basicTableInfoResp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<resultMap type="com.muyu.etl.domain.AssetImpower" id="AssetImpowerResult">
|
<resultMap type="com.muyu.etl.domain.AssetImpower" id="AssetImpowerResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
<result property="basicId" column="basic_id" />
|
||||||
<result property="tableId" column="table_id" />
|
<result property="tableId" column="table_id" />
|
||||||
<result property="typeId" column="type_id" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="userId" column="user_id" />
|
<result property="userId" column="user_id" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
|
@ -17,14 +18,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAssetImpowerVo">
|
<sql id="selectAssetImpowerVo">
|
||||||
select id, table_id, type_id, user_id, remark, create_by, create_time, update_by, update_time from asset_impower
|
select id,basic_id , table_id, dept_id, user_id, remark, create_by, create_time, update_by, update_time from asset_impower
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAssetImpowerList" parameterType="com.muyu.etl.domain.AssetImpower" resultMap="AssetImpowerResult">
|
<select id="selectAssetImpowerList" parameterType="com.muyu.etl.domain.AssetImpower" resultMap="AssetImpowerResult">
|
||||||
<include refid="selectAssetImpowerVo"/>
|
<include refid="selectAssetImpowerVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="tableId != null "> and table_id = #{tableId}</if>
|
<if test="tableId != null "> and table_id = #{tableId}</if>
|
||||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
@ -37,8 +38,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<insert id="insertAssetImpower" parameterType="com.muyu.etl.domain.AssetImpower" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertAssetImpower" parameterType="com.muyu.etl.domain.AssetImpower" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into asset_impower
|
insert into asset_impower
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="basicId != null">basic_id,</if>
|
||||||
<if test="tableId != null">table_id,</if>
|
<if test="tableId != null">table_id,</if>
|
||||||
<if test="typeId != null">type_id,</if>
|
<if test="deptId != null">dept_id,</if>
|
||||||
<if test="userId != null">user_id,</if>
|
<if test="userId != null">user_id,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
|
@ -47,8 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="basicId != null">#{basicId},</if>
|
||||||
<if test="tableId != null">#{tableId},</if>
|
<if test="tableId != null">#{tableId},</if>
|
||||||
<if test="typeId != null">#{typeId},</if>
|
<if test="deptId != null">#{deptId},</if>
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
@ -61,8 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateAssetImpower" parameterType="com.muyu.etl.domain.AssetImpower">
|
<update id="updateAssetImpower" parameterType="com.muyu.etl.domain.AssetImpower">
|
||||||
update asset_impower
|
update asset_impower
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="basicId != null">basic_id = #{basicId},</if>
|
||||||
<if test="tableId != null">table_id = #{tableId},</if>
|
<if test="tableId != null">table_id = #{tableId},</if>
|
||||||
<if test="typeId != null">type_id = #{typeId},</if>
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<result property="tableRemark" column="table_remark" />
|
<result property="tableRemark" column="table_remark" />
|
||||||
<result property="dataNum" column="data_num" />
|
<result property="dataNum" column="data_num" />
|
||||||
<result property="center" column="center" />
|
<result property="center" column="center" />
|
||||||
|
<result property="type" column="type" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
@ -20,18 +21,18 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTableInfoVo">
|
<sql id="selectTableInfoVo">
|
||||||
select id, parent_id, basic_id,table_name, table_remark, data_num, center, remark, create_by, create_time, update_by, update_time from table_info
|
select id, parent_id,type, basic_id,table_name, table_remark, data_num, center, remark, create_by, create_time, update_by, update_time from table_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectTableInfoList" parameterType="com.muyu.etl.domain.TableInfo" resultMap="TableInfoResult">
|
<select id="selectTableInfoList" parameterType="com.muyu.etl.domain.TableInfo" resultMap="TableInfoResult">
|
||||||
<include refid="selectTableInfoVo"/>
|
<include refid="selectTableInfoVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
<if test="parentId != null ">and parent_id = #{parentId}</if>
|
||||||
<if test="basicId != null "> and basic_id = #{basicId}</if>
|
<if test="basicId != null ">and basic_id = #{basicId}</if>
|
||||||
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
<if test="tableName != null and tableName != ''">and table_name like concat('%', #{tableName}, '%')</if>
|
||||||
<if test="tableRemark != null and tableRemark != ''"> and table_remark = #{tableRemark}</if>
|
<if test="tableRemark != null and tableRemark != ''">and table_remark = #{tableRemark}</if>
|
||||||
<if test="dataNum != null "> and data_num = #{dataNum}</if>
|
<if test="dataNum != null ">and data_num = #{dataNum}</if>
|
||||||
<if test="center != null and center != ''"> and center = #{center}</if>
|
<if test="center != null and center != ''">and center = #{center}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -42,8 +43,8 @@
|
||||||
|
|
||||||
<select id="selectTableInfoByName" parameterType="com.muyu.etl.domain.TableInfo" resultMap="TableInfoResult">
|
<select id="selectTableInfoByName" parameterType="com.muyu.etl.domain.TableInfo" resultMap="TableInfoResult">
|
||||||
select * from table_info
|
select * from table_info
|
||||||
where basic_id = #{basicId} and table_name = #{tableName}
|
where basic_id = #{basicId} and (table_name = #{tableName} or parent_id = #{parentId})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertTableInfo" parameterType="com.muyu.etl.domain.TableInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertTableInfo" parameterType="com.muyu.etl.domain.TableInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="parentId != null">parent_id,</if>
|
<if test="parentId != null">parent_id,</if>
|
||||||
<if test="basicId != null">basic_id,</if>
|
<if test="basicId != null">basic_id,</if>
|
||||||
|
<if test="type != null and type != ''">type,</if>
|
||||||
<if test="tableName != null and tableName != ''">table_name,</if>
|
<if test="tableName != null and tableName != ''">table_name,</if>
|
||||||
<if test="tableRemark != null and tableRemark != ''">table_remark,</if>
|
<if test="tableRemark != null and tableRemark != ''">table_remark,</if>
|
||||||
<if test="dataNum != null">data_num,</if>
|
<if test="dataNum != null">data_num,</if>
|
||||||
|
@ -64,6 +66,7 @@
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="parentId != null">#{parentId},</if>
|
<if test="parentId != null">#{parentId},</if>
|
||||||
<if test="basicId != null">#{basicId},</if>
|
<if test="basicId != null">#{basicId},</if>
|
||||||
|
<if test="type != null and type != ''">#{type},</if>
|
||||||
<if test="tableName != null and tableName != ''">#{tableName},</if>
|
<if test="tableName != null and tableName != ''">#{tableName},</if>
|
||||||
<if test="tableRemark != null and tableRemark != ''">#{tableRemark},</if>
|
<if test="tableRemark != null and tableRemark != ''">#{tableRemark},</if>
|
||||||
<if test="dataNum != null">#{dataNum},</if>
|
<if test="dataNum != null">#{dataNum},</if>
|
||||||
|
@ -81,6 +84,7 @@
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
<if test="basicId != null">basic_id = #{basicId},</if>
|
<if test="basicId != null">basic_id = #{basicId},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
|
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
|
||||||
<if test="tableRemark != null and tableRemark != ''">table_remark = #{tableRemark},</if>
|
<if test="tableRemark != null and tableRemark != ''">table_remark = #{tableRemark},</if>
|
||||||
<if test="dataNum != null">data_num = #{dataNum},</if>
|
<if test="dataNum != null">data_num = #{dataNum},</if>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<module>muyu-job</module>
|
<module>muyu-job</module>
|
||||||
<module>muyu-file</module>
|
<module>muyu-file</module>
|
||||||
<module>muyv-etl</module>
|
<module>muyv-etl</module>
|
||||||
|
<module>muyu-ruleEngine</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>muyu-modules</artifactId>
|
<artifactId>muyu-modules</artifactId>
|
||||||
|
|
7
pom.xml
7
pom.xml
|
@ -213,6 +213,13 @@
|
||||||
<version>${muyu.version}</version>
|
<version>${muyu.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 规则引擎 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-ruleEngine-common</artifactId>
|
||||||
|
<version>${muyu.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue