Compare commits
30 Commits
master
...
xiaohuang1
Author | SHA1 | Date |
---|---|---|
|
e7336a4f59 | |
|
1abb6e89b9 | |
|
e10817cb1b | |
|
d4ac304b07 | |
|
8a33e76f51 | |
|
9b76b6fae4 | |
|
8a1699ddfd | |
|
389f0be640 | |
|
07a2fc9618 | |
|
e69291cd38 | |
|
b0f0c3afe5 | |
|
8498476226 | |
|
c6756775ce | |
|
f3b13ba059 | |
|
28d6400be9 | |
|
15484a31a5 | |
|
606a05d68e | |
|
ed38fe8109 | |
|
5da4983e6d | |
|
8839f7fe20 | |
|
29b4db789c | |
|
15032a82ac | |
|
dc69c82be1 | |
|
3cf6d5a4a4 | |
|
85d618c40b | |
|
5ccc0bf14d | |
|
4941fe0cd0 | |
|
b8901b21ba | |
|
d8974355f6 | |
|
599ba80804 |
|
@ -43,8 +43,8 @@ public class SysLoginService {
|
|||
public LoginUser login (String username, String password) {
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户或邮箱/密码必须填写");
|
||||
throw new ServiceException("用户或邮箱/密码必须填写");
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|
@ -69,6 +69,7 @@ public class SysLoginService {
|
|||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -58,7 +58,7 @@ public class IpUtils {
|
|||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "43.142.100.73" : getMultistageReverseProxyIp(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +70,7 @@ public class IpUtils {
|
|||
*/
|
||||
public static boolean internalIp (String ip) {
|
||||
byte[] addr = textToNumericFormatV4(ip);
|
||||
return internalIp(addr) || "127.0.0.1".equals(ip);
|
||||
return internalIp(addr) || "43.142.100.73".equals(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +197,7 @@ public class IpUtils {
|
|||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
return "127.0.0.1";
|
||||
return "43.142.100.73";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,12 +3,16 @@ package com.muyu.common.system.remote;
|
|||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
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.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
|
@ -37,4 +41,24 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@PostMapping("/user/register")
|
||||
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;
|
||||
|
||||
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.SysDept;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
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);
|
||||
|
||||
@Override
|
||||
public RemoteUserService create (Throwable throwable) {
|
||||
public RemoteUserService create(Throwable throwable) {
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService() {
|
||||
@Override
|
||||
public Result<LoginUser> getUserInfo (String username, String source) {
|
||||
public Result<LoginUser> getUserInfo(String username, String source) {
|
||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
public Result<Boolean> registerUserInfo(SysUser sysUser, String source) {
|
||||
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());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -28,12 +28,12 @@ spring:
|
|||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
dashboard: 127.0.0.1:8718
|
||||
dashboard: 43.142.100.73:8718
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -50,7 +50,7 @@ public class VelocityUtils {
|
|||
VelocityContext velocityContext = new VelocityContext();
|
||||
velocityContext.put("tplCategory", genTable.getTplCategory());
|
||||
velocityContext.put("tableName", genTable.getTableName());
|
||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "");
|
||||
velocityContext.put("ClassName", genTable.getClassName());
|
||||
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
||||
velocityContext.put("moduleName", genTable.getModuleName());
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -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,65 @@
|
|||
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 engineCode;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 是否激活 */
|
||||
@Excel(name = "是否激活")
|
||||
private String isActivate;
|
||||
|
||||
/** 规则状态 */
|
||||
@Excel(name = "规则状态")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.engine.domain;
|
||||
|
||||
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_version
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class RuleEngineVersion extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 引擎id */
|
||||
@Excel(name = "引擎id")
|
||||
private Long ruleEngineId;
|
||||
|
||||
/** 版本类 */
|
||||
@Excel(name = "版本类")
|
||||
private String versionCode;
|
||||
|
||||
/** 版本名称 */
|
||||
@Excel(name = "版本名称")
|
||||
private String name;
|
||||
|
||||
/** 版本code */
|
||||
@Excel(name = "版本code")
|
||||
private String code;
|
||||
|
||||
/** 引擎编码 */
|
||||
@Excel(name = "引擎编码")
|
||||
private String codeIng;
|
||||
|
||||
/** 是否激活 */
|
||||
@Excel(name = "是否激活")
|
||||
private String isActivate;
|
||||
|
||||
/** 测试状态 */
|
||||
@Excel(name = "是否激活")
|
||||
private String isTest;
|
||||
|
||||
/** 版本状态 */
|
||||
@Excel(name = "版本状态")
|
||||
private String status;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
|
@ -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,7 @@
|
|||
package com.muyu;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -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,24 @@
|
|||
package com.muyu;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @ClassName RuleEngineApplication
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/3 11:43
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class RuleEngineApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuleEngineApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
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,103 @@
|
|||
package com.muyu.engine.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
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.RuleEngineVersion;
|
||||
import com.muyu.engine.service.RuleEngineVersionService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 规则版本Controller
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/version")
|
||||
public class RuleEngineVersionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private RuleEngineVersionService ruleEngineVersionService;
|
||||
|
||||
/**
|
||||
* 查询规则版本列表
|
||||
*/
|
||||
@RequiresPermissions("engine:version:list")
|
||||
@GetMapping("/list/{ruleEngineId}")
|
||||
public Result<TableDataInfo<RuleEngineVersion>> list(@PathVariable Long ruleEngineId)
|
||||
{
|
||||
List<RuleEngineVersion> list = ruleEngineVersionService.selectRuleEngineVersionList(ruleEngineId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出规则版本列表
|
||||
*/
|
||||
@RequiresPermissions("engine:version:export")
|
||||
@Log(title = "规则版本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Long ruleEngineId)
|
||||
{
|
||||
List<RuleEngineVersion> list = ruleEngineVersionService.selectRuleEngineVersionList(ruleEngineId);
|
||||
ExcelUtil<RuleEngineVersion> util = new ExcelUtil<RuleEngineVersion>(RuleEngineVersion.class);
|
||||
util.exportExcel(response, list, "规则版本数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规则版本详细信息
|
||||
*/
|
||||
@RequiresPermissions("engine:version:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(ruleEngineVersionService.selectRuleEngineVersionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则版本
|
||||
*/
|
||||
@RequiresPermissions("engine:version:add")
|
||||
@Log(title = "规则版本", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody RuleEngineVersion ruleEngineVersion)
|
||||
{
|
||||
return toAjax(ruleEngineVersionService.insertRuleEngineVersion(ruleEngineVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则版本
|
||||
*/
|
||||
@RequiresPermissions("engine:version:edit")
|
||||
@Log(title = "规则版本", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody RuleEngineVersion ruleEngineVersion)
|
||||
{
|
||||
return toAjax(ruleEngineVersionService.updateRuleEngineVersion(ruleEngineVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则版本
|
||||
*/
|
||||
@RequiresPermissions("engine:version:remove")
|
||||
@Log(title = "规则版本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(ruleEngineVersionService.deleteRuleEngineVersionByIds(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.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.engine.domain.RuleEngineVersion;
|
||||
|
||||
/**
|
||||
* 规则版本Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface RuleEngineVersionMapper extends BaseMapper<RuleEngineVersion>
|
||||
{
|
||||
/**
|
||||
* 查询规则版本
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 规则版本
|
||||
*/
|
||||
public RuleEngineVersion selectRuleEngineVersionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则版本列表
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 规则版本集合
|
||||
*/
|
||||
public List<RuleEngineVersion> selectRuleEngineVersionList(RuleEngineVersion ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 新增规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRuleEngineVersion(RuleEngineVersion ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 修改规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRuleEngineVersion(RuleEngineVersion ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 删除规则版本
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineVersionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除规则版本
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineVersionByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.engine.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.engine.domain.RuleEngine;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
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,63 @@
|
|||
package com.muyu.engine.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.engine.domain.RuleEngineVersion;
|
||||
|
||||
/**
|
||||
* 规则版本Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface RuleEngineVersionService extends IService<RuleEngineVersion>
|
||||
{
|
||||
/**
|
||||
* 查询规则版本
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 规则版本
|
||||
*/
|
||||
public RuleEngineVersion selectRuleEngineVersionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则版本列表
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 规则版本集合
|
||||
*/
|
||||
public List<RuleEngineVersion> selectRuleEngineVersionList(Long ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 新增规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRuleEngineVersion(RuleEngineVersion ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 修改规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRuleEngineVersion(RuleEngineVersion ruleEngineVersion);
|
||||
|
||||
/**
|
||||
* 批量删除规则版本
|
||||
*
|
||||
* @param ids 需要删除的规则版本主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineVersionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除规则版本信息
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineVersionById(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());
|
||||
ruleEngine.setEngineCode("engine_custom_" + ruleEngine.getCode());
|
||||
boolean save = this.save(ruleEngine);
|
||||
if (save) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则引擎
|
||||
*
|
||||
* @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,204 @@
|
|||
package com.muyu.engine.service.impl;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.common.base.Supplier;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.service.RuleEngineService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.engine.mapper.RuleEngineVersionMapper;
|
||||
import com.muyu.engine.domain.RuleEngineVersion;
|
||||
import com.muyu.engine.service.RuleEngineVersionService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
/**
|
||||
* 规则版本Service业务层处理
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class RuleEngineVersionServiceImpl extends ServiceImpl<RuleEngineVersionMapper,RuleEngineVersion> implements RuleEngineVersionService
|
||||
{
|
||||
@Autowired
|
||||
private RuleEngineVersionMapper ruleEngineVersionMapper;
|
||||
@Autowired
|
||||
private RuleEngineService ruleEngineService;
|
||||
|
||||
/**
|
||||
* 查询规则版本
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 规则版本
|
||||
*/
|
||||
@Override
|
||||
public RuleEngineVersion selectRuleEngineVersionById(Long id)
|
||||
{
|
||||
return ruleEngineVersionMapper.selectRuleEngineVersionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则版本列表
|
||||
*
|
||||
* @param ruleEngineId 规则版本
|
||||
* @return 规则版本
|
||||
*/
|
||||
@Override
|
||||
public List<RuleEngineVersion> selectRuleEngineVersionList(Long ruleEngineId)
|
||||
{
|
||||
return list(new LambdaQueryWrapper<RuleEngineVersion>(){{
|
||||
eq(RuleEngineVersion::getRuleEngineId,ruleEngineId);
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRuleEngineVersion(RuleEngineVersion ruleEngineVersion)
|
||||
{
|
||||
ruleEngineVersion.setCreateTime(DateUtils.getNowDate());
|
||||
return ruleEngineVersionMapper.insertRuleEngineVersion(ruleEngineVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则版本
|
||||
*
|
||||
* @param ruleEngineVersion 规则版本
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRuleEngineVersion(RuleEngineVersion ruleEngineVersion)
|
||||
{
|
||||
ruleEngineVersion.setUpdateTime(DateUtils.getNowDate());
|
||||
return ruleEngineVersionMapper.updateRuleEngineVersion(ruleEngineVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除规则版本
|
||||
*
|
||||
* @param ids 需要删除的规则版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineVersionByIds(Long[] ids)
|
||||
{
|
||||
return ruleEngineVersionMapper.deleteRuleEngineVersionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则版本信息
|
||||
*
|
||||
* @param id 规则版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineVersionById(Long id)
|
||||
{
|
||||
return ruleEngineVersionMapper.deleteRuleEngineVersionById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
public boolean testEngine(Long id) throws Exception {
|
||||
// RuleEngine ruleEngine = ruleEngineService.getById(id);
|
||||
// if (ruleEngine.getIsActivate().contains("no")) throw new ServletException("未激活");
|
||||
// if (ruleEngine.getStatus().contains("1")) throw new ServletException("已停用");
|
||||
// Scope scope = this.getOne(new LambdaQueryWrapper<Scope>() {{
|
||||
// eq(Scope::getRuleEngineId, ruleEngine.getId());
|
||||
// eq(Scope::getValue, "taskContext");
|
||||
// }});
|
||||
// String code = scope.getCode();
|
||||
// String path = code.substring(code.indexOf("com"), code.indexOf(";")).replaceAll("/.", "/").trim();
|
||||
// String fileName = code.substring(code.indexOf("class") + 6, code.indexOf("{")).trim();
|
||||
// String name = path+"."+fileName;
|
||||
// String javaPackageName = name.replace(".", File.separator)+".java";
|
||||
// String javaAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/src/main/java/" +javaPackageName;
|
||||
// String jarAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/target/classes/com/muyu/engine/controller";
|
||||
// Process process = Runtime.getRuntime().exec("javac -classpath "+ jarAbsolutePath+ " " + javaAbsolutePath);
|
||||
// try {
|
||||
// int exitVal = process.waitFor();
|
||||
// System.out.println("Process exitValue: " + exitVal);
|
||||
// ClassLoader classLoader = ReflectionUtils.class.getClassLoader();
|
||||
// Class aClass = classLoader.loadClass(name);
|
||||
// Object o = aClass.newInstance();
|
||||
// Method[] methods = aClass.getMethods();
|
||||
// for (Method method : methods) {
|
||||
// method.invoke(o,null);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage());
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 引擎流程并执行测试
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
public boolean init(Long id) throws ServletException {
|
||||
RuleEngine ruleEngine = ruleEngineService.getById(id);
|
||||
if (ruleEngine.getIsActivate().contains("no")) throw new ServletException("未激活");
|
||||
if (ruleEngine.getStatus().contains("1")) throw new ServletException("已停用");
|
||||
Supplier<Boolean> booleanSupplier = () -> {
|
||||
try {
|
||||
return testEngine(ruleEngine);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
System.out.println();
|
||||
return booleanSupplier.get();
|
||||
}
|
||||
|
||||
private Boolean testEngine(RuleEngine ruleEngine) throws ServletException, IOException {
|
||||
// System.out.println("初始化");
|
||||
// System.out.println(ruleEngine);
|
||||
// Scope scope = this.getOne(new LambdaQueryWrapper<Scope>() {{
|
||||
// eq(Scope::getRuleEngineId, ruleEngine.getId());
|
||||
// eq(Scope::getValue, "taskContext");
|
||||
// }});
|
||||
// String code = scope.getCode();
|
||||
// String path = code.substring(code.indexOf("com"), code.indexOf(";")).replaceAll("\\.", "/").trim();
|
||||
// String fileName = code.substring(code.indexOf("class") + 6, code.indexOf("{")).trim();
|
||||
// //代码编译
|
||||
// File file = new File("D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/src/main/java/" + path + "/" + fileName + ".java");
|
||||
// if (!file.exists()) {
|
||||
// //不存在创建
|
||||
// file.createNewFile();
|
||||
// }else {
|
||||
// //存在测重新创建
|
||||
// file.delete();
|
||||
// file.createNewFile();
|
||||
// }
|
||||
// String[] split = code.split("/n");
|
||||
// //OutputStreamWriter对象将字符转换为字节流,指定了文件输出流和编码方式。
|
||||
// OutputStreamWriter outputStreamWriter =
|
||||
// new OutputStreamWriter(new FileOutputStream(file, true), "UTF-8");
|
||||
// //BufferedWriter对象,用于缓冲写入数据,提高写入效率。
|
||||
// BufferedWriter bw = new BufferedWriter(outputStreamWriter);
|
||||
// for (String str : split) {
|
||||
// bw.write(str);
|
||||
// bw.newLine();
|
||||
// }
|
||||
// bw.close();
|
||||
// outputStreamWriter.close();
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
# 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}
|
||||
main:
|
||||
allow-circular-references: true
|
||||
logging:
|
||||
level:
|
||||
com.muyu.engine.mapper: DEBUG
|
|
@ -0,0 +1,113 @@
|
|||
<?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="engineCode" column="engine_code" />
|
||||
<result property="description" column="description" />
|
||||
<result property="isActivate" column="is_activate" />
|
||||
<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,engine_code,description, is_activate, 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="engineCode != null and engineCode != ''"> and engine_code = #{engineCode}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="isActivate != null and isActivate != ''"> and is_activate = #{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="engineCode != null">engine_code,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="isActivate != null">is_activate,</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="engine_code != null">#{engineCode},</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="engineCode != null">engine_code = #{engineCode},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="isActivate != null">is_activate = #{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,116 @@
|
|||
<?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.RuleEngineVersionMapper">
|
||||
|
||||
<resultMap type="com.muyu.engine.domain.RuleEngineVersion" id="RuleEngineVersionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ruleEngineId" column="rule_engine_id" />
|
||||
<result property="versionCode" column="version_code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="code" column="code" />
|
||||
<result property="codeIng" column="codeIng" />
|
||||
<result property="isActivate" column="is_activate" />
|
||||
<result property="isTest" column="is_test" />
|
||||
<result property="status" column="status" />
|
||||
<result property="description" column="description" />
|
||||
<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="selectRuleEngineVersionVo">
|
||||
select id, rule_engine_id, version_code, name, code, code_ing, is_activate,is_test, status, description, remark, create_by, create_time, update_by, update_time from rule_engine_version
|
||||
</sql>
|
||||
|
||||
<select id="selectRuleEngineVersionList" parameterType="com.muyu.engine.domain.RuleEngineVersion" resultMap="RuleEngineVersionResult">
|
||||
<include refid="selectRuleEngineVersionVo"/>
|
||||
<where>
|
||||
<if test="ruleEngineId != null "> and rule_engine_id = #{ruleEngineId}</if>
|
||||
<if test="versionCode != null and versionCode != ''"> and version_code = #{versionCode}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||
<if test="codeIng != null and codeIng != ''"> and code_ing = #{codeIng}</if>
|
||||
<if test="isActivate != null and isActivate != ''"> and is_activate = #{isActivate}</if>
|
||||
<if test="isTest != null and isTest != ''"> and is_test = #{isTest}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRuleEngineVersionById" parameterType="Long" resultMap="RuleEngineVersionResult">
|
||||
<include refid="selectRuleEngineVersionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRuleEngineVersion" parameterType="com.muyu.engine.domain.RuleEngineVersion" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rule_engine_version
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleEngineId != null">rule_engine_id,</if>
|
||||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="code != null">code,</if>
|
||||
<if test="codeIng != null">code_ing,</if>
|
||||
<if test="isActivate != null">is_activate,</if>
|
||||
<if test="isTest != null">is_test,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="description != null">description,</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="ruleEngineId != null">#{ruleEngineId},</if>
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="codeIng != null">#{codeIng},</if>
|
||||
<if test="isActivate != null">#{isActivate},</if>
|
||||
<if test="isTest != null">#{isTest},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="description != null">#{description},</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="updateRuleEngineVersion" parameterType="com.muyu.engine.domain.RuleEngineVersion">
|
||||
update rule_engine_version
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ruleEngineId != null">rule_engine_id = #{ruleEngineId},</if>
|
||||
<if test="versionCode != null">version_code = #{versionCode},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="codeIng != null">code_ing = #{codeIng},</if>
|
||||
<if test="isActivate != null">is_activate = #{isActivate},</if>
|
||||
<if test="isTest != null">is_test = #{isTest},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="description != null">description = #{description},</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="deleteRuleEngineVersionById" parameterType="Long">
|
||||
delete from rule_engine_version where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRuleEngineVersionByIds" parameterType="String">
|
||||
delete from rule_engine_version 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>
|
|
@ -0,0 +1,104 @@
|
|||
//package com.muyu.system.controller;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.PutMapping;
|
||||
//import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
//import org.springframework.web.bind.annotation.PathVariable;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//import com.muyu.common.log.annotation.Log;
|
||||
//import com.muyu.common.log.enums.BusinessType;
|
||||
//import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
//import com.muyu.system.domain.AsNoticeUser;
|
||||
//import com.muyu.system.service.AsNoticeUserService;
|
||||
//import com.muyu.common.core.web.controller.BaseController;
|
||||
//import com.muyu.common.core.domain.Result;
|
||||
//import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
//import com.muyu.common.core.web.page.TableDataInfo;
|
||||
//
|
||||
///**
|
||||
// * 通知公告人员中间Controller
|
||||
// *
|
||||
// * @author muyu
|
||||
// * @date 2024-04-13
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("/user")
|
||||
//public class AsNoticeUserController extends BaseController
|
||||
//{
|
||||
// @Autowired
|
||||
// private AsNoticeUserService asNoticeUserService;
|
||||
//
|
||||
// /**
|
||||
// * 查询通知公告人员中间列表
|
||||
// */
|
||||
// @RequiresPermissions("system:user:list")
|
||||
// @GetMapping("/list")
|
||||
// public Result<TableDataInfo<AsNoticeUser>> list(AsNoticeUser asNoticeUser)
|
||||
// {
|
||||
// startPage();
|
||||
// List<AsNoticeUser> list = asNoticeUserService.selectAsNoticeUserList(asNoticeUser);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 导出通知公告人员中间列表
|
||||
// */
|
||||
// @RequiresPermissions("system:user:export")
|
||||
// @Log(title = "通知公告人员中间", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(HttpServletResponse response, AsNoticeUser asNoticeUser)
|
||||
// {
|
||||
// List<AsNoticeUser> list = asNoticeUserService.selectAsNoticeUserList(asNoticeUser);
|
||||
// ExcelUtil<AsNoticeUser> util = new ExcelUtil<AsNoticeUser>(AsNoticeUser.class);
|
||||
// util.exportExcel(response, list, "通知公告人员中间数据");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取通知公告人员中间详细信息
|
||||
// */
|
||||
// @RequiresPermissions("system:user:query")
|
||||
// @GetMapping(value = "/{id}")
|
||||
// public Result getInfo(@PathVariable("id") Long id)
|
||||
// {
|
||||
// return success(asNoticeUserService.selectAsNoticeUserById(id));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增通知公告人员中间
|
||||
// */
|
||||
// @RequiresPermissions("system:user:add")
|
||||
// @Log(title = "通知公告人员中间", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public Result add(@RequestBody AsNoticeUser asNoticeUser)
|
||||
// {
|
||||
// return toAjax(asNoticeUserService.insertAsNoticeUser(asNoticeUser));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改通知公告人员中间
|
||||
// */
|
||||
// @RequiresPermissions("system:user:edit")
|
||||
// @Log(title = "通知公告人员中间", businessType = BusinessType.UPDATE)
|
||||
// @PutMapping
|
||||
// public Result edit(@RequestBody AsNoticeUser asNoticeUser)
|
||||
// {
|
||||
// return toAjax(asNoticeUserService.updateAsNoticeUser(asNoticeUser));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除通知公告人员中间
|
||||
// */
|
||||
// @RequiresPermissions("system:user:remove")
|
||||
// @Log(title = "通知公告人员中间", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public Result remove(@PathVariable Long[] ids)
|
||||
// {
|
||||
// return toAjax(asNoticeUserService.deleteAsNoticeUserByIds(ids));
|
||||
// }
|
||||
//}
|
|
@ -34,11 +34,21 @@ public class SysDeptController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:dept:list")
|
||||
@GetMapping("/list")
|
||||
public Result list (SysDept dept) {
|
||||
public Result<List<SysDept>> list (SysDept dept) {
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门列表(children)
|
||||
*/
|
||||
@RequiresPermissions("system:dept:list")
|
||||
@GetMapping("/listDeptFind")
|
||||
public Result listDeptFind () {
|
||||
return success(deptService.listDeptFind());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,13 @@ import com.muyu.common.log.annotation.Log;
|
|||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.system.domain.AsNoticeUser;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import com.muyu.system.domain.req.ReadEditReq;
|
||||
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -31,9 +37,9 @@ public class SysNoticeController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:notice:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) {
|
||||
public Result<TableDataInfo<SysNoticeResp>> list (SysNotice notice) {
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
List<SysNoticeResp> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -52,9 +58,26 @@ public class SysNoticeController extends BaseController {
|
|||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysNotice notice) {
|
||||
notice.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
public Result add (@Validated @RequestBody AsNoticeUserReq req) {
|
||||
if (req.getInDateTime() ==null || req.getSelectedOptions().isEmpty() || req.getUserCheckedList().isEmpty()){
|
||||
return Result.error("请检查有效日期,选中接收人,不能为空");
|
||||
}
|
||||
return toAjax(noticeService.insertNotice(req));
|
||||
}
|
||||
|
||||
@Log(title = "修改已读状态", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("readEdit/{asNoticeId}")
|
||||
public Result readEdit(@PathVariable Long asNoticeId){
|
||||
return toAjax(noticeService.updateAsNoticeUser(asNoticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户获取自己所有的通知和公告
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("noticeByUserId")
|
||||
public Result<List<AsNoticeUserResp>> noticeByUserId(@RequestBody SelectAsNoticeUserReq req){
|
||||
return Result.success(noticeService.noticeByUserId(req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.constant.CacheConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.utils.file.FileTypeUtils;
|
||||
|
@ -7,6 +8,7 @@ import com.muyu.common.core.utils.file.MimeTypeUtils;
|
|||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.service.TokenService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.remote.RemoteFileService;
|
||||
|
@ -19,7 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
|
@ -38,6 +42,12 @@ public class SysProfileController extends BaseController {
|
|||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
|
@ -95,6 +105,8 @@ public class SysProfileController extends BaseController {
|
|||
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
String userKey = CacheConstants.LOGIN_TOKEN_KEY+request.getHeader("Admin-Token");
|
||||
redisService.deleteObject(userKey);
|
||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
|
||||
// 更新缓存用户密码
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
|
|
@ -101,7 +101,7 @@ public class SysUserController extends BaseController {
|
|||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(sysUser)) {
|
||||
return Result.error("用户名或密码错误");
|
||||
return Result.error("用户名/邮箱或密码错误");
|
||||
}
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||
|
@ -238,6 +238,7 @@ public class SysUserController extends BaseController {
|
|||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 通知公告人员中间对象 as_notice_user
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AsNoticeUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 通知id */
|
||||
@Excel(name = "通知id")
|
||||
private Long noticeId;
|
||||
|
||||
/** 人员id */
|
||||
@Excel(name = "人员id")
|
||||
private Long userId;
|
||||
|
||||
/** 已读状态,'Y'已读,'N'未读 */
|
||||
@Excel(name = "已读状态,'Y'已读,'N'未读")
|
||||
private String readStates;
|
||||
|
||||
/** 过期时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "过期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
/** 过期状态'N'未过期,'Y'已过期 */
|
||||
@Excel(name = "过期状态'N'未过期,'Y'已过期")
|
||||
private String outStates;
|
||||
|
||||
// public static AsNoticeUser saveBuilder(AsNoticeUserReq req) {
|
||||
// return AsNoticeUser.builder()
|
||||
// .userId()
|
||||
// .outStates(req.getStatus())
|
||||
// .endTime(req.getInDateTime())
|
||||
// .readStates("N")
|
||||
// .outStates("N")
|
||||
// .createBy(req.getCreateBy())
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -36,6 +36,8 @@ public class SysMenu extends BaseEntity {
|
|||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
|
@ -108,162 +110,7 @@ public class SysMenu extends BaseEntity {
|
|||
*/
|
||||
private List<SysMenu> children = new ArrayList<SysMenu>();
|
||||
|
||||
public Long getMenuId () {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId (Long menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
public String getMenuName () {
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName (String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getParentName () {
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName (String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId () {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId (Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum () {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum (Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||
public String getPath () {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath (String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||
public String getComponent () {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent (String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery () {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery (String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getIsFrame () {
|
||||
return isFrame;
|
||||
}
|
||||
|
||||
public void setIsFrame (String isFrame) {
|
||||
this.isFrame = isFrame;
|
||||
}
|
||||
|
||||
public String getIsCache () {
|
||||
return isCache;
|
||||
}
|
||||
|
||||
public void setIsCache (String isCache) {
|
||||
this.isCache = isCache;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
public String getMenuType () {
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType (String menuType) {
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getVisible () {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible (String visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getStatus () {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus (String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||
public String getPerms () {
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms (String perms) {
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getIcon () {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon (String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<SysMenu> getChildren () {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren (List<SysMenu> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString () {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("menuId", getMenuId())
|
||||
.append("menuName", getMenuName())
|
||||
.append("parentId", getParentId())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("path", getPath())
|
||||
.append("component", getComponent())
|
||||
.append("isFrame", getIsFrame())
|
||||
.append("IsCache", getIsCache())
|
||||
.append("menuType", getMenuType())
|
||||
.append("visible", getVisible())
|
||||
.append("status ", getStatus())
|
||||
.append("perms", getPerms())
|
||||
.append("icon", getIcon())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.system.domain;
|
|||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.core.xss.Xss;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -12,6 +13,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 通知公告表 sys_notice
|
||||
|
@ -51,13 +54,18 @@ public class SysNotice extends BaseEntity {
|
|||
*/
|
||||
private String status;
|
||||
|
||||
public Long getNoticeId () {
|
||||
return noticeId;
|
||||
public static SysNotice saveBuilder(AsNoticeUserReq req, Supplier<String> user) {
|
||||
return SysNotice.builder()
|
||||
.noticeContent(req.getNoticeContent())
|
||||
.noticeTitle(req.getNoticeTitle())
|
||||
.noticeType(req.getNoticeType())
|
||||
.status(req.getStatus())
|
||||
.createBy(user.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
public void setNoticeId (Long noticeId) {
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
@Xss(message = "公告标题不能包含脚本字符")
|
||||
@NotBlank(message = "公告标题不能为空")
|
||||
|
@ -66,47 +74,4 @@ public class SysNotice extends BaseEntity {
|
|||
return noticeTitle;
|
||||
}
|
||||
|
||||
public void setNoticeTitle (String noticeTitle) {
|
||||
this.noticeTitle = noticeTitle;
|
||||
}
|
||||
|
||||
public String getNoticeType () {
|
||||
return noticeType;
|
||||
}
|
||||
|
||||
public void setNoticeType (String noticeType) {
|
||||
this.noticeType = noticeType;
|
||||
}
|
||||
|
||||
public String getNoticeContent () {
|
||||
return noticeContent;
|
||||
}
|
||||
|
||||
public void setNoticeContent (String noticeContent) {
|
||||
this.noticeContent = noticeContent;
|
||||
}
|
||||
|
||||
public String getStatus () {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus (String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString () {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("noticeId", getNoticeId())
|
||||
.append("noticeTitle", getNoticeTitle())
|
||||
.append("noticeType", getNoticeType())
|
||||
.append("noticeContent", getNoticeContent())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AsNoticeUserReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/13 15:05
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AsNoticeUserReq extends BaseEntity {
|
||||
/**
|
||||
* 公告id
|
||||
*/
|
||||
private Long noticeId;
|
||||
/**
|
||||
* 公告标题
|
||||
*/
|
||||
private String noticeTitle;
|
||||
/**
|
||||
* 公告内容
|
||||
*/
|
||||
private String noticeContent;
|
||||
/**
|
||||
* 公告有效日期
|
||||
*/
|
||||
private Date inDateTime;
|
||||
/**
|
||||
* 公告类型
|
||||
*/
|
||||
private String noticeType;
|
||||
/**
|
||||
* 选择部门
|
||||
*/
|
||||
private List<Long> selectedOptions;
|
||||
/**
|
||||
* 特定接收人
|
||||
*/
|
||||
private List<Long> userCheckedList;
|
||||
/**
|
||||
* 公告状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ClassName ReadEditReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/14 9:14
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class ReadEditReq {
|
||||
private Long notice_id;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AsNoticeUserReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/13 15:05
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class SelectAsNoticeUserReq extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 读取状态
|
||||
*/
|
||||
private String readStates;
|
||||
/**
|
||||
* 公告类型
|
||||
*/
|
||||
private String noticeType;
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.system.domain.resp;
|
||||
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName AsNoticeUserResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/14 9:22
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AsNoticeUserResp {
|
||||
|
||||
private Long asNoticeId;
|
||||
private String createBy;
|
||||
private String noticeType;
|
||||
private String readStates;
|
||||
private Date createTime;
|
||||
private Date endTime;
|
||||
private SysNotice sysNotice;
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.system.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.core.xss.Xss;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.bytebuddy.implementation.bind.annotation.Super;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @ClassName SysNoticeResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/14 14:21
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class SysNoticeResp extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 公告ID
|
||||
*/
|
||||
private Long noticeId;
|
||||
|
||||
/**
|
||||
* 公告标题
|
||||
*/
|
||||
private String noticeTitle;
|
||||
|
||||
/**
|
||||
* 公告类型(1通知 2公告)
|
||||
*/
|
||||
private String noticeType;
|
||||
|
||||
/**
|
||||
* 公告内容
|
||||
*/
|
||||
private String noticeContent;
|
||||
|
||||
/**
|
||||
* 有效日期
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 公告状态(0正常 1关闭)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 总通知数量
|
||||
*/
|
||||
private Long num;
|
||||
|
||||
/**
|
||||
* 已读数量
|
||||
*/
|
||||
private Long readNum;
|
||||
|
||||
/**
|
||||
* 未读数量
|
||||
*/
|
||||
private Long unReadNum;
|
||||
|
||||
public static SysNoticeResp saveBuilder(SysNotice req){
|
||||
return SysNoticeResp.builder()
|
||||
.noticeId(req.getNoticeId())
|
||||
.noticeContent(req.getNoticeContent())
|
||||
.noticeTitle(req.getNoticeTitle())
|
||||
.noticeType(req.getNoticeType())
|
||||
.status(req.getStatus())
|
||||
.createBy(req.getCreateBy())
|
||||
.createTime(req.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.domain.SysMenu;
|
||||
|
@ -19,6 +21,7 @@ public class TreeSelect implements Serializable {
|
|||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.domain.AsNoticeUser;
|
||||
|
||||
/**
|
||||
* 通知公告人员中间Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
public interface AsNoticeUserMapper extends BaseMapper<AsNoticeUser>
|
||||
{
|
||||
/**
|
||||
* 查询通知公告人员中间
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 通知公告人员中间
|
||||
*/
|
||||
public AsNoticeUser selectAsNoticeUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询通知公告人员中间列表
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 通知公告人员中间集合
|
||||
*/
|
||||
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 新增通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 修改通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 删除通知公告人员中间
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsNoticeUserById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除通知公告人员中间
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsNoticeUserByIds(Long[] ids);
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.muyu.system.domain.SysConfig;
|
||||
|
||||
/**
|
||||
* 系统配置 数据层
|
||||
* @author DongZl
|
||||
* @description: 配置mybatis配置
|
||||
* @Date 2023-11-13 上午 10:05
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.muyu.system.domain.SysMenu;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -90,6 +91,15 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||
*/
|
||||
public SysMenu selectMenuById (Long menuId);
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
* @param parentId 父级菜单ID
|
||||
*
|
||||
* @return 菜单信息
|
||||
*/
|
||||
List<SysMenu> selectMenuByParentId(Long parentId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
|
@ -135,4 +145,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||
* @return 结果
|
||||
*/
|
||||
public SysMenu checkMenuNameUnique (@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,127 +16,121 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList (SysUser sysUser);
|
||||
public List<SysUser> selectUserList(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectAllocatedList (SysUser user);
|
||||
public List<SysUser> selectAllocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUnallocatedList (SysUser user);
|
||||
public List<SysUser> selectUnallocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserName (String userName);
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserNameAndEmail(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserById (Long userId);
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser (SysUser user);
|
||||
public int insertUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser (SysUser user);
|
||||
public int updateUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserAvatar (@Param("userName") String userName, @Param("avatar") String avatar);
|
||||
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd (@Param("userName") String userName, @Param("password") String password);
|
||||
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById (Long userId);
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds (Long[] userIds);
|
||||
public int deleteUserByIds(Long[] userIds);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param userName 用户名称
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkUserNameUnique (String userName);
|
||||
public SysUser checkUserNameUnique(String userName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkPhoneUnique (String phonenumber);
|
||||
public SysUser checkPhoneUnique(String phonenumber);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
public SysUser checkEmailUnique(String email);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.domain.AsNoticeUser;
|
||||
|
||||
/**
|
||||
* 通知公告人员中间Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
public interface AsNoticeUserService extends IService<AsNoticeUser>
|
||||
{
|
||||
/**
|
||||
* 查询通知公告人员中间
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 通知公告人员中间
|
||||
*/
|
||||
public AsNoticeUser selectAsNoticeUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询通知公告人员中间列表
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 通知公告人员中间集合
|
||||
*/
|
||||
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 新增通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 修改通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||
|
||||
/**
|
||||
* 批量删除通知公告人员中间
|
||||
*
|
||||
* @param ids 需要删除的通知公告人员中间主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsNoticeUserByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除通知公告人员中间信息
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsNoticeUserById(Long id);
|
||||
}
|
|
@ -135,4 +135,6 @@ public interface SysDeptService extends IService<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
|
||||
List<SysDept> listDeptFind();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.muyu.system.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,7 +31,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList (SysNotice notice);
|
||||
public List<SysNoticeResp> selectNoticeList (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
|
@ -36,7 +40,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNotice (SysNotice notice);
|
||||
public int insertNotice (AsNoticeUserReq notice);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
|
@ -64,4 +68,8 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
|
||||
public List<AsNoticeUserResp> noticeByUserId(SelectAsNoticeUserReq req);
|
||||
|
||||
int updateAsNoticeUser(Long asNoticeId);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface SysPermissionService {
|
|||
/**
|
||||
* 获取角色数据权限
|
||||
*
|
||||
* @param userId 用户Id
|
||||
* @param user 用户Id
|
||||
*
|
||||
* @return 角色权限信息
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.AsNoticeUserMapper;
|
||||
import com.muyu.system.domain.AsNoticeUser;
|
||||
import com.muyu.system.service.AsNoticeUserService;
|
||||
|
||||
/**
|
||||
* 通知公告人员中间Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@Service
|
||||
public class AsNoticeUserServiceImpl extends ServiceImpl<AsNoticeUserMapper, AsNoticeUser> implements AsNoticeUserService
|
||||
{
|
||||
@Autowired
|
||||
private AsNoticeUserMapper asNoticeUserMapper;
|
||||
|
||||
/**
|
||||
* 查询通知公告人员中间
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 通知公告人员中间
|
||||
*/
|
||||
@Override
|
||||
public AsNoticeUser selectAsNoticeUserById(Long id)
|
||||
{
|
||||
return asNoticeUserMapper.selectAsNoticeUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询通知公告人员中间列表
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 通知公告人员中间
|
||||
*/
|
||||
@Override
|
||||
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser)
|
||||
{
|
||||
return asNoticeUserMapper.selectAsNoticeUserList(asNoticeUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAsNoticeUser(AsNoticeUser asNoticeUser)
|
||||
{
|
||||
asNoticeUser.setCreateTime(DateUtils.getNowDate());
|
||||
return asNoticeUserMapper.insertAsNoticeUser(asNoticeUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告人员中间
|
||||
*
|
||||
* @param asNoticeUser 通知公告人员中间
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAsNoticeUser(AsNoticeUser asNoticeUser)
|
||||
{
|
||||
asNoticeUser.setUpdateTime(DateUtils.getNowDate());
|
||||
return asNoticeUserMapper.updateAsNoticeUser(asNoticeUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除通知公告人员中间
|
||||
*
|
||||
* @param ids 需要删除的通知公告人员中间主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsNoticeUserByIds(Long[] ids)
|
||||
{
|
||||
return asNoticeUserMapper.deleteAsNoticeUserByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告人员中间信息
|
||||
*
|
||||
* @param id 通知公告人员中间主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsNoticeUserById(Long id)
|
||||
{
|
||||
return asNoticeUserMapper.deleteAsNoticeUserById(id);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.muyu.system.domain.vo.TreeSelect;
|
|||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -29,6 +30,7 @@ import java.util.stream.Collectors;
|
|||
* @author muyu
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
||||
@Autowired
|
||||
private SysDeptMapper deptMapper;
|
||||
|
@ -280,13 +282,29 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
return deptMapper.deleteDeptById(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树级结构
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> listDeptFind() {
|
||||
List<SysDept> sysDepts = new ArrayList<>();
|
||||
List<SysDept> depts = this.selectDeptList(new SysDept(){{setDeptId(0L);}});
|
||||
sysDepts = buildDeptTree(depts);
|
||||
log.info(sysDepts);
|
||||
return sysDepts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn (List<SysDept> list, SysDept t) {
|
||||
// 得到子节点列表
|
||||
List<SysDept> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
if (!childList.isEmpty()){
|
||||
t.setChildren(childList);
|
||||
}
|
||||
for (SysDept tChild : childList) {
|
||||
if (hasChild(list, tChild)) {
|
||||
recursionFn(list, tChild);
|
||||
|
|
|
@ -43,11 +43,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> selectMenuList (Long userId) {
|
||||
public List<SysMenu> selectMenuList(Long userId) {
|
||||
return selectMenuList(new SysMenu(), userId);
|
||||
}
|
||||
|
||||
|
@ -55,11 +54,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> selectMenuList (SysMenu menu, Long userId) {
|
||||
public List<SysMenu> selectMenuList(SysMenu menu, Long userId) {
|
||||
int size = menuMapper.selectMenuList(new SysMenu()).size();
|
||||
List<SysMenu> menuList = null;
|
||||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
|
@ -68,18 +67,58 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
menu.getParams().put("userId", userId);
|
||||
menuList = menuMapper.selectMenuListByUserId(menu);
|
||||
}
|
||||
if (menuList.size() != size) {
|
||||
List<SysMenu> sysMenuList = new ArrayList<>();
|
||||
menuList.forEach(menuObj -> {
|
||||
//查子级
|
||||
sysMenuList.addAll(treeMenu(menuObj));
|
||||
//查父级
|
||||
if (menuObj.getParentId() != 0) {
|
||||
sysMenuList.addAll(superMenu(menuObj));
|
||||
}
|
||||
});
|
||||
menuList.addAll(sysMenuList);
|
||||
menuList = menuList.stream().distinct().toList();
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
public List<SysMenu> treeMenu(SysMenu menus) {
|
||||
List<SysMenu> sysMenus1 = new ArrayList<>();
|
||||
List<SysMenu> sysMenus = menuMapper.selectMenuByParentId(menus.getMenuId());
|
||||
sysMenus1.addAll(sysMenus);
|
||||
if (sysMenus.size() > 0) {
|
||||
for (SysMenu sysMenu : sysMenus) {
|
||||
treeMenu(sysMenu);
|
||||
}
|
||||
}
|
||||
return sysMenus1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将父级存入
|
||||
*
|
||||
* @param sysMenu
|
||||
* @return
|
||||
*/
|
||||
public List<SysMenu> superMenu(SysMenu sysMenu) {
|
||||
List<SysMenu> sysMenus = new ArrayList<>();
|
||||
SysMenu sysMenuParent = menuMapper.selectMenuById(sysMenu.getParentId());
|
||||
sysMenus.add(sysMenuParent);
|
||||
if (sysMenuParent.getParentId() != 0) {
|
||||
sysMenus.addAll(superMenu(sysMenuParent));
|
||||
}
|
||||
return sysMenus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectMenuPermsByUserId (Long userId) {
|
||||
public Set<String> selectMenuPermsByUserId(Long userId) {
|
||||
List<String> perms = menuMapper.selectMenuPermsByUserId(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
|
@ -94,11 +133,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 根据角色ID查询权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectMenuPermsByRoleId (Long roleId) {
|
||||
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
||||
List<String> perms = menuMapper.selectMenuPermsByRoleId(roleId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
|
@ -113,11 +151,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 根据用户ID查询菜单
|
||||
*
|
||||
* @param userId 用户名称
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> selectMenuTreeByUserId (Long userId) {
|
||||
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
|
||||
List<SysMenu> menus = null;
|
||||
if (SecurityUtils.isAdmin(userId)) {
|
||||
menus = menuMapper.selectMenuTreeAll();
|
||||
|
@ -131,11 +168,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectMenuListByRoleId (Long roleId) {
|
||||
public List<Long> selectMenuListByRoleId(Long roleId) {
|
||||
SysRole role = roleMapper.selectRoleById(roleId);
|
||||
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
|
||||
}
|
||||
|
@ -144,11 +180,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 构建前端路由所需要的菜单
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
*
|
||||
* @return 路由列表
|
||||
*/
|
||||
@Override
|
||||
public List<RouterVo> buildMenus (List<SysMenu> menus) {
|
||||
public List<RouterVo> buildMenus(List<SysMenu> menus) {
|
||||
List<RouterVo> routers = new LinkedList<RouterVo>();
|
||||
for (SysMenu menu : menus) {
|
||||
RouterVo router = new RouterVo();
|
||||
|
@ -196,14 +231,13 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
*
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> buildMenuTree (List<SysMenu> menus) {
|
||||
public List<SysMenu> buildMenuTree(List<SysMenu> menus) {
|
||||
List<SysMenu> returnList = new ArrayList<SysMenu>();
|
||||
List<Long> tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList());
|
||||
for (Iterator<SysMenu> iterator = menus.iterator() ; iterator.hasNext() ; ) {
|
||||
for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext(); ) {
|
||||
SysMenu menu = (SysMenu) iterator.next();
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(menu.getParentId())) {
|
||||
|
@ -221,11 +255,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
*
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> buildMenuTreeSelect (List<SysMenu> menus) {
|
||||
public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus) {
|
||||
List<SysMenu> menuTrees = buildMenuTree(menus);
|
||||
return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -234,11 +267,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 根据菜单ID查询信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 菜单信息
|
||||
*/
|
||||
@Override
|
||||
public SysMenu selectMenuById (Long menuId) {
|
||||
public SysMenu selectMenuById(Long menuId) {
|
||||
return menuMapper.selectMenuById(menuId);
|
||||
}
|
||||
|
||||
|
@ -246,11 +278,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 是否存在菜单子节点
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildByMenuId (Long menuId) {
|
||||
public boolean hasChildByMenuId(Long menuId) {
|
||||
int result = menuMapper.hasChildByMenuId(menuId);
|
||||
return result > 0;
|
||||
}
|
||||
|
@ -259,11 +290,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 查询菜单使用数量
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkMenuExistRole (Long menuId) {
|
||||
public boolean checkMenuExistRole(Long menuId) {
|
||||
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
||||
return result > 0;
|
||||
}
|
||||
|
@ -272,11 +302,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMenu (SysMenu menu) {
|
||||
public int insertMenu(SysMenu menu) {
|
||||
return menuMapper.insertMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -284,11 +313,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu (SysMenu menu) {
|
||||
public int updateMenu(SysMenu menu) {
|
||||
return menuMapper.updateMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -296,11 +324,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 删除菜单管理信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMenuById (Long menuId) {
|
||||
public int deleteMenuById(Long menuId) {
|
||||
return menuMapper.deleteMenuById(menuId);
|
||||
}
|
||||
|
||||
|
@ -308,11 +335,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 校验菜单名称是否唯一
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkMenuNameUnique (SysMenu menu) {
|
||||
public boolean checkMenuNameUnique(SysMenu menu) {
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) {
|
||||
|
@ -325,10 +351,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 获取路由名称
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 路由名称
|
||||
*/
|
||||
public String getRouteName (SysMenu menu) {
|
||||
public String getRouteName(SysMenu menu) {
|
||||
String routerName = StringUtils.capitalize(menu.getPath());
|
||||
// 非外链并且是一级目录(类型为目录)
|
||||
if (isMenuFrame(menu)) {
|
||||
|
@ -341,10 +366,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 获取路由地址
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 路由地址
|
||||
*/
|
||||
public String getRouterPath (SysMenu menu) {
|
||||
public String getRouterPath(SysMenu menu) {
|
||||
String routerPath = menu.getPath();
|
||||
// 内链打开外网方式
|
||||
if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) {
|
||||
|
@ -366,10 +390,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 获取组件信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 组件信息
|
||||
*/
|
||||
public String getComponent (SysMenu menu) {
|
||||
public String getComponent(SysMenu menu) {
|
||||
String component = UserConstants.LAYOUT;
|
||||
if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) {
|
||||
component = menu.getComponent();
|
||||
|
@ -385,10 +408,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 是否为菜单内部跳转
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isMenuFrame (SysMenu menu) {
|
||||
public boolean isMenuFrame(SysMenu menu) {
|
||||
return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
|
||||
&& menu.getIsFrame().equals(UserConstants.NO_FRAME);
|
||||
}
|
||||
|
@ -397,10 +419,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 是否为内链组件
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isInnerLink (SysMenu menu) {
|
||||
public boolean isInnerLink(SysMenu menu) {
|
||||
return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
|
||||
}
|
||||
|
||||
|
@ -408,10 +429,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* 是否为parent_view组件
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isParentView (SysMenu menu) {
|
||||
public boolean isParentView(SysMenu menu) {
|
||||
return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType());
|
||||
}
|
||||
|
||||
|
@ -420,12 +440,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*
|
||||
* @param list 分类表
|
||||
* @param parentId 传入的父节点ID
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public List<SysMenu> getChildPerms (List<SysMenu> list, int parentId) {
|
||||
public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) {
|
||||
List<SysMenu> returnList = new ArrayList<SysMenu>();
|
||||
for (Iterator<SysMenu> iterator = list.iterator() ; iterator.hasNext() ; ) {
|
||||
for (Iterator<SysMenu> iterator = list.iterator(); iterator.hasNext(); ) {
|
||||
SysMenu t = (SysMenu) iterator.next();
|
||||
// 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
|
||||
if (t.getParentId() == parentId) {
|
||||
|
@ -442,7 +461,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* @param list 分类表
|
||||
* @param t 子节点
|
||||
*/
|
||||
private void recursionFn (List<SysMenu> list, SysMenu t) {
|
||||
private void recursionFn(List<SysMenu> list, SysMenu t) {
|
||||
// 得到子节点列表
|
||||
List<SysMenu> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
|
@ -456,7 +475,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<SysMenu> getChildList (List<SysMenu> list, SysMenu t) {
|
||||
private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) {
|
||||
List<SysMenu> tlist = new ArrayList<SysMenu>();
|
||||
Iterator<SysMenu> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
|
@ -471,7 +490,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild (List<SysMenu> list, SysMenu t) {
|
||||
private boolean hasChild(List<SysMenu> list, SysMenu t) {
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
|
@ -480,7 +499,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*
|
||||
* @return 替换后的内链域名
|
||||
*/
|
||||
public String innerLinkReplaceEach (String path) {
|
||||
public String innerLinkReplaceEach(String path) {
|
||||
return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", ":"},
|
||||
new String[]{"", "", "", "/", "/"});
|
||||
}
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.AsNoticeUser;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||
import com.muyu.system.mapper.SysNoticeMapper;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
import com.muyu.system.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 公告 服务层实现
|
||||
|
@ -19,15 +33,27 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
@Autowired
|
||||
private AsNoticeUserService asNoticeUserService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private SysDeptService deptService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
*
|
||||
* @return 公告信息
|
||||
*/
|
||||
@Override
|
||||
public SysNotice selectNoticeById (Long noticeId) {
|
||||
public SysNotice selectNoticeById(Long noticeId) {
|
||||
return noticeMapper.selectNoticeById(noticeId);
|
||||
}
|
||||
|
||||
|
@ -35,35 +61,83 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeList (SysNotice notice) {
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
public List<SysNoticeResp> selectNoticeList(SysNotice notice) {
|
||||
List<SysNotice> sysNotices = noticeMapper.selectNoticeList(notice);
|
||||
List<SysNoticeResp> sysNoticeRespList = sysNotices.stream().map(sysNotice -> {
|
||||
//通知总数
|
||||
List<AsNoticeUser> allList = asNoticeUserService.list(new LambdaQueryWrapper<AsNoticeUser>() {{
|
||||
eq(AsNoticeUser::getNoticeId, sysNotice.getNoticeId());
|
||||
}});
|
||||
//已读数量
|
||||
long allCount = allList.size();
|
||||
long readCount = allList.stream().filter(user -> "Y".equals(user.getReadStates())).count();
|
||||
long unReadCount = allCount - readCount;
|
||||
|
||||
SysNoticeResp sysNoticeResp = SysNoticeResp.saveBuilder(sysNotice);
|
||||
if (!allList.isEmpty()) {
|
||||
sysNoticeResp.setEndTime(allList.get(0).getEndTime());
|
||||
}
|
||||
sysNoticeResp.setNum(allCount);
|
||||
sysNoticeResp.setReadNum(readCount);
|
||||
sysNoticeResp.setUnReadNum(unReadCount);
|
||||
return sysNoticeResp;
|
||||
}).collect(Collectors.toList());
|
||||
return sysNoticeRespList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @param req 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNotice (SysNotice notice) {
|
||||
return noticeMapper.insertNotice(notice);
|
||||
public int insertNotice(AsNoticeUserReq req) {
|
||||
SysNotice sysNotice = SysNotice.saveBuilder(req, SecurityUtils::getUsername);
|
||||
int i = noticeMapper.insertNotice(sysNotice);
|
||||
|
||||
if (i > 0) {
|
||||
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
|
||||
List<SysPost> list = postService.selectPostListByUserId(SecurityUtils.getUserId()).stream().map(postId -> postService.selectPostById(postId)).toList();
|
||||
SysDept dept = deptService.selectDeptById(sysUser.getDeptId());
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
list.forEach(sysPost -> buffer.append(sysPost.getPostName()));
|
||||
req.setCreateBy(sysUser.getUserName() + "(" + dept.getDeptName() + "/" + String.valueOf(buffer) + ")");
|
||||
List<Long> userCheckedList = req.getUserCheckedList();
|
||||
List<Long> finalUserCheckedList = userCheckedList;
|
||||
req.getSelectedOptions().forEach(deptId ->
|
||||
finalUserCheckedList.addAll(userService.selectUserList(new SysUser() {{
|
||||
setDeptId(deptId);
|
||||
}}).stream().map(SysUser::getUserId).toList()
|
||||
));
|
||||
userCheckedList = userCheckedList.stream().distinct().toList();
|
||||
List<AsNoticeUser> asNoticeUserList = userCheckedList.stream().map(userId ->
|
||||
AsNoticeUser.builder()
|
||||
.endTime(req.getInDateTime())
|
||||
.userId(userId)
|
||||
.noticeId(sysNotice.getNoticeId())
|
||||
.outStates("N")
|
||||
.readStates("N")
|
||||
.createBy(req.getCreateBy())
|
||||
.createTime(new Date())
|
||||
.build()).collect(Collectors.toList());
|
||||
|
||||
asNoticeUserService.saveBatch(asNoticeUserList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNotice (SysNotice notice) {
|
||||
public int updateNotice(SysNotice notice) {
|
||||
return noticeMapper.updateNotice(notice);
|
||||
}
|
||||
|
||||
|
@ -71,11 +145,10 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* 删除公告对象
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeById (Long noticeId) {
|
||||
public int deleteNoticeById(Long noticeId) {
|
||||
return noticeMapper.deleteNoticeById(noticeId);
|
||||
}
|
||||
|
||||
|
@ -83,11 +156,58 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* 批量删除公告信息
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeByIds (Long[] noticeIds) {
|
||||
public int deleteNoticeByIds(Long[] noticeIds) {
|
||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户获取收到的通知和公告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AsNoticeUserResp> noticeByUserId(SelectAsNoticeUserReq req) {
|
||||
List<AsNoticeUser> list = asNoticeUserService.
|
||||
list(new LambdaQueryWrapper<AsNoticeUser>() {{
|
||||
eq(AsNoticeUser::getUserId, SecurityUtils.getUserId());
|
||||
ge(AsNoticeUser::getEndTime, new Date());
|
||||
if (req.getReadStates() != null && !req.getReadStates().isEmpty())
|
||||
eq(AsNoticeUser::getReadStates, req.getReadStates());
|
||||
}}
|
||||
);
|
||||
List<AsNoticeUserResp> result = new ArrayList<>();
|
||||
list.forEach(noticeUser -> {
|
||||
SysNotice sysNotice = this.getOne(new LambdaQueryWrapper<SysNotice>() {{
|
||||
eq(SysNotice::getNoticeId, noticeUser.getNoticeId());
|
||||
if (req.getNoticeType() != null && !req.getNoticeType().isEmpty() &&!req.getNoticeType().equals("0"))
|
||||
eq(SysNotice::getNoticeType, req.getNoticeType());
|
||||
}});
|
||||
if (sysNotice!=null){
|
||||
AsNoticeUserResp apply = AsNoticeUserResp.builder()
|
||||
.asNoticeId(noticeUser.getId())
|
||||
.endTime(noticeUser.getEndTime())
|
||||
.createTime(noticeUser.getCreateTime())
|
||||
.createBy(noticeUser.getCreateBy())
|
||||
.noticeType(sysNotice.getNoticeType())
|
||||
.readStates(noticeUser.getReadStates())
|
||||
.sysNotice(sysNotice)
|
||||
.build();
|
||||
result.add(apply);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAsNoticeUser(Long asNoticeId) {
|
||||
|
||||
AsNoticeUser asNoticeUser = new AsNoticeUser() {{
|
||||
setReadStates("Y");
|
||||
setId(asNoticeId);
|
||||
}};
|
||||
return asNoticeUserService.updateAsNoticeUser(asNoticeUser);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.constant.CacheConstants;
|
||||
import com.muyu.common.core.constant.UserConstants;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||
import com.muyu.common.datascope.annotation.DataScope;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.service.TokenService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.domain.SysUserOnline;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import com.muyu.system.mapper.*;
|
||||
import com.muyu.system.service.SysUserOnlineService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -23,9 +30,10 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -51,16 +59,26 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
@Autowired
|
||||
private SysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private SysUserOnlineService userOnlineService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUserList (SysUser user) {
|
||||
public List<SysUser> selectUserList(SysUser user) {
|
||||
return userMapper.selectUserList(user);
|
||||
}
|
||||
|
||||
|
@ -68,12 +86,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectAllocatedList (SysUser user) {
|
||||
public List<SysUser> selectAllocatedList(SysUser user) {
|
||||
return userMapper.selectAllocatedList(user);
|
||||
}
|
||||
|
||||
|
@ -81,12 +98,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUnallocatedList (SysUser user) {
|
||||
public List<SysUser> selectUnallocatedList(SysUser user) {
|
||||
return userMapper.selectUnallocatedList(user);
|
||||
}
|
||||
|
||||
|
@ -94,23 +110,26 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserByUserName (String userName) {
|
||||
return userMapper.selectUserByUserName(userName);
|
||||
public SysUser selectUserByUserName(String userName) {
|
||||
return userMapper.selectUserByUserNameAndEmail(userName);
|
||||
// LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>() {{
|
||||
// eq(SysUser::getUserName, userName);
|
||||
// or().eq(SysUser::getEmail, userName);
|
||||
// }};
|
||||
// return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserById (Long userId) {
|
||||
public SysUser selectUserById(Long userId) {
|
||||
return userMapper.selectUserById(userId);
|
||||
}
|
||||
|
||||
|
@ -118,11 +137,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 查询用户所属角色组
|
||||
*
|
||||
* @param userName 用户名
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String selectUserRoleGroup (String userName) {
|
||||
public String selectUserRoleGroup(String userName) {
|
||||
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
|
@ -134,11 +152,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 查询用户所属岗位组
|
||||
*
|
||||
* @param userName 用户名
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String selectUserPostGroup (String userName) {
|
||||
public String selectUserPostGroup(String userName) {
|
||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
|
@ -150,11 +167,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkUserNameUnique (SysUser user) {
|
||||
public boolean checkUserNameUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
|
@ -167,11 +183,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkPhoneUnique (SysUser user) {
|
||||
public boolean checkPhoneUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
|
@ -184,11 +199,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkEmailUnique (SysUser user) {
|
||||
public boolean checkEmailUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
|
@ -203,7 +217,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @param user 用户信息
|
||||
*/
|
||||
@Override
|
||||
public void checkUserAllowed (SysUser user) {
|
||||
public void checkUserAllowed(SysUser user) {
|
||||
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
|
||||
throw new ServiceException("不允许操作超级管理员用户");
|
||||
}
|
||||
|
@ -215,7 +229,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
public void checkUserDataScope (Long userId) {
|
||||
public void checkUserDataScope(Long userId) {
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
|
||||
SysUser user = new SysUser();
|
||||
user.setUserId(userId);
|
||||
|
@ -230,12 +244,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 新增保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertUser (SysUser user) {
|
||||
public int insertUser(SysUser user) {
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
|
@ -249,11 +262,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 注册用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean registerUser (SysUser user) {
|
||||
public boolean registerUser(SysUser user) {
|
||||
return userMapper.insertUser(user) > 0;
|
||||
}
|
||||
|
||||
|
@ -261,12 +273,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 修改保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateUser (SysUser user) {
|
||||
public int updateUser(SysUser user) {
|
||||
Long userId = user.getUserId();
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
|
@ -287,7 +298,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertUserAuth (Long userId, Long[] roleIds) {
|
||||
public void insertUserAuth(Long userId, Long[] roleIds) {
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
insertUserRole(userId, roleIds);
|
||||
}
|
||||
|
@ -296,11 +307,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserStatus (SysUser user) {
|
||||
public int updateUserStatus(SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
|
@ -308,11 +318,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 修改用户基本信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserProfile (SysUser user) {
|
||||
public int updateUserProfile(SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
|
@ -321,11 +330,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean updateUserAvatar (String userName, String avatar) {
|
||||
public boolean updateUserAvatar(String userName, String avatar) {
|
||||
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
||||
}
|
||||
|
||||
|
@ -333,12 +341,29 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 重置用户密码
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetPwd (SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
public int resetPwd(SysUser user) {
|
||||
int i = userMapper.updateUser(user);
|
||||
if (i>0){
|
||||
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys) {
|
||||
LoginUser userRedis = redisService.getCacheObject(key);
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(userRedis));
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
SysUser one = this.selectUserById(user.getUserId());
|
||||
userOnlineList.forEach(sysUserOnline -> {
|
||||
if (sysUserOnline.getUserName().equals(one.getUserName())){
|
||||
redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + sysUserOnline.getTokenId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,11 +371,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetUserPwd (String userName, String password) {
|
||||
public int resetUserPwd(String userName, String password) {
|
||||
return userMapper.resetUserPwd(userName, password);
|
||||
}
|
||||
|
||||
|
@ -359,7 +383,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserRole (SysUser user) {
|
||||
public void insertUserRole(SysUser user) {
|
||||
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
||||
}
|
||||
|
||||
|
@ -368,7 +392,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserPost (SysUser user) {
|
||||
public void insertUserPost(SysUser user) {
|
||||
Long[] posts = user.getPostIds();
|
||||
if (StringUtils.isNotEmpty(posts)) {
|
||||
// 新增用户与岗位管理
|
||||
|
@ -389,7 +413,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
public void insertUserRole (Long userId, Long[] roleIds) {
|
||||
public void insertUserRole(Long userId, Long[] roleIds) {
|
||||
if (StringUtils.isNotEmpty(roleIds)) {
|
||||
// 新增用户与角色管理
|
||||
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
||||
|
@ -407,12 +431,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteUserById (Long userId) {
|
||||
public int deleteUserById(Long userId) {
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
// 删除用户与岗位表
|
||||
|
@ -424,12 +447,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteUserByIds (Long[] userIds) {
|
||||
public int deleteUserByIds(Long[] userIds) {
|
||||
for (Long userId : userIds) {
|
||||
checkUserAllowed(new SysUser(userId));
|
||||
checkUserDataScope(userId);
|
||||
|
@ -447,11 +469,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName) {
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
||||
throw new ServiceException("导入用户数据不能为空!");
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
<?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.system.mapper.AsNoticeUserMapper">
|
||||
|
||||
<resultMap type="com.muyu.system.domain.AsNoticeUser" id="AsNoticeUserResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="noticeId" column="notice_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="readStates" column="read_states" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="outStates" column="out_states" />
|
||||
<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="selectAsNoticeUserVo">
|
||||
select id, notice_id, user_id, read_states, end_time, out_states, create_by, create_time, update_by, update_time from as_notice_user
|
||||
</sql>
|
||||
|
||||
<select id="selectAsNoticeUserList" parameterType="com.muyu.system.domain.AsNoticeUser" resultMap="AsNoticeUserResult">
|
||||
<include refid="selectAsNoticeUserVo"/>
|
||||
<where>
|
||||
<if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="readStates != null and readStates != ''"> and read_states = #{readStates}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="outStates != null and outStates != ''"> and out_states = #{outStates}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAsNoticeUserById" parameterType="Long" resultMap="AsNoticeUserResult">
|
||||
<include refid="selectAsNoticeUserVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAsNoticeUser" parameterType="com.muyu.system.domain.AsNoticeUser">
|
||||
insert into as_notice_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="noticeId != null">notice_id,</if>
|
||||
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="readStates != null and readStates != ''">read_states,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="outStates != null and outStates != ''">out_states,</if>
|
||||
<if test="createBy != null and createBy != ''">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="noticeId != null">#{noticeId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="readStates != null and readStates != ''">#{readStates},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="outStates != null and outStates != ''">#{outStates},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAsNoticeUser" parameterType="com.muyu.system.domain.AsNoticeUser">
|
||||
update as_notice_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="noticeId != null">notice_id = #{noticeId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="readStates != null and readStates != ''">read_states = #{readStates},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="outStates != null and outStates != ''">out_states = #{outStates},</if>
|
||||
<if test="createBy != null and createBy != ''">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="deleteAsNoticeUserById" parameterType="Long">
|
||||
delete from as_notice_user where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAsNoticeUserByIds" parameterType="String">
|
||||
delete from as_notice_user where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -7,7 +7,6 @@
|
|||
<resultMap type="com.muyu.system.domain.SysMenu" id="SysMenuResult">
|
||||
<id property="menuId" column="menu_id"/>
|
||||
<result property="menuName" column="menu_name"/>
|
||||
<result property="parentName" column="parent_name"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="path" column="path"/>
|
||||
|
@ -175,6 +174,13 @@
|
|||
where menu_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuByParentId" parameterType="Long" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="hasChildByMenuId" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_menu
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice" keyProperty="noticeId" useGeneratedKeys="true" >
|
||||
insert into sys_notice (
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||
|
|
|
@ -155,6 +155,13 @@
|
|||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserNameAndEmail" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where (u.user_name = #{userName} and u.del_flag = '0') or u.email = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
|
|
|
@ -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>muyv-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-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,42 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 资产数据字典对象 asset_data_dict
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AssetDataDict extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 数据接入id */
|
||||
@Excel(name = "数据接入id")
|
||||
private Long basicId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
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.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 资产赋权对象 asset_impower
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AssetImpower extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 表id
|
||||
*/
|
||||
@Excel(name = "表id")
|
||||
private Long tableId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Excel(name = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 接入id
|
||||
*/
|
||||
@Excel(name = "接入id")
|
||||
private Long basicId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Excel(name = "用户id")
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.etl.domain.req.BasicConfigQueryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
/**
|
||||
*对象 basic_config_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
@Excel(name = "主机ip地址")
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
@Excel(name = "数据接入类型")
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
@Excel(name = "初始化连接数量")
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
@Excel(name ="连接参数")
|
||||
private String connectionParams;
|
||||
|
||||
@Excel(name ="用户名")
|
||||
private String username;
|
||||
|
||||
@Excel(name ="密码")
|
||||
private String password;
|
||||
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建存储对象
|
||||
* @param configQueryReq
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
public static BasicConfigInfo saveBuilder(BasicConfigQueryReq configQueryReq, Supplier<String> username) {
|
||||
return BasicConfigInfo.builder()
|
||||
.id(configQueryReq.getId())
|
||||
.databaseName(configQueryReq.getDatabaseName())
|
||||
.databaseType(configQueryReq.getDatabaseType())
|
||||
.dataResourceName(configQueryReq.getDataResourceName())
|
||||
.dataSourcesSystemName(configQueryReq.getDataSourcesSystemName())
|
||||
.host(configQueryReq.getHost())
|
||||
.port(configQueryReq.getPort())
|
||||
.initLinkNum(configQueryReq.getInitLinkNum())
|
||||
.maxLinkNum(configQueryReq.getMaxLinkNum())
|
||||
.maxWaitTime(configQueryReq.getMaxWaitTime())
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对象
|
||||
* @param configQueryReq
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
public static BasicConfigInfo editBuilder(BasicConfigQueryReq configQueryReq, Supplier<String> username) {
|
||||
return BasicConfigInfo.builder()
|
||||
.id(configQueryReq.getId())
|
||||
.databaseName(configQueryReq.getDatabaseName())
|
||||
.databaseType(configQueryReq.getDatabaseType())
|
||||
.dataResourceName(configQueryReq.getDataResourceName())
|
||||
.dataSourcesSystemName(configQueryReq.getDataSourcesSystemName())
|
||||
.host(configQueryReq.getHost())
|
||||
.port(configQueryReq.getPort())
|
||||
.initLinkNum(configQueryReq.getInitLinkNum())
|
||||
.maxLinkNum(configQueryReq.getMaxLinkNum())
|
||||
.maxWaitTime(configQueryReq.getMaxWaitTime())
|
||||
.updateBy(username.get())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonKey;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 字典详细内容对象 dict_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class DictInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 接入id */
|
||||
@Excel(name = "字典id")
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
private String infoName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String infoValue;
|
||||
|
||||
@JsonProperty("isEdit")
|
||||
private boolean isEdit;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 结构对象 structure
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class Structure extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 表id */
|
||||
@Excel(name = "表id")
|
||||
private Long tableId;
|
||||
|
||||
/** 字段名称 */
|
||||
@Excel(name = "字段名称")
|
||||
private String columnName;
|
||||
|
||||
/** 字段注释 */
|
||||
@Excel(name = "字段注释")
|
||||
private String columnRemark;
|
||||
|
||||
/** 是否主键 'Y'是主键 'N'不是主键 */
|
||||
@Excel(name = "是否主键 'Y'是主键 'N'不是主键")
|
||||
private String isPrimary;
|
||||
|
||||
/** 数据类型 */
|
||||
@Excel(name = "数据类型")
|
||||
private String columnType;
|
||||
|
||||
/** 映射类型 */
|
||||
@Excel(name = "映射类型")
|
||||
private String javaType;
|
||||
|
||||
/** 字段长度 */
|
||||
@Excel(name = "字段长度")
|
||||
private String columnLength;
|
||||
|
||||
/** 小数位数 */
|
||||
@Excel(name = "小数位数")
|
||||
private String columnDecimals;
|
||||
|
||||
/** 是否为空 'Y'是 'N'不是 */
|
||||
@Excel(name = "是否为空 'Y'是 'N'不是")
|
||||
private String isNull;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
/** 是否字典 'Y'是 'N'不是 */
|
||||
@Excel(name = "是否字典 'Y'是 'N'不是")
|
||||
private String isDictionary;
|
||||
|
||||
/** 映射字典 */
|
||||
@Excel(name = "映射字典")
|
||||
private String dictionaryTable;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 库表基础信息对象 table_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TableInfo extends TreeEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long basicId;
|
||||
|
||||
/** 表名称/数据库 */
|
||||
@Excel(name = "表名称/数据库")
|
||||
private String tableName;
|
||||
|
||||
/** 表备注 */
|
||||
@Excel(name = "表备注")
|
||||
private String tableRemark;
|
||||
|
||||
/** 表备注 */
|
||||
@Excel(name = "数据来源类型")
|
||||
private String type;
|
||||
|
||||
|
||||
/** 数据量 */
|
||||
@Excel(name = "数据量")
|
||||
private Long dataNum;
|
||||
|
||||
/** 是否核心 'Y'是 'N'不是 */
|
||||
@Excel(name = "是否核心 'Y'是 'N'不是")
|
||||
private String center;
|
||||
|
||||
|
||||
private Long parentId;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.etl.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ClassName AssetImpowerReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/29 14:04
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AssetImpowerReq {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 表id
|
||||
*/
|
||||
@Excel(name = "表id")
|
||||
private Long tableId;
|
||||
|
||||
/**
|
||||
* 接入id
|
||||
*/
|
||||
@Excel(name = "接入id")
|
||||
private Long basicId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Excel(name = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.etl.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName BasicQueryReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/21 10:42
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigQueryReq {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
@Excel(name = "主机ip地址")
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
@Excel(name = "数据接入类型")
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
@Excel(name = "初始化连接数量")
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
private String connectionParams;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.etl.domain.resp;
|
||||
|
||||
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 java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 响应对象
|
||||
* @ClassName BasicConfigResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/21 10:45
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
private Long maxWaitTimes;
|
||||
|
||||
/** 拼接链接 */
|
||||
private String connectionParams;
|
||||
private String remark;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.etl.domain.resp;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典响应对象
|
||||
* @ClassName BasicDictResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/24 21:23
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicDictResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 数据接入id */
|
||||
private Long basicId;
|
||||
|
||||
/** 字典名称 */
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
private String dictType;
|
||||
|
||||
|
||||
private List<DictInfo> dictInfoList;
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.etl.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库表基础信息对象 table_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TableInfoStructureResp
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long basicId;
|
||||
|
||||
/** 表名称/数据库 */
|
||||
@Excel(name = "表名称/数据库")
|
||||
private String tableName;
|
||||
|
||||
/** 表备注 */
|
||||
@Excel(name = "表备注")
|
||||
private String tableRemark;
|
||||
private Long parentId;
|
||||
|
||||
/** 数据量 */
|
||||
@Excel(name = "数据量")
|
||||
private Long dataNum;
|
||||
/** 表备注 */
|
||||
@Excel(name = "数据来源类型")
|
||||
private String type;
|
||||
|
||||
/** 是否核心 'Y'是 'N'不是 */
|
||||
@Excel(name = "是否核心 'Y'是 'N'不是")
|
||||
private String center;
|
||||
|
||||
private String databaseType;
|
||||
|
||||
private List<Structure> structureList;
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.etl.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.TableInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 树级结构
|
||||
* @ClassName TableTreeResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/23 8:59
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TableTreeResp {
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long Id;
|
||||
/**
|
||||
* 父级信息
|
||||
*/
|
||||
private TableInfo tableInfo;
|
||||
/**
|
||||
* 链接信息
|
||||
*/
|
||||
private BasicConfigInfo basicConfigInfo;
|
||||
/**
|
||||
* 子级信息
|
||||
*/
|
||||
private List<TableInfoStructureResp> Children;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?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>muyv-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-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>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</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>muyv-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-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-etl-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,19 @@
|
|||
package com.muyu;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@EnableFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuEtlApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuEtlApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.muyu.etl.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.etl.domain.AssetImpower;
|
||||
import com.muyu.etl.service.AssetImpowerService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 资产赋权Controller
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/impower")
|
||||
public class AssetImpowerController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private AssetImpowerService assetImpowerService;
|
||||
|
||||
/**
|
||||
* 查询资产赋权列表
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<AssetImpower>> list(AssetImpower assetImpower)
|
||||
{
|
||||
startPage();
|
||||
List<AssetImpower> list = assetImpowerService.selectAssetImpowerList(assetImpower);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产赋权列表
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:export")
|
||||
@Log(title = "资产赋权", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AssetImpower assetImpower)
|
||||
{
|
||||
List<AssetImpower> list = assetImpowerService.selectAssetImpowerList(assetImpower);
|
||||
ExcelUtil<AssetImpower> util = new ExcelUtil<AssetImpower>(AssetImpower.class);
|
||||
util.exportExcel(response, list, "资产赋权数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资产赋权详细信息
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(assetImpowerService.selectAssetImpowerById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产赋权
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:add")
|
||||
@Log(title = "资产赋权", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody AssetImpower assetImpower)
|
||||
{
|
||||
return toAjax(assetImpowerService.insertAssetImpower(assetImpower));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产赋权
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:edit")
|
||||
@Log(title = "资产赋权", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody AssetImpower assetImpower)
|
||||
{
|
||||
return toAjax(assetImpowerService.updateAssetImpower(assetImpower));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产赋权
|
||||
*/
|
||||
@RequiresPermissions("etl:impower:remove")
|
||||
@Log(title = "资产赋权", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] 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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
package com.muyu.etl.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.etl.domain.AssetDataDict;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
import com.muyu.etl.domain.resp.BasicDictResp;
|
||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||
import com.muyu.etl.domain.resp.TableTreeResp;
|
||||
import com.muyu.etl.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础信息Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class BasicConfigInfoController extends BaseController {
|
||||
@Autowired
|
||||
private BasicConfigInfoService basicConfigInfoService;
|
||||
@Autowired
|
||||
private AssetDataDictService assetDataDictService;
|
||||
@Autowired
|
||||
private TableInfoService tableInfoService;
|
||||
@Autowired
|
||||
private DictInfoService dictInfoService;
|
||||
@Autowired
|
||||
private StructureService structureService;
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo) {
|
||||
startPage();
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:export")
|
||||
@Log(title = "基础信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasicConfigInfo basicConfigInfo) {
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
ExcelUtil<BasicConfigInfo> util = new ExcelUtil<>(BasicConfigInfo.class);
|
||||
util.exportExcel(response, list, "基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id) {
|
||||
return success(basicConfigInfoService.selectBasicConfigInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:add")
|
||||
@Log(title = "基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody BasicConfigInfo configQueryReq) {
|
||||
return toAjax(basicConfigInfoService.insertBasicConfigInfo(configQueryReq));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:edit")
|
||||
@Log(title = "基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody BasicConfigInfo basicConfigInfo) {
|
||||
return toAjax(basicConfigInfoService.updateBasicConfigInfo(basicConfigInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:remove")
|
||||
@Log(title = "基础信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids) {
|
||||
return toAjax(basicConfigInfoService.deleteBasicConfigInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
@RequiresPermissions("etl:info:test")
|
||||
@Log(title = "测试连接")
|
||||
@PostMapping("/connectionTest")
|
||||
public Result connectionTest(@RequestBody BasicConfigInfo basicConfigInfo) throws ServletException {
|
||||
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取成功链接中的
|
||||
// * @return
|
||||
// */
|
||||
// @RequiresPermissions("etl:info:test")
|
||||
// @Log(title = "获取成功链接中的")
|
||||
// @GetMapping("/dataConstruct")
|
||||
// public Result<TableDataInfo<List>> getData() {
|
||||
// return getDataTable(basicConfigInfoService.getDataByEtl());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 树级结构数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("etl:table:list")
|
||||
@Log(title = "获取已成功链接的树级结构")
|
||||
@GetMapping("/getTableTree")
|
||||
public Result<List<TableTreeResp>> getTableTree() {
|
||||
return Result.success(basicConfigInfoService.getTableTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过接入id查询数据库所属字典
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("etl:table:dictList")
|
||||
@Log(title = "描述")
|
||||
@GetMapping("/getDict/{basicId}")
|
||||
public Result<List<BasicDictResp>> getDict(@PathVariable Long basicId) {
|
||||
return Result.success(assetDataDictService.getDict(basicId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过tableId查询表信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Log(title = "描述")
|
||||
@GetMapping("/getTableInfo/{tableId}")
|
||||
public Result<TableInfoStructureResp> getTableInfo(@PathVariable Long tableId) {
|
||||
return Result.success(basicConfigInfoService.getTableInfo(tableId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字典表
|
||||
*
|
||||
* @param assetDataDict
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("etl:table:list")
|
||||
@Log(title = "添加字典内容")
|
||||
@PostMapping("/insertDict")
|
||||
public Result insertDictInfo(@RequestBody AssetDataDict assetDataDict) throws ServletException {
|
||||
return Result.success(assetDataDictService.insertAssetDataDict(assetDataDict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字典详细信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("etl:table:add")
|
||||
@Log(title = "添加字典表")
|
||||
@PostMapping("/insertDictInfo")
|
||||
public Result insertDict(@RequestBody DictInfo dictInfo) throws ServletException {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产结构中字典信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("etl:table:update")
|
||||
@Log(title = "修改资产结构中字典信息")
|
||||
@PutMapping("/updateStructureInfo")
|
||||
public Result updateStructureInfo(@RequestBody Structure structure) {
|
||||
return Result.success(structureService.updateStructureInfoDict(structure), "修改成功");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 模板
|
||||
// * @return
|
||||
// */
|
||||
// @RequiresPermissions("etl:table:")
|
||||
// @Log(title = "描述")
|
||||
// @GetMapping("/path")
|
||||
// public Result methodName(){
|
||||
// return Result.success(null);
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.AssetDataDict;
|
||||
|
||||
/**
|
||||
* 资产数据字典Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
public interface AssetDataDictMapper extends BaseMapper<AssetDataDict>
|
||||
{
|
||||
/**
|
||||
* 查询资产数据字典
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 资产数据字典
|
||||
*/
|
||||
public AssetDataDict selectAssetDataDictById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资产数据字典列表
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 资产数据字典集合
|
||||
*/
|
||||
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict);
|
||||
|
||||
/**
|
||||
* 新增资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetDataDict(AssetDataDict assetDataDict);
|
||||
|
||||
/**
|
||||
* 修改资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetDataDict(AssetDataDict assetDataDict);
|
||||
|
||||
/**
|
||||
* 删除资产数据字典
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetDataDictById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除资产数据字典
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetDataDictByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.AssetImpower;
|
||||
|
||||
/**
|
||||
* 资产赋权Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
public interface AssetImpowerMapper extends BaseMapper<AssetImpower>
|
||||
{
|
||||
/**
|
||||
* 查询资产赋权
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 资产赋权
|
||||
*/
|
||||
public AssetImpower selectAssetImpowerById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资产赋权列表
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 资产赋权集合
|
||||
*/
|
||||
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 新增资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetImpower(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 修改资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetImpower(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 删除资产赋权
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetImpowerById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除资产赋权
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetImpowerByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
|
||||
/**
|
||||
* Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
public interface BasicConfigInfoMapper extends BaseMapper<BasicConfigInfo>
|
||||
{
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
|
||||
/**
|
||||
* 字典详细内容Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
public interface DictInfoMapper extends BaseMapper<DictInfo>
|
||||
{
|
||||
/**
|
||||
* 查询字典详细内容
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 字典详细内容
|
||||
*/
|
||||
public DictInfo selectDictInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询字典详细内容列表
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 字典详细内容集合
|
||||
*/
|
||||
public List<DictInfo> selectDictInfoList(DictInfo dictInfo);
|
||||
|
||||
/**
|
||||
* 新增字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictInfo(DictInfo dictInfo);
|
||||
|
||||
/**
|
||||
* 修改字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictInfo(DictInfo dictInfo);
|
||||
|
||||
/**
|
||||
* 删除字典详细内容
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除字典详细内容
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 结构Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface StructureMapper extends BaseMapper<Structure>
|
||||
{
|
||||
/**
|
||||
* 查询结构
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结构
|
||||
*/
|
||||
public Structure selectStructureById(Long id);
|
||||
|
||||
/**
|
||||
* 查询结构列表
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结构集合
|
||||
*/
|
||||
public List<Structure> selectStructureList(Structure structure);
|
||||
|
||||
/**
|
||||
* 新增结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStructure(Structure structure);
|
||||
|
||||
/**
|
||||
* 修改结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStructure(Structure structure);
|
||||
|
||||
/**
|
||||
* 删除结构
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStructureById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除结构
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStructureByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.TableInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 库表基础信息Mapper接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface TableInfoMapper extends BaseMapper<TableInfo>
|
||||
{
|
||||
/**
|
||||
* 查询库表基础信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 库表基础信息
|
||||
*/
|
||||
public TableInfo selectTableInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询库表基础信息列表
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 库表基础信息集合
|
||||
*/
|
||||
public List<TableInfo> selectTableInfoList(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 新增库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTableInfo(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 修改库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTableInfo(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 删除库表基础信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTableInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除库表基础信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTableInfoByIds(Long[] ids);
|
||||
|
||||
|
||||
TableInfo selectTableInfoByName(TableInfo table);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.AssetDataDict;
|
||||
import com.muyu.etl.domain.resp.BasicDictResp;
|
||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
/**
|
||||
* 资产数据字典Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
public interface AssetDataDictService extends IService<AssetDataDict>
|
||||
{
|
||||
/**
|
||||
* 查询资产数据字典
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 资产数据字典
|
||||
*/
|
||||
public AssetDataDict selectAssetDataDictById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资产数据字典列表
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 资产数据字典集合
|
||||
*/
|
||||
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict);
|
||||
|
||||
/**
|
||||
* 新增资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean insertAssetDataDict(AssetDataDict assetDataDict) throws ServletException;
|
||||
|
||||
/**
|
||||
* 修改资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetDataDict(AssetDataDict assetDataDict);
|
||||
|
||||
/**
|
||||
* 批量删除资产数据字典
|
||||
*
|
||||
* @param ids 需要删除的资产数据字典主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetDataDictByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除资产数据字典信息
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetDataDictById(Long id);
|
||||
|
||||
List<BasicDictResp> getDict(Long basicId);
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.AssetImpower;
|
||||
|
||||
/**
|
||||
* 资产赋权Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
public interface AssetImpowerService extends IService<AssetImpower>
|
||||
{
|
||||
/**
|
||||
* 查询资产赋权
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 资产赋权
|
||||
*/
|
||||
public AssetImpower selectAssetImpowerById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资产赋权列表
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 资产赋权集合
|
||||
*/
|
||||
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 新增资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetImpower(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 修改资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetImpower(AssetImpower assetImpower);
|
||||
|
||||
/**
|
||||
* 批量删除资产赋权
|
||||
*
|
||||
* @param ids 需要删除的资产赋权主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetImpowerByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除资产赋权信息
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetImpowerById(Long id);
|
||||
|
||||
List<AssetImpower> getPowerByTableId(Long tableId);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
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.TableTreeResp;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
public interface BasicConfigInfoService extends IService<BasicConfigInfo>
|
||||
{
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoById(Long id);
|
||||
|
||||
boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException;
|
||||
|
||||
// List getDataByEtl();
|
||||
|
||||
List<TableTreeResp> getTableTree();
|
||||
|
||||
TableInfoStructureResp getTableInfo(Long tableId);
|
||||
|
||||
BasicTableInfoResp getBasicTableInfo(Long tableId);
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典详细内容Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
public interface DictInfoService extends IService<DictInfo>
|
||||
{
|
||||
/**
|
||||
* 查询字典详细内容
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 字典详细内容
|
||||
*/
|
||||
public DictInfo selectDictInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询字典详细内容列表
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 字典详细内容集合
|
||||
*/
|
||||
public List<DictInfo> selectDictInfoList(DictInfo dictInfo);
|
||||
|
||||
/**
|
||||
* 新增字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean insertDictInfo(DictInfo dictInfo) throws ServletException;
|
||||
|
||||
/**
|
||||
* 修改字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictInfo(DictInfo dictInfo);
|
||||
|
||||
/**
|
||||
* 批量删除字典详细内容
|
||||
*
|
||||
* @param ids 需要删除的字典详细内容主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除字典详细内容信息
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictInfoById(Long id);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 结构Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface StructureService extends IService<Structure>
|
||||
{
|
||||
/**
|
||||
* 查询结构
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结构
|
||||
*/
|
||||
public Structure selectStructureById(Long id);
|
||||
|
||||
/**
|
||||
* 查询结构列表
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结构集合
|
||||
*/
|
||||
public List<Structure> selectStructureList(Structure structure);
|
||||
|
||||
/**
|
||||
* 新增结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStructure(Structure structure);
|
||||
|
||||
/**
|
||||
* 修改结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStructure(Structure structure);
|
||||
|
||||
/**
|
||||
* 批量删除结构
|
||||
*
|
||||
* @param ids 需要删除的结构主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStructureByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除结构信息
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStructureById(Long id);
|
||||
|
||||
boolean updateStructureInfoDict(Structure structure);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.TableInfo;
|
||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||
|
||||
/**
|
||||
* 库表基础信息Service接口
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface TableInfoService extends IService<TableInfo>
|
||||
{
|
||||
/**
|
||||
* 查询库表基础信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 库表基础信息
|
||||
*/
|
||||
public TableInfo selectTableInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询库表基础信息列表
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 库表基础信息集合
|
||||
*/
|
||||
public List<TableInfo> selectTableInfoList(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 新增库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTableInfo(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 修改库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTableInfo(TableInfo tableInfo);
|
||||
|
||||
/**
|
||||
* 批量删除库表基础信息
|
||||
*
|
||||
* @param ids 需要删除的库表基础信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTableInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除库表基础信息信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTableInfoById(Long id);
|
||||
|
||||
TableInfo selectTableInfoByName(TableInfo build);
|
||||
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import com.muyu.etl.domain.resp.BasicDictResp;
|
||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||
import com.muyu.etl.service.DictInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.AssetDataDictMapper;
|
||||
import com.muyu.etl.domain.AssetDataDict;
|
||||
import com.muyu.etl.service.AssetDataDictService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
/**
|
||||
* 资产数据字典Service业务层处理
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class AssetDataDictServiceImpl extends ServiceImpl<AssetDataDictMapper, AssetDataDict> implements AssetDataDictService {
|
||||
@Autowired
|
||||
private AssetDataDictMapper assetDataDictMapper;
|
||||
@Autowired
|
||||
private DictInfoService dictInfoService;
|
||||
|
||||
/**
|
||||
* 查询资产数据字典
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 资产数据字典
|
||||
*/
|
||||
@Override
|
||||
public AssetDataDict selectAssetDataDictById(Long id) {
|
||||
return assetDataDictMapper.selectAssetDataDictById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资产数据字典列表
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 资产数据字典
|
||||
*/
|
||||
@Override
|
||||
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict) {
|
||||
return assetDataDictMapper.selectAssetDataDictList(assetDataDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean insertAssetDataDict(AssetDataDict assetDataDict) throws ServletException {
|
||||
assetDataDict.setCreateTime(DateUtils.getNowDate());
|
||||
AssetDataDict one = this.getOne(new LambdaQueryWrapper<AssetDataDict>(AssetDataDict.class) {{
|
||||
eq(AssetDataDict::getDictType, assetDataDict.getDictType());
|
||||
eq(AssetDataDict::getBasicId, assetDataDict.getBasicId());
|
||||
}});
|
||||
if (one!=null){
|
||||
throw new ServletException("该字典已存在");
|
||||
}
|
||||
return this.saveOrUpdate(assetDataDict, new LambdaUpdateWrapper<AssetDataDict>(AssetDataDict.class) {{
|
||||
eq(AssetDataDict::getDictType,assetDataDict.getDictType());
|
||||
eq(AssetDataDict::getBasicId,assetDataDict.getBasicId());
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产数据字典
|
||||
*
|
||||
* @param assetDataDict 资产数据字典
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAssetDataDict(AssetDataDict assetDataDict) {
|
||||
assetDataDict.setUpdateTime(DateUtils.getNowDate());
|
||||
return assetDataDictMapper.updateAssetDataDict(assetDataDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资产数据字典
|
||||
*
|
||||
* @param ids 需要删除的资产数据字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetDataDictByIds(Long[] ids) {
|
||||
return assetDataDictMapper.deleteAssetDataDictByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产数据字典信息
|
||||
*
|
||||
* @param id 资产数据字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetDataDictById(Long id) {
|
||||
return assetDataDictMapper.deleteAssetDataDictById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicDictResp> getDict(Long basicId) {
|
||||
List<AssetDataDict> list = this.list(new LambdaQueryWrapper<AssetDataDict>() {{
|
||||
eq(AssetDataDict::getBasicId, basicId);
|
||||
or(assetDataDictLambdaQueryWrapper -> assetDataDictLambdaQueryWrapper.eq(AssetDataDict::getId, 1L));
|
||||
}});
|
||||
List<BasicDictResp> collect = list.stream().map(assetDataDict -> {
|
||||
List<DictInfo> dictInfoList = dictInfoService.list(
|
||||
new LambdaQueryWrapper<DictInfo>()
|
||||
.eq(DictInfo::getDictId, assetDataDict.getId()
|
||||
)
|
||||
);
|
||||
return BasicDictResp.builder()
|
||||
.id(assetDataDict.getId())
|
||||
.dictType(assetDataDict.getDictType())
|
||||
.dictName(assetDataDict.getDictName())
|
||||
.dictInfoList(dictInfoList)
|
||||
.basicId(assetDataDict.getBasicId())
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
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.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.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产赋权Service业务层处理
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper, AssetImpower> implements AssetImpowerService {
|
||||
@Autowired
|
||||
private AssetImpowerMapper assetImpowerMapper;
|
||||
@Autowired
|
||||
private TableInfoService tableInfoService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询资产赋权
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 资产赋权
|
||||
*/
|
||||
@Override
|
||||
public AssetImpower selectAssetImpowerById(Long id) {
|
||||
return assetImpowerMapper.selectAssetImpowerById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资产赋权列表
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 资产赋权
|
||||
*/
|
||||
@Override
|
||||
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower) {
|
||||
return assetImpowerMapper.selectAssetImpowerList(assetImpower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAssetImpower(AssetImpower assetImpower) {
|
||||
List<AssetImpower> rows = new ArrayList<>();
|
||||
assetImpower.setCreateTime(DateUtils.getNowDate());
|
||||
//创建一个部门容器和用户容器
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产赋权
|
||||
*
|
||||
* @param assetImpower 资产赋权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAssetImpower(AssetImpower assetImpower) {
|
||||
assetImpower.setUpdateTime(DateUtils.getNowDate());
|
||||
return assetImpowerMapper.updateAssetImpower(assetImpower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资产赋权
|
||||
*
|
||||
* @param ids 需要删除的资产赋权主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetImpowerByIds(Long[] ids) {
|
||||
return assetImpowerMapper.deleteAssetImpowerByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产赋权信息
|
||||
*
|
||||
* @param id 资产赋权主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetImpowerById(Long id) {
|
||||
return assetImpowerMapper.deleteAssetImpowerById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AssetImpower> getPowerByTableId(Long tableId) {
|
||||
return this.selectAssetImpowerList(new AssetImpower() {{
|
||||
setTableId(tableId);
|
||||
}});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,410 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
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.TableTreeResp;
|
||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import com.muyu.etl.service.StructureService;
|
||||
import com.muyu.etl.service.TableInfoService;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.sql.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapper, BasicConfigInfo> implements BasicConfigInfoService {
|
||||
@Autowired
|
||||
private BasicConfigInfoMapper basicConfigInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private StructureService structureService;
|
||||
|
||||
@Autowired
|
||||
private TableInfoService tableInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id) {
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo) {
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq) {
|
||||
return basicConfigInfoMapper.insertBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasicConfigInfo(BasicConfigInfo configQueryReq) {
|
||||
return basicConfigInfoMapper.updateBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids) {
|
||||
return basicConfigInfoMapper.deleteBasicConfigInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasicConfigInfoById(Long id) {
|
||||
return basicConfigInfoMapper.deleteBasicConfigInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接并同步
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException {
|
||||
//定义下面需要的对象
|
||||
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();
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
System.out.println("Connected to the MySQL server successfully.");
|
||||
//同步数据库信息
|
||||
//树级结构,库,表
|
||||
TableInfo tableInfoInsert = TableInfo.builder()
|
||||
.basicId(basicConfigInfo.getId())
|
||||
.parentId(0L)
|
||||
.tableRemark("")
|
||||
.center("Y")
|
||||
.type("dataSource")
|
||||
.tableName(basicConfigInfo.getDataSourcesSystemName() + "(" + databaseName + ")")
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
tableInfoService.saveOrUpdate(tableInfoInsert, new LambdaUpdateWrapper<TableInfo>(TableInfo.class) {{
|
||||
eq(TableInfo::getTableName, tableInfoInsert.getTableName());
|
||||
eq(TableInfo::getBasicId, basicConfigInfo.getId());
|
||||
}});
|
||||
//查询列表中的所有tableInfo basic_id 不存在删除
|
||||
//通过查询或去当前tableinfo对象的id
|
||||
TableInfo tableInfo = tableInfoService.selectTableInfoByName(tableInfoInsert);
|
||||
DatabaseMetaData metaData = conn.getMetaData();
|
||||
ResultSet rs = metaData.getTables(databaseName,
|
||||
null, "%", new String[]{"TABLE", "VIEW"});
|
||||
while (rs.next()) {
|
||||
//表名
|
||||
String tableName = rs.getString("TABLE_NAME");
|
||||
String tableRemark = rs.getString("REMARKS");
|
||||
Connection finalConn = conn;
|
||||
PreparedStatement ps = conn.prepareStatement("select * from " + tableName);
|
||||
ResultSet rset = ps.executeQuery();
|
||||
Long rowCount = 0L;
|
||||
while (rset.next()) {
|
||||
rowCount++;
|
||||
}
|
||||
TableInfo build = TableInfo.builder()
|
||||
.basicId(basicConfigInfo.getId())
|
||||
.tableName(tableName)
|
||||
//bug点,tableRemark为空,造成空指针异常
|
||||
.tableRemark(tableRemark == null ? "" : tableRemark)
|
||||
.parentId(tableInfo.getId())
|
||||
.type("dataTable")
|
||||
.center("Y")
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.dataNum(rowCount)
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
tableInfoService.saveOrUpdate(build, new LambdaUpdateWrapper<>(TableInfo.class) {{
|
||||
eq(TableInfo::getTableName, build.getTableName());
|
||||
eq(TableInfo::getBasicId, basicConfigInfo.getId());
|
||||
}});
|
||||
TableInfo table = tableInfoService.selectTableInfoByName(build);
|
||||
//线程池
|
||||
ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
|
||||
threadPool.submit(() -> {
|
||||
try {
|
||||
syncData(finalConn, databaseName, table);
|
||||
} catch (SQLException e) {
|
||||
try {
|
||||
throw new ServletException("同步数据失败");
|
||||
} catch (ServletException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
Runnable thread = new Runnable() {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
//同步
|
||||
syncData(finalConn, databaseName, table);
|
||||
} catch (SQLException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServletException("连接失败");
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.run();
|
||||
ps.close();
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServletException("连接失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步数据
|
||||
*
|
||||
* @param conn
|
||||
* @param databaseName
|
||||
* @param table
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void syncData(Connection conn, String databaseName, TableInfo table) throws SQLException {
|
||||
ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
PreparedStatement ps = conn.prepareStatement(
|
||||
" SELECT " +
|
||||
" COLUMN_NAME , " +
|
||||
" COLUMN_COMMENT ," +
|
||||
" CASE WHEN COLUMN_KEY = 'PRI' THEN '是' ELSE '否' END ," +
|
||||
" CASE \n" +
|
||||
" WHEN DATA_TYPE = 'int' THEN 'Integer' " +
|
||||
" WHEN DATA_TYPE = 'bigint' THEN 'Long' " +
|
||||
" WHEN DATA_TYPE = 'varchar' THEN 'String' " +
|
||||
" WHEN DATA_TYPE = 'decimal' THEN 'BigDecimal' " +
|
||||
" WHEN DATA_TYPE = 'tinyint' AND COLUMN_TYPE = 'tinyint(1)' THEN 'Boolean'" +
|
||||
" ELSE DATA_TYPE -- 如果无法映射,则返回原始数据库类型 \n" +
|
||||
" END , " +
|
||||
" DATA_TYPE , -- 原始的数据库类型 \n" +
|
||||
" COLUMN_TYPE , -- 更详细的数据库类型,可能包含长度、精度等 \n" +
|
||||
" CHARACTER_MAXIMUM_LENGTH , \n" +
|
||||
" NUMERIC_SCALE , \n" +
|
||||
" IS_NULLABLE , \n" +
|
||||
" COLUMN_DEFAULT \n" +
|
||||
"FROM INFORMATION_SCHEMA.COLUMNS WHERE \n" +
|
||||
"TABLE_SCHEMA = '" + databaseName + "' -- 替换为你的数据库名称 \n" +
|
||||
"AND TABLE_NAME = '" + table.getTableName() + "'");
|
||||
// "SELECT COLUMN_NAME,DATA_TYPE,IS_NULLABLE,COLUMN_KEY,COLUMN_DEFAULT,
|
||||
// COLUMN_COMMENT,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,
|
||||
// NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS
|
||||
// WHERE TABLE_SCHEMA = '数据库名' AND TABLE_NAME = '表名'"
|
||||
ResultSet resultSet = ps.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
String columnName = String.valueOf(resultSet.getString(1));
|
||||
String columnComment = String.valueOf(resultSet.getObject(2));
|
||||
String columnKey = String.valueOf(resultSet.getObject(3));
|
||||
String end = String.valueOf(resultSet.getObject(4));
|
||||
String dataType = String.valueOf(resultSet.getObject(5));
|
||||
String columnType = String.valueOf(resultSet.getObject(6));
|
||||
String characterMaximumLength = String.valueOf(resultSet.getInt(7));
|
||||
String NumericScale = String.valueOf(resultSet.getInt(8));
|
||||
String isNullable = String.valueOf(resultSet.getObject(9));
|
||||
String columnDefault = String.valueOf(resultSet.getObject(10));
|
||||
Structure build = Structure.builder()
|
||||
.tableId(table.getId())
|
||||
.columnName(String.valueOf(columnName))
|
||||
.columnRemark(columnComment)
|
||||
.isPrimary("是".equals(columnKey) ? "Y" : "N")
|
||||
.javaType(end)
|
||||
.columnType(dataType)
|
||||
.columnType(columnType)
|
||||
.columnLength(characterMaximumLength)
|
||||
.columnDecimals(NumericScale)
|
||||
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
||||
.defaultValue(columnDefault)
|
||||
.build();
|
||||
threadPool.submit(() -> {
|
||||
structureService.saveOrUpdate(build, new LambdaUpdateWrapper<Structure>() {{
|
||||
eq(Structure::getTableId, build.getTableId());
|
||||
eq(Structure::getColumnName, build.getColumnName());
|
||||
eq(Structure::getColumnRemark, build.getColumnRemark());
|
||||
}});
|
||||
});
|
||||
}
|
||||
threadPool.shutdown();
|
||||
ps.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取响应体对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TableTreeResp> getTableTree() {
|
||||
ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
List<TableTreeResp> tableTreeRespList = tableInfoService.selectTableInfoList(new TableInfo() {{
|
||||
setParentId(0L);
|
||||
}}).stream().map(tableInfo -> {
|
||||
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
|
||||
List<TableInfoStructureResp> tableInfoStructureRespList = tableInfoService.selectTableInfoList(new TableInfo() {{
|
||||
setParentId(tableInfo.getId());
|
||||
}}).stream().map(info -> {
|
||||
TableInfoStructureResp tableInfoStructureResp = null;
|
||||
Future<TableInfoStructureResp> submit = threadPool.submit(() -> {
|
||||
return TableInfoStructureResp.builder()
|
||||
.id(info.getId())
|
||||
.tableName(info.getTableName())
|
||||
.center(info.getCenter())
|
||||
.tableRemark(info.getTableRemark())
|
||||
.type(info.getType())
|
||||
.dataNum(info.getDataNum())
|
||||
.parentId(info.getParentId())
|
||||
.databaseType(basicConfigInfo.getDatabaseType())
|
||||
.structureList(null)
|
||||
.basicId(info.getBasicId())
|
||||
.build();
|
||||
});
|
||||
try {
|
||||
tableInfoStructureResp = submit.get();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return tableInfoStructureResp;
|
||||
}).collect(Collectors.toList());
|
||||
return TableTreeResp.builder()
|
||||
.tableInfo(tableInfo)
|
||||
.basicConfigInfo(basicConfigInfo)
|
||||
.Children(tableInfoStructureRespList)
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
threadPool.shutdown();
|
||||
while (true) if (threadPool.isTerminated()) break;
|
||||
|
||||
return tableTreeRespList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableInfoStructureResp getTableInfo(Long tableId) {
|
||||
TableInfo tableInfo = tableInfoService.selectTableInfoById(tableId);
|
||||
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
|
||||
List<Structure> structureList = structureService.list(new LambdaQueryWrapper<Structure>()
|
||||
.eq(Structure::getTableId, tableInfo.getId()));
|
||||
return TableInfoStructureResp.builder()
|
||||
.id(tableInfo.getId())
|
||||
.tableName(tableInfo.getTableName())
|
||||
.center(tableInfo.getCenter())
|
||||
.tableRemark(tableInfo.getTableRemark())
|
||||
.dataNum(tableInfo.getDataNum())
|
||||
.parentId(tableInfo.getParentId())
|
||||
.databaseType(basicConfigInfo.getDatabaseType())
|
||||
.structureList(structureList)
|
||||
.basicId(tableInfo.getBasicId())
|
||||
.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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import com.muyu.etl.mapper.DictInfoMapper;
|
||||
import com.muyu.etl.service.DictInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典详细内容Service业务层处理
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-24
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper, DictInfo> implements DictInfoService {
|
||||
@Autowired
|
||||
private DictInfoMapper dictInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询字典详细内容
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 字典详细内容
|
||||
*/
|
||||
@Override
|
||||
public DictInfo selectDictInfoById(Long id) {
|
||||
return dictInfoMapper.selectDictInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典详细内容列表
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 字典详细内容
|
||||
*/
|
||||
@Override
|
||||
public List<DictInfo> selectDictInfoList(DictInfo dictInfo) {
|
||||
return dictInfoMapper.selectDictInfoList(dictInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean insertDictInfo(DictInfo dictInfo) throws ServletException {
|
||||
dictInfo.setCreateTime(DateUtils.getNowDate());
|
||||
DictInfo one = this.getOne(new LambdaQueryWrapper<DictInfo>() {{
|
||||
eq(DictInfo::getDictId, dictInfo.getDictId());
|
||||
eq(DictInfo::getInfoName, dictInfo.getInfoName());
|
||||
eq(DictInfo::getInfoValue, dictInfo.getInfoValue());
|
||||
}});
|
||||
if (one!=null){
|
||||
throw new ServletException("该字典内容已存在");
|
||||
}
|
||||
boolean b = this.saveOrUpdate(dictInfo, new LambdaUpdateWrapper<DictInfo>(DictInfo.class) {{
|
||||
eq(DictInfo::getDictId, dictInfo.getDictId());
|
||||
eq(DictInfo::getInfoName, dictInfo.getInfoName());
|
||||
eq(DictInfo::getInfoValue, dictInfo.getInfoValue());
|
||||
}});
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典详细内容
|
||||
*
|
||||
* @param dictInfo 字典详细内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictInfo(DictInfo dictInfo) {
|
||||
dictInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return dictInfoMapper.updateDictInfo(dictInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除字典详细内容
|
||||
*
|
||||
* @param ids 需要删除的字典详细内容主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictInfoByIds(Long[] ids) {
|
||||
return dictInfoMapper.deleteDictInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典详细内容信息
|
||||
*
|
||||
* @param id 字典详细内容主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictInfoById(Long id) {
|
||||
return dictInfoMapper.deleteDictInfoById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
import com.muyu.etl.mapper.StructureMapper;
|
||||
import com.muyu.etl.service.StructureService;
|
||||
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-04-22
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> implements StructureService
|
||||
{
|
||||
@Autowired
|
||||
private StructureMapper structureMapper;
|
||||
|
||||
/**
|
||||
* 查询结构
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结构
|
||||
*/
|
||||
@Override
|
||||
public Structure selectStructureById(Long id)
|
||||
{
|
||||
return structureMapper.selectStructureById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结构列表
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结构
|
||||
*/
|
||||
@Override
|
||||
public List<Structure> selectStructureList(Structure structure)
|
||||
{
|
||||
return structureMapper.selectStructureList(structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertStructure(Structure structure)
|
||||
{
|
||||
structure.setCreateTime(DateUtils.getNowDate());
|
||||
return structureMapper.insertStructure(structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改结构
|
||||
*
|
||||
* @param structure 结构
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateStructure(Structure structure)
|
||||
{
|
||||
structure.setUpdateTime(DateUtils.getNowDate());
|
||||
return structureMapper.updateStructure(structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除结构
|
||||
*
|
||||
* @param ids 需要删除的结构主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStructureByIds(Long[] ids)
|
||||
{
|
||||
return structureMapper.deleteStructureByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除结构信息
|
||||
*
|
||||
* @param id 结构主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStructureById(Long id)
|
||||
{
|
||||
return structureMapper.deleteStructureById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateStructureInfoDict(Structure structure) {
|
||||
if ("N".equals(structure.getIsDictionary())){
|
||||
structure.setDictionaryTable("");
|
||||
}
|
||||
return this.saveOrUpdate(structure);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.Structure;
|
||||
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import com.muyu.etl.service.StructureService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.TableInfoMapper;
|
||||
import com.muyu.etl.domain.TableInfo;
|
||||
import com.muyu.etl.service.TableInfoService;
|
||||
|
||||
/**
|
||||
* 库表基础信息Service业务层处理
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class TableInfoServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
|
||||
@Autowired
|
||||
private TableInfoMapper tableInfoMapper;
|
||||
@Autowired
|
||||
private StructureService structureService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询库表基础信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 库表基础信息
|
||||
*/
|
||||
@Override
|
||||
public TableInfo selectTableInfoById(Long id) {
|
||||
return tableInfoMapper.selectTableInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库表基础信息列表
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 库表基础信息
|
||||
*/
|
||||
@Override
|
||||
public List<TableInfo> selectTableInfoList(TableInfo tableInfo) {
|
||||
return tableInfoMapper.selectTableInfoList(tableInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTableInfo(TableInfo tableInfo) {
|
||||
tableInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return tableInfoMapper.insertTableInfo(tableInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库表基础信息
|
||||
*
|
||||
* @param tableInfo 库表基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTableInfo(TableInfo tableInfo) {
|
||||
tableInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return tableInfoMapper.updateTableInfo(tableInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库表基础信息
|
||||
*
|
||||
* @param ids 需要删除的库表基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTableInfoByIds(Long[] ids) {
|
||||
return tableInfoMapper.deleteTableInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库表基础信息信息
|
||||
*
|
||||
* @param id 库表基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTableInfoById(Long id) {
|
||||
return tableInfoMapper.deleteTableInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableInfo selectTableInfoByName(TableInfo table) {
|
||||
return tableInfoMapper.selectTableInfoByName(table);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9205
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-etl
|
||||
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,88 @@
|
|||
<?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.etl.mapper.AssetDataDictMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.AssetDataDict" id="AssetDataDictResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="basicId" column="basic_id" />
|
||||
<result property="dictName" column="dict_name" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
<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="selectAssetDataDictVo">
|
||||
select id, basic_id, dict_name, dict_type, remark, create_by, create_time, update_by, update_time from asset_data_dict
|
||||
</sql>
|
||||
|
||||
<select id="selectAssetDataDictList" parameterType="com.muyu.etl.domain.AssetDataDict" resultMap="AssetDataDictResult">
|
||||
<include refid="selectAssetDataDictVo"/>
|
||||
<where>
|
||||
<if test="basicId != null "> and basic_id = #{basicId}</if>
|
||||
<if test="dictName != null and dictName != ''"> and dict_name like concat('%', #{dictName}, '%')</if>
|
||||
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAssetDataDictById" parameterType="Long" resultMap="AssetDataDictResult">
|
||||
<include refid="selectAssetDataDictVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAssetDataDict" parameterType="com.muyu.etl.domain.AssetDataDict">
|
||||
insert into asset_data_dict
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="basicId != null">basic_id,</if>
|
||||
<if test="dictName != null and dictName != ''">dict_name,</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type,</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="basicId != null">#{basicId},</if>
|
||||
<if test="dictName != null and dictName != ''">#{dictName},</if>
|
||||
<if test="dictType != null and dictType != ''">#{dictType},</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="updateAssetDataDict" parameterType="com.muyu.etl.domain.AssetDataDict">
|
||||
update asset_data_dict
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="basicId != null">basic_id = #{basicId},</if>
|
||||
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</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="deleteAssetDataDictById" parameterType="Long">
|
||||
delete from asset_data_dict where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAssetDataDictByIds" parameterType="String">
|
||||
delete from asset_data_dict where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue