feat(AssetStructureController):新增资产结构模块
parent
ab2a94179b
commit
a9170951fd
|
@ -55,4 +55,10 @@ public class ColumnInfo implements Serializable {
|
|||
|
||||
/** 表编号 */
|
||||
private Long tableId;
|
||||
|
||||
/** 是否字典 */
|
||||
private String isDict;
|
||||
|
||||
/** 数据字典编号 */
|
||||
private Long dataDictType;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package com.ruoyi.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.etl.domain.req.DataDictDataSaveReq;
|
||||
import com.ruoyi.etl.domain.req.DataDictDataEditReq;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典数据对象 data_dict_data
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("data_dict_data")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DataDictData", description = "字典数据")
|
||||
public class DataDictData extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
@TableId(value = "dict_code",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "字典编码", value = "字典编码")
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签")
|
||||
@ApiModelProperty(name = "字典标签", value = "字典标签", required = true)
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值")
|
||||
@ApiModelProperty(name = "字典键值", value = "字典键值", required = true)
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型编号 */
|
||||
@Excel(name = "字典类型编号")
|
||||
@ApiModelProperty(name = "字典类型编号", value = "字典类型编号", required = true)
|
||||
private Long dictTypeId;
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static DataDictData saveBuild(DataDictDataSaveReq dataDictDataSaveReq,Supplier<String> createBy){
|
||||
return DataDictData.builder()
|
||||
.dictLabel(dataDictDataSaveReq.getDictLabel())
|
||||
.dictValue(dataDictDataSaveReq.getDictValue())
|
||||
.dictTypeId(dataDictDataSaveReq.getDictTypeId())
|
||||
.createBy(createBy.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static DataDictData editBuild(Long dictCode, DataDictDataEditReq dataDictDataEditReq, Supplier<String> updateBy){
|
||||
return DataDictData.builder()
|
||||
.dictCode(dictCode)
|
||||
.dictLabel(dataDictDataEditReq.getDictLabel())
|
||||
.dictValue(dataDictDataEditReq.getDictValue())
|
||||
.dictTypeId(dataDictDataEditReq.getDictTypeId())
|
||||
.updateBy(updateBy.get())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.etl.domain.resp.DataDictResp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.etl.domain.req.DataDictTypeSaveReq;
|
||||
import com.ruoyi.etl.domain.req.DataDictTypeEditReq;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典类型对象 data_dict_type
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("data_dict_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DataDictType", description = "字典类型")
|
||||
public class DataDictType extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "字典主键", value = "字典主键")
|
||||
private Long id;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
@ApiModelProperty(name = "字典名称", value = "字典名称", required = true)
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
@ApiModelProperty(name = "字典类型", value = "字典类型", required = true)
|
||||
private String dictType;
|
||||
|
||||
/** 数据源编号 */
|
||||
@Excel(name = "数据源编号")
|
||||
@ApiModelProperty(name = "数据源编号", value = "数据源编号", required = true)
|
||||
private Long dataSourceId;
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static DataDictType saveBuild(DataDictTypeSaveReq dataDictTypeSaveReq,Supplier<String> createBy){
|
||||
return DataDictType.builder()
|
||||
.dictName(dataDictTypeSaveReq.getDictName())
|
||||
.dictType(dataDictTypeSaveReq.getDictType())
|
||||
.dataSourceId(dataDictTypeSaveReq.getDataSourceId())
|
||||
.createBy(createBy.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static DataDictType editBuild(Long id, DataDictTypeEditReq dataDictTypeEditReq, Supplier<String> updateBy){
|
||||
return DataDictType.builder()
|
||||
.id(id)
|
||||
.dictName(dataDictTypeEditReq.getDictName())
|
||||
.dictType(dataDictTypeEditReq.getDictType())
|
||||
.dataSourceId(dataDictTypeEditReq.getDataSourceId())
|
||||
.updateBy(updateBy.get())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public DataDictResp toDataDictResp(List<DataDictData> list) {
|
||||
return DataDictResp.builder()
|
||||
.id(this.getId())
|
||||
.dictName(this.getDictName())
|
||||
.dictType(this.getDictType())
|
||||
.dataSourceId(this.getDataSourceId())
|
||||
.columnData(list)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.etl.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字段详情
|
||||
* @ClassName ColumnInfoReq
|
||||
* @Author 森静若林
|
||||
* @Date 2024/4/21 21:16
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ColumnInfoReq implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
private Long id;
|
||||
|
||||
/** 是否字典 */
|
||||
private String isDict;
|
||||
|
||||
/** 数据字典编号 */
|
||||
private Long dataDictType;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.etl.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典数据对象 data_dict_data
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "DataDictDataEditReq", description = "字典数据")
|
||||
public class DataDictDataEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典标签 */
|
||||
@ApiModelProperty(name = "字典标签", value = "字典标签", required = true)
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@ApiModelProperty(name = "字典键值", value = "字典键值", required = true)
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型编号 */
|
||||
@ApiModelProperty(name = "字典类型编号", value = "字典类型编号", required = true)
|
||||
private Long dictTypeId;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.etl.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典数据对象 data_dict_data
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "DataDictDataSaveReq", description = "字典数据")
|
||||
public class DataDictDataSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
|
||||
@ApiModelProperty(name = "字典编码", value = "字典编码")
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典标签 */
|
||||
|
||||
@ApiModelProperty(name = "字典标签", value = "字典标签", required = true)
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
|
||||
@ApiModelProperty(name = "字典键值", value = "字典键值", required = true)
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型编号 */
|
||||
|
||||
@ApiModelProperty(name = "字典类型编号", value = "字典类型编号", required = true)
|
||||
private Long dictTypeId;
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.etl.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典类型对象 data_dict_type
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "DataDictTypeEditReq", description = "字典类型")
|
||||
public class DataDictTypeEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典名称 */
|
||||
@ApiModelProperty(name = "字典名称", value = "字典名称", required = true)
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@ApiModelProperty(name = "字典类型", value = "字典类型", required = true)
|
||||
private String dictType;
|
||||
|
||||
/** 数据源编号 */
|
||||
@ApiModelProperty(name = "数据源编号", value = "数据源编号", required = true)
|
||||
private Long dataSourceId;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.etl.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典类型对象 data_dict_type
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "DataDictTypeSaveReq", description = "字典类型")
|
||||
public class DataDictTypeSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
|
||||
@ApiModelProperty(name = "字典主键", value = "字典主键")
|
||||
private Long id;
|
||||
|
||||
/** 字典名称 */
|
||||
|
||||
@ApiModelProperty(name = "字典名称", value = "字典名称", required = true)
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
|
||||
@ApiModelProperty(name = "字典类型", value = "字典类型", required = true)
|
||||
private String dictType;
|
||||
|
||||
/** 数据源编号 */
|
||||
|
||||
@ApiModelProperty(name = "数据源编号", value = "数据源编号", required = true)
|
||||
private Long dataSourceId;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.etl.domain.resp;
|
||||
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典类型对象 DataDictResp
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "DataDictResp", description = "字典类型")
|
||||
public class DataDictResp implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
private Long id;
|
||||
|
||||
/** 字典名称 */
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
private String dictType;
|
||||
|
||||
/** 数据源编号 */
|
||||
private Long dataSourceId;
|
||||
|
||||
/** 字段数据 */
|
||||
private List<DataDictData> columnData;
|
||||
|
||||
}
|
|
@ -3,7 +3,9 @@ package com.ruoyi.etl.controller;
|
|||
import com.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.etl.domain.ColumnInfo;
|
||||
import com.ruoyi.etl.domain.DataSource;
|
||||
import com.ruoyi.etl.domain.req.ColumnInfoReq;
|
||||
import com.ruoyi.etl.domain.req.DataSourceQueryReq;
|
||||
import com.ruoyi.etl.domain.resp.AssetStructureResp;
|
||||
import com.ruoyi.etl.service.AssetStructureService;
|
||||
|
@ -41,7 +43,7 @@ public class AssetStructureController{
|
|||
* 通过数据源获取数据库信息
|
||||
*/
|
||||
@ApiOperation("获取数据接入详细信息")
|
||||
//@RequiresPermissions("etl:structure:query")
|
||||
@RequiresPermissions("etl:structure:query")
|
||||
@GetMapping("/getDatabaseData/{dataSourceId}")
|
||||
public Result<List<String>> getDatabaseData(@PathVariable Long dataSourceId) {
|
||||
return Result.success(assetStructureService.getDatabaseData(dataSourceId));
|
||||
|
@ -51,7 +53,7 @@ public class AssetStructureController{
|
|||
* 通过数据库类型查询可用数据源信息
|
||||
*/
|
||||
@ApiOperation("通过数据库类型查询可用数据源信息")
|
||||
//@RequiresPermissions("etl:structure:query")
|
||||
@RequiresPermissions("etl:structure:query")
|
||||
@GetMapping("/getDataSourceData/{databaseTypeId}")
|
||||
public Result<List<DataSource>> getDataSourceData(@PathVariable Long databaseTypeId) {
|
||||
return Result.success(assetStructureService.getDataSourceData(databaseTypeId));
|
||||
|
@ -61,10 +63,31 @@ public class AssetStructureController{
|
|||
* 通过数据库名查询资产结构数据
|
||||
*/
|
||||
@ApiOperation("通过数据库名查询表信息")
|
||||
//@RequiresPermissions("etl:structure:query")
|
||||
@RequiresPermissions("etl:structure:query")
|
||||
@GetMapping("/getAssetStructureData/{databaseName}")
|
||||
public Result<List<AssetStructureResp>> getAssetStructureData(@PathVariable String databaseName) {
|
||||
return Result.success(assetStructureService.getAssetStructureData(databaseName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字段信息编号查询字段信息
|
||||
*/
|
||||
@ApiOperation("通过字段信息编号查询字段信息")
|
||||
@RequiresPermissions("etl:structure:query")
|
||||
@GetMapping("/getTableData/{tableInfoId}")
|
||||
public Result<AssetStructureResp> getTableData(@PathVariable Long tableInfoId) {
|
||||
return Result.success(assetStructureService.getTableData(tableInfoId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改表映射字段数据
|
||||
*/
|
||||
@ApiOperation("修改表映射字段数据")
|
||||
@RequiresPermissions("etl:structure:edit")
|
||||
@PutMapping
|
||||
public Result<String> columnInfoEdit(@RequestBody ColumnInfoReq columnInfoReq) {
|
||||
assetStructureService.columnInfoEdit(columnInfoReq);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package com.ruoyi.etl.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.*;
|
||||
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.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
import com.ruoyi.etl.domain.req.DataDictDataSaveReq;
|
||||
import com.ruoyi.etl.domain.req.DataDictDataEditReq;
|
||||
import com.ruoyi.etl.service.DataDictDataService;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 字典数据Controller
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Api(tags = "字典数据")
|
||||
@RestController
|
||||
@RequestMapping("/dictData")
|
||||
public class DataDictDataController extends BaseController {
|
||||
@Autowired
|
||||
private DataDictDataService dataDictDataService;
|
||||
|
||||
/**
|
||||
* 查询字典数据列表
|
||||
*/
|
||||
@ApiOperation("获取字典数据列表")
|
||||
@RequiresPermissions("etl:dictData:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<DataDictData>> list() {
|
||||
startPage();
|
||||
List<DataDictData> list = dataDictDataService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据详细信息
|
||||
*/
|
||||
@ApiOperation("获取字典数据详细信息")
|
||||
@RequiresPermissions("etl:dictData:query")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
@ApiImplicitParam(name = "dictCode", value = "dictCode", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<DataDictData> getInfo(@PathVariable("dictCode") Long dictCode) {
|
||||
return Result.success(dataDictDataService.getById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典数据
|
||||
*/
|
||||
@RequiresPermissions("etl:dictData:add")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增字典数据")
|
||||
public Result<String> add(@RequestBody DataDictDataSaveReq dataDictDataSaveReq) {
|
||||
return toAjax(dataDictDataService.save(DataDictData.saveBuild(dataDictDataSaveReq, SecurityUtils::getUsername)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典数据
|
||||
*/
|
||||
@RequiresPermissions("etl:dictData:edit")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{dictCode}")
|
||||
@ApiOperation("修改字典数据")
|
||||
public Result<String> edit(@PathVariable Long dictCode, @RequestBody DataDictDataEditReq dataDictDataEditReq) {
|
||||
return toAjax(dataDictDataService.updateById(DataDictData.editBuild(dictCode,dataDictDataEditReq, SecurityUtils::getUsername)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典数据
|
||||
*/
|
||||
@RequiresPermissions("etl:dictData:remove")
|
||||
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
@ApiOperation("删除字典数据")
|
||||
@ApiImplicitParam(name = "dictCode", value = "dictCode", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> dictCodes) {
|
||||
return toAjax(dataDictDataService.removeBatchByIds(dictCodes));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.ruoyi.etl.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.etl.domain.resp.DataDictResp;
|
||||
import io.swagger.annotations.*;
|
||||
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.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.etl.domain.DataDictType;
|
||||
import com.ruoyi.etl.domain.req.DataDictTypeSaveReq;
|
||||
import com.ruoyi.etl.domain.req.DataDictTypeEditReq;
|
||||
import com.ruoyi.etl.service.DataDictTypeService;
|
||||
|
||||
/**
|
||||
* 字典类型Controller
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Api(tags = "字典类型")
|
||||
@RestController
|
||||
@RequestMapping("/dictType")
|
||||
public class DataDictTypeController extends BaseController {
|
||||
@Autowired
|
||||
private DataDictTypeService dataDictTypeService;
|
||||
|
||||
/**
|
||||
* 查询字典类型列表
|
||||
*/
|
||||
@ApiOperation("获取字典类型列表")
|
||||
@RequiresPermissions("etl:dictType:list")
|
||||
@GetMapping({"/list/{dataSourceId}","/list"})
|
||||
public Result<List<DataDictResp>> list(@PathVariable(required = false) Long dataSourceId) {
|
||||
DataDictType dataDictType = new DataDictType();
|
||||
if(Objects.nonNull(dataSourceId)){
|
||||
dataDictType.setDataSourceId(dataSourceId);
|
||||
}
|
||||
return Result.success(dataDictTypeService.list(dataDictType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型详细信息
|
||||
*/
|
||||
@ApiOperation("获取字典类型详细信息")
|
||||
@RequiresPermissions("etl:dictType:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<DataDictType> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(dataDictTypeService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@RequiresPermissions("etl:dictType:add")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增字典类型")
|
||||
public Result<String> add(@RequestBody DataDictTypeSaveReq dataDictTypeSaveReq) {
|
||||
return toAjax(dataDictTypeService.save(DataDictType.saveBuild(dataDictTypeSaveReq, SecurityUtils::getUsername)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@RequiresPermissions("etl:dictType:edit")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改字典类型")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody DataDictTypeEditReq dataDictTypeEditReq) {
|
||||
return toAjax(dataDictTypeService.updateById(DataDictType.editBuild(id,dataDictTypeEditReq, SecurityUtils::getUsername)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@RequiresPermissions("etl:dictType:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除字典类型")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(dataDictTypeService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.ruoyi.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
|
||||
/**
|
||||
* 字典数据Mapper接口
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface DataDictDataMapper extends BaseMapper<DataDictData> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.ruoyi.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.etl.domain.DataDictType;
|
||||
|
||||
/**
|
||||
* 字典类型Mapper接口
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface DataDictTypeMapper extends BaseMapper<DataDictType> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 字典数据Service接口
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface DataDictDataService extends IService<DataDictData> {
|
||||
/**
|
||||
* 查询字典数据列表
|
||||
*
|
||||
* @param dataDictData 字典数据
|
||||
* @return 字典数据集合
|
||||
*/
|
||||
public List<DataDictData> list(DataDictData dataDictData);
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.etl.domain.DataDictType;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.etl.domain.resp.DataDictResp;
|
||||
|
||||
/**
|
||||
* 字典类型Service接口
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface DataDictTypeService extends IService<DataDictType> {
|
||||
/**
|
||||
* 查询字典类型列表
|
||||
*
|
||||
* @param dataDictType 字典类型
|
||||
* @return 字典类型集合
|
||||
*/
|
||||
List<DataDictResp> list(DataDictType dataDictType);
|
||||
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
package com.ruoyi.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.etl.domain.ColumnInfo;
|
||||
import com.ruoyi.etl.domain.DataSource;
|
||||
import com.ruoyi.etl.domain.DatabaseType;
|
||||
import com.ruoyi.etl.domain.TableInfo;
|
||||
import com.ruoyi.etl.domain.req.ColumnInfoReq;
|
||||
import com.ruoyi.etl.domain.resp.AssetStructureResp;
|
||||
import com.ruoyi.etl.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -66,4 +68,18 @@ public class AssetStructureServiceImpl implements AssetStructureService {
|
|||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void columnInfoEdit(ColumnInfoReq columnInfoReq) {
|
||||
columnInfoService.update(new LambdaUpdateWrapper<ColumnInfo>()
|
||||
.set(ColumnInfo::getIsDict,columnInfoReq.getIsDict())
|
||||
.set(ColumnInfo::getDataDictType,columnInfoReq.getDataDictType())
|
||||
.eq(ColumnInfo::getId,columnInfoReq.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetStructureResp getTableData(Long tableInfoId) {
|
||||
return tableInfoService.getById(tableInfoId).toAssetStructureResp(columnInfoService.list(new LambdaQueryWrapper<ColumnInfo>()
|
||||
.eq(ColumnInfo::getTableId, tableInfoId)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.ruoyi.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.etl.mapper.DataDictDataMapper;
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
import com.ruoyi.etl.service.DataDictDataService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 字典数据Service业务层处理
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DataDictDataServiceImpl extends ServiceImpl<DataDictDataMapper, DataDictData> implements DataDictDataService {
|
||||
|
||||
/**
|
||||
* 查询字典数据列表
|
||||
*
|
||||
* @param dataDictData 字典数据
|
||||
* @return 字典数据
|
||||
*/
|
||||
@Override
|
||||
public List<DataDictData> list(DataDictData dataDictData) {
|
||||
LambdaQueryWrapper<DataDictData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(dataDictData.getDictLabel())){
|
||||
queryWrapper.eq(DataDictData::getDictLabel, dataDictData.getDictLabel());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(dataDictData.getDictValue())){
|
||||
queryWrapper.eq(DataDictData::getDictValue, dataDictData.getDictValue());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(dataDictData.getDictTypeId())){
|
||||
queryWrapper.eq(DataDictData::getDictTypeId, dataDictData.getDictTypeId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.ruoyi.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.ObjUtils;
|
||||
import com.ruoyi.etl.domain.DataDictData;
|
||||
import com.ruoyi.etl.domain.resp.DataDictResp;
|
||||
import com.ruoyi.etl.service.DataDictDataService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.etl.mapper.DataDictTypeMapper;
|
||||
import com.ruoyi.etl.domain.DataDictType;
|
||||
import com.ruoyi.etl.service.DataDictTypeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 字典类型Service业务层处理
|
||||
*
|
||||
* @author gtl
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DataDictTypeServiceImpl extends ServiceImpl<DataDictTypeMapper, DataDictType> implements DataDictTypeService {
|
||||
|
||||
@Autowired
|
||||
private DataDictDataService dataDictDataService;
|
||||
|
||||
/**
|
||||
* 查询字典类型列表
|
||||
*
|
||||
* @param dataDictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@Override
|
||||
public List<DataDictResp> list(DataDictType dataDictType) {
|
||||
LambdaQueryWrapper<DataDictType> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjUtils.notNull(dataDictType.getDataSourceId())){
|
||||
queryWrapper.eq(DataDictType::getDataSourceId, dataDictType.getDataSourceId());
|
||||
}
|
||||
|
||||
return list(queryWrapper).stream().map(dataDict -> {
|
||||
List<DataDictData> list = dataDictDataService.list(new LambdaQueryWrapper<DataDictData>()
|
||||
.eq(DataDictData::getDictTypeId, dataDict.getId()));
|
||||
return dataDict.toDataDictResp(list);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue