feat:资产授权修改
parent
3808c503af
commit
ebb130c8c4
|
@ -90,7 +90,6 @@
|
|||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.5.0</version> <!-- 使用当前最新稳定版本 -->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.AssetAccredit;
|
||||
import com.muyu.source.domain.req.AssetAccreditQueryReq;
|
||||
import com.muyu.source.service.AssetAccreditService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产授权控制层
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/assetAccredit")
|
||||
public class AssetAccreditController {
|
||||
|
||||
@Autowired
|
||||
private AssetAccreditService assetAccreditService;
|
||||
|
||||
/**
|
||||
* 查询资产授权列表
|
||||
* @param assetAccreditQueryReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Result list(@RequestBody AssetAccreditQueryReq assetAccreditQueryReq) {
|
||||
List<AssetAccredit> assetAccreditList = assetAccreditService.getList(assetAccreditQueryReq);
|
||||
return Result.success(assetAccreditList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加资产授权
|
||||
* @param assetAccredit
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addAccredit")
|
||||
public Result addAccredit(@RequestBody AssetAccredit assetAccredit) {
|
||||
assetAccreditService.save(assetAccredit);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/delAccredit/{id}")
|
||||
public Result delAccredit(@PathVariable("id") Integer id) {
|
||||
assetAccreditService.removeById(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -154,17 +154,6 @@ public class DataSourceController extends BaseController {
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表下的字段描述
|
||||
* @param showTableReq
|
||||
* @return
|
||||
*/
|
||||
// @PostMapping("/addTableData")
|
||||
// public Result addTableData(@RequestBody ShowTableReq showTableReq){
|
||||
// dataSourceService.addTableData(showTableReq);
|
||||
// return Result.success();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询表数据总数
|
||||
* @return
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.source.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 资产授权
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "asset_accredit")
|
||||
public class AssetAccredit {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 授权编号
|
||||
*/
|
||||
private Integer accreditId;
|
||||
/**
|
||||
* 编号类型 dept/user
|
||||
*/
|
||||
private String idType;
|
||||
/**
|
||||
* 授权数据
|
||||
*/
|
||||
private Integer dataId;
|
||||
/**
|
||||
* 授权数据类型 source/table
|
||||
*/
|
||||
private String dataType;
|
||||
}
|
|
@ -10,7 +10,6 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.source.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 资产授权查询对象
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AssetAccreditQueryReq {
|
||||
private String idType;
|
||||
private String dataType;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.source.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.source.domain.AssetAccredit;
|
||||
|
||||
/**
|
||||
* 资产授权mapper层
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
public interface AssetAccreditMapper extends BaseMapper<AssetAccredit> {
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.source.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.domain.AssetAccredit;
|
||||
import com.muyu.source.domain.req.AssetAccreditQueryReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产授权业务层
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
public interface AssetAccreditService extends IService<AssetAccredit> {
|
||||
|
||||
List<AssetAccredit> getList(AssetAccreditQueryReq assetAccreditQueryReq);
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.muyu.source.service;
|
|||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.AssetDataSource;
|
||||
import com.muyu.source.domain.Children;
|
||||
import com.muyu.source.domain.DataSource;
|
||||
|
@ -38,9 +37,6 @@ public interface DataSourceService extends IService<DataSource> {
|
|||
|
||||
List<AssetDataSource> getAssetList();
|
||||
|
||||
// List<Children> getChildrenList(AssetDataSource assetDataSource);
|
||||
// void addTableData(ShowTableReq showTableReq);
|
||||
|
||||
List<Children> getChildrenList(Integer id);
|
||||
|
||||
CountResp selectTableDataCount();
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.source.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.source.domain.AssetAccredit;
|
||||
import com.muyu.source.domain.req.AssetAccreditQueryReq;
|
||||
import com.muyu.source.mapper.AssetAccreditMapper;
|
||||
import com.muyu.source.service.AssetAccreditService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 资产授权实现层
|
||||
*
|
||||
* @author CHX
|
||||
* on 2024/4/28 星期日
|
||||
*/
|
||||
@Service
|
||||
public class AssetAccreditServiceImpl extends ServiceImpl<AssetAccreditMapper,AssetAccredit>
|
||||
implements AssetAccreditService {
|
||||
|
||||
@Override
|
||||
public List<AssetAccredit> getList(AssetAccreditQueryReq assetAccreditQueryReq) {
|
||||
if (Objects.isNull(assetAccreditQueryReq.getIdType())){
|
||||
throw new ServiceException("id类型不能为空");
|
||||
}
|
||||
if (Objects.isNull(assetAccreditQueryReq.getDataType())){
|
||||
throw new ServiceException("授权类型不能为空");
|
||||
}
|
||||
|
||||
List<AssetAccredit> assetAccreditList = list(new LambdaQueryWrapper<>() {{
|
||||
eq(AssetAccredit::getIdType, assetAccreditQueryReq.getIdType());
|
||||
eq(AssetAccredit::getDataType, assetAccreditQueryReq.getDataType());
|
||||
}});
|
||||
|
||||
return assetAccreditList;
|
||||
}
|
||||
}
|
|
@ -2,17 +2,13 @@ package com.muyu.source.service.impl;
|
|||
|
||||
import java.sql.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.source.domain.*;
|
||||
import com.muyu.source.domain.resp.CountResp;
|
||||
import com.muyu.source.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.source.mapper.DataSourceMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -349,6 +345,7 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
|||
tableDataService.updateById(tableData);
|
||||
}
|
||||
|
||||
// 获取字段在java中的映射类型
|
||||
public static String getJavaType(String driveClass, String jdbcUrl, DataSource dataSource, String tableName, String columnName) {
|
||||
String sql = "";
|
||||
Connection connection = null;
|
||||
|
@ -385,17 +382,6 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
|||
return javaType;
|
||||
}
|
||||
|
||||
// 建立连接
|
||||
public static Connection buildConnection(String driveClass, String url, String username, String password) {
|
||||
try {
|
||||
Class.forName(driveClass);
|
||||
Connection connection = DriverManager.getConnection(url, username, password);
|
||||
return connection;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// 建立连接
|
||||
public static boolean testDatasource(String driveClass, String url, String username, String password) {
|
||||
try {
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.source.domain.DictData;
|
||||
import com.muyu.source.domain.DictType;
|
||||
import com.muyu.source.domain.resp.DictDataResp;
|
||||
import com.muyu.source.mapper.DictDataMapper;
|
||||
import com.muyu.source.mapper.DictTypeMapper;
|
||||
import com.muyu.source.service.DictDataService;
|
||||
import com.muyu.source.service.DictTypeService;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?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.source.mapper.AssetAccreditMapper">
|
||||
|
||||
</mapper>
|
8
pom.xml
8
pom.xml
|
@ -35,6 +35,7 @@
|
|||
<minio.version>8.2.2</minio.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
|
||||
<postgresql.version>42.5.0</postgresql.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -206,6 +207,13 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 添加 PostgreSQL JDBC 驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version> <!-- 使用当前最新稳定版本 -->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue