数据资产完善
parent
f24449059b
commit
11b8eb0ada
|
@ -0,0 +1,85 @@
|
|||
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.etl.domain.AssetModel;
|
||||
import com.muyu.etl.service.AssetModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
public class AssetModelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private AssetModelService assetModelService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<AssetModel>> list(AssetModel assetModel)
|
||||
{
|
||||
startPage();
|
||||
List<AssetModel> list = assetModelService.selectAssetModelList(assetModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AssetModel assetModel)
|
||||
{
|
||||
List<AssetModel> list = assetModelService.selectAssetModelList(assetModel);
|
||||
ExcelUtil<AssetModel> util = new ExcelUtil<AssetModel>(AssetModel.class);
|
||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(assetModelService.selectAssetModelById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModelService.insertAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModelService.updateAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(assetModelService.deleteAssetModelByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
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.etl.domain.DataAsset;
|
||||
import com.muyu.etl.service.DataAssetService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/asset")
|
||||
public class DataAssetController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private DataAssetService dataAssetService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<DataAsset>> list(DataAsset dataAsset)
|
||||
{
|
||||
startPage();
|
||||
List<DataAsset> list = dataAssetService.selectDataAssetList(dataAsset);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DataAsset dataAsset)
|
||||
{
|
||||
List<DataAsset> list = dataAssetService.selectDataAssetList(dataAsset);
|
||||
ExcelUtil<DataAsset> util = new ExcelUtil<DataAsset>(DataAsset.class);
|
||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(dataAssetService.selectDataAssetById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody DataAsset dataAsset)
|
||||
{
|
||||
return toAjax(dataAssetService.insertDataAsset(dataAsset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody DataAsset dataAsset)
|
||||
{
|
||||
return toAjax(dataAssetService.updateDataAsset(dataAsset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(dataAssetService.deleteDataAssetByIds(ids));
|
||||
}
|
||||
}
|
|
@ -1,31 +1,25 @@
|
|||
package com.muyu.etl.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.etl.service.DataSourceService;
|
||||
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.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.DataAsset;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
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;
|
||||
import com.muyu.etl.service.DataSourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/source")
|
||||
public class DataSourceController extends BaseController {
|
||||
|
||||
public class DataSourceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private DataSourceService dataSourceService;
|
||||
|
||||
|
@ -34,19 +28,40 @@ public class DataSourceController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:source:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<DataSource>> list(DataSource dataSource) {
|
||||
public Result<TableDataInfo<DataSource>> list(DataSource dataSource)
|
||||
{
|
||||
startPage();
|
||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/AssetsList")
|
||||
public Result assetsList(@RequestBody DataSource dataSource) {
|
||||
public Result assetsList(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return dataSourceService.assetsList(dataSource);
|
||||
}
|
||||
|
||||
@PostMapping("/SynchronousData")
|
||||
public Result synchronousData(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return dataSourceService.synchronousData(dataSource);
|
||||
}
|
||||
|
||||
@PostMapping("/DataAssetList")
|
||||
public Result dataAssetList(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return dataSourceService.dataAssetList(dataSource);
|
||||
}
|
||||
|
||||
@PostMapping("/AssetModelList")
|
||||
public Result assetModelList(@RequestBody DataAsset dataAsset)
|
||||
{
|
||||
return dataSourceService.assetModelList(dataAsset);
|
||||
}
|
||||
|
||||
@PostMapping("/StructureList")
|
||||
public Result structureList(@RequestBody DataSource dataSource) {
|
||||
public Result structureList(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return dataSourceService.structureList(dataSource);
|
||||
}
|
||||
|
||||
|
@ -56,7 +71,8 @@ public class DataSourceController extends BaseController {
|
|||
@RequiresPermissions("system:source:export")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DataSource dataSource) {
|
||||
public void export(HttpServletResponse response, DataSource dataSource)
|
||||
{
|
||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
||||
ExcelUtil<DataSource> util = new ExcelUtil<DataSource>(DataSource.class);
|
||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||
|
@ -67,7 +83,8 @@ public class DataSourceController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:source:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id) {
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(dataSourceService.selectDataSourceById(id));
|
||||
}
|
||||
|
||||
|
@ -77,7 +94,8 @@ public class DataSourceController extends BaseController {
|
|||
@RequiresPermissions("system:source:add")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody DataSource dataSource) {
|
||||
public Result add(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return toAjax(dataSourceService.insertDataSource(dataSource));
|
||||
}
|
||||
|
||||
|
@ -86,7 +104,8 @@ public class DataSourceController extends BaseController {
|
|||
*/
|
||||
@Log(title = "测试连接", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/TestConnection")
|
||||
public Result testConnection(@RequestBody DataSource dataSource) {
|
||||
public Result testConnection(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return dataSourceService.testConnection(dataSource);
|
||||
}
|
||||
|
||||
|
@ -96,7 +115,8 @@ public class DataSourceController extends BaseController {
|
|||
@RequiresPermissions("system:source:edit")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody DataSource dataSource) {
|
||||
public Result edit(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return toAjax(dataSourceService.updateDataSource(dataSource));
|
||||
}
|
||||
|
||||
|
@ -106,8 +126,8 @@ public class DataSourceController extends BaseController {
|
|||
@RequiresPermissions("system:source:remove")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids) {
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public class AssetModel extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据资产ID
|
||||
*/
|
||||
@Excel(name = "数据资产ID")
|
||||
private Long dataAssetId;
|
||||
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
@Excel(name = "字段名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字段备注
|
||||
*/
|
||||
@Excel(name = "字段备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 是否主键
|
||||
*/
|
||||
@Excel(name = "是否主键")
|
||||
private String isPrimaryKey;
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
@Excel(name = "数据类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 映射数据类型
|
||||
*/
|
||||
@Excel(name = "映射数据类型")
|
||||
private String mappingType;
|
||||
|
||||
/** 长度 */
|
||||
@Excel(name = "长度")
|
||||
private String length;
|
||||
|
||||
/** 小数位 */
|
||||
@Excel(name = "小数位")
|
||||
private String decimalPlaces;
|
||||
|
||||
/** 是否不可为空 */
|
||||
@Excel(name = "是否不可为空")
|
||||
private String isNull;
|
||||
|
||||
/** 是否字典 */
|
||||
@Excel(name = "是否字典")
|
||||
private String isDict;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
/** 字典key */
|
||||
@Excel(name = "字典key")
|
||||
private String dictKey;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setDataAssetId(Long dataAssetId)
|
||||
{
|
||||
this.dataAssetId = dataAssetId;
|
||||
}
|
||||
|
||||
public Long getDataAssetId()
|
||||
{
|
||||
return dataAssetId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setComment(String comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getComment()
|
||||
{
|
||||
return comment;
|
||||
}
|
||||
public void setIsPrimaryKey(String isPrimaryKey)
|
||||
{
|
||||
this.isPrimaryKey = isPrimaryKey;
|
||||
}
|
||||
|
||||
public String getIsPrimaryKey()
|
||||
{
|
||||
return isPrimaryKey;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setMappingType(String mappingType)
|
||||
{
|
||||
this.mappingType = mappingType;
|
||||
}
|
||||
|
||||
public String getMappingType()
|
||||
{
|
||||
return mappingType;
|
||||
}
|
||||
public void setLength(String length)
|
||||
{
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public String getLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
public void setDecimalPlaces(String decimalPlaces)
|
||||
{
|
||||
this.decimalPlaces = decimalPlaces;
|
||||
}
|
||||
|
||||
public String getDecimalPlaces()
|
||||
{
|
||||
return decimalPlaces;
|
||||
}
|
||||
public void setIsNull(String isNull)
|
||||
{
|
||||
this.isNull = isNull;
|
||||
}
|
||||
|
||||
public String getIsNull()
|
||||
{
|
||||
return isNull;
|
||||
}
|
||||
public void setIsDict(String isDict)
|
||||
{
|
||||
this.isDict = isDict;
|
||||
}
|
||||
|
||||
public String getIsDict()
|
||||
{
|
||||
return isDict;
|
||||
}
|
||||
public void setDictKey(String dictKey)
|
||||
{
|
||||
this.dictKey = dictKey;
|
||||
}
|
||||
|
||||
public String getDictKey()
|
||||
{
|
||||
return dictKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("dataAssetId", getDataAssetId())
|
||||
.append("name", getName())
|
||||
.append("comment", getComment())
|
||||
.append("isPrimaryKey", getIsPrimaryKey())
|
||||
.append("type", getType())
|
||||
.append("mappingType", getMappingType())
|
||||
.append("length", getLength())
|
||||
.append("decimalPlaces", getDecimalPlaces())
|
||||
.append("isNull", getIsNull())
|
||||
.append("isDict", getIsDict())
|
||||
.append("defaultValue", getDefaultValue())
|
||||
.append("dictKey", getDictKey())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
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;
|
||||
|
||||
public class DataAsset extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 数据接入ID */
|
||||
@Excel(name = "数据接入ID")
|
||||
private Long dataSourceId;
|
||||
|
||||
/** 表名称 */
|
||||
@Excel(name = "表名称")
|
||||
private String tableName;
|
||||
|
||||
/** 表备注 */
|
||||
@Excel(name = "表备注")
|
||||
private String tableComment;
|
||||
|
||||
/** 数据量 */
|
||||
@Excel(name = "数据量")
|
||||
private Long tableCount;
|
||||
|
||||
/** 资产模型 */
|
||||
@Excel(name = "资产模型")
|
||||
private Long fields;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setDataSourceId(Long dataSourceId)
|
||||
{
|
||||
this.dataSourceId = dataSourceId;
|
||||
}
|
||||
|
||||
public Long getDataSourceId()
|
||||
{
|
||||
return dataSourceId;
|
||||
}
|
||||
public void setTableName(String tableName)
|
||||
{
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public String getTableName()
|
||||
{
|
||||
return tableName;
|
||||
}
|
||||
public void setTableComment(String tableComment)
|
||||
{
|
||||
this.tableComment = tableComment;
|
||||
}
|
||||
|
||||
public String getTableComment()
|
||||
{
|
||||
return tableComment;
|
||||
}
|
||||
public void setTableCount(Long tableCount)
|
||||
{
|
||||
this.tableCount = tableCount;
|
||||
}
|
||||
|
||||
public Long getTableCount()
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public void setFields(Long fields)
|
||||
{
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public Long getFields()
|
||||
{
|
||||
return fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("dataSourceId", getDataSourceId())
|
||||
.append("tableName", getTableName())
|
||||
.append("tableComment", getTableComment())
|
||||
.append("tableCount", getTableCount())
|
||||
.append("fields", getFields())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.etl.domain.custom;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TableAssets {
|
||||
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字段注释
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 是否主键
|
||||
*/
|
||||
private String isPrimaryKey;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 映射类型
|
||||
*/
|
||||
private String mappingType;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private String length;
|
||||
|
||||
/**
|
||||
* 小数位
|
||||
*/
|
||||
private String decimalPlaces;
|
||||
|
||||
/**
|
||||
* 是否可为空
|
||||
*/
|
||||
private String isNull;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* 是否字典
|
||||
*/
|
||||
private String isDict;
|
||||
|
||||
/**
|
||||
* 字段key
|
||||
*/
|
||||
private String dictKey;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.etl.domain.custom;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VTClass {
|
||||
|
||||
private String value;
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AssetModelMapper {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public AssetModel selectAssetModelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByIds(Long[] ids);
|
||||
|
||||
void batchInsert(@Param("tableAssets") List<AssetModel> tableAssets);
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface DataAssetMapper {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public DataAsset selectDataAssetById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<DataAsset> selectDataAssetList(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetByIds(Long[] ids);
|
||||
|
||||
void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets);
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
|
||||
public interface AssetModelService {
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public AssetModel selectAssetModelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelById(Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
|
||||
public interface DataAssetService {
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public DataAsset selectDataAssetById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<DataAsset> selectDataAssetList(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetById(Long id);
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.etl.service;
|
|||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
|
||||
public interface DataSourceService
|
||||
|
@ -61,4 +62,10 @@ public interface DataSourceService
|
|||
|
||||
Result structureList(DataSource dataSource);
|
||||
|
||||
Result synchronousData(DataSource dataSource);
|
||||
|
||||
Result dataAssetList(DataSource dataSource);
|
||||
|
||||
Result assetModelList(DataAsset dataAsset);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.service.AssetModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.AssetModelMapper;
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
|
||||
@Service
|
||||
public class AssetModelServiceImpl implements AssetModelService {
|
||||
|
||||
@Autowired
|
||||
private AssetModelMapper assetModelMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public AssetModel selectAssetModelById(Long id) {
|
||||
return assetModelMapper.selectAssetModelById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel) {
|
||||
return assetModelMapper.selectAssetModelList(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAssetModel(AssetModel assetModel) {
|
||||
assetModel.setCreateTime(DateUtils.getNowDate());
|
||||
return assetModelMapper.insertAssetModel(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param assetModel 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAssetModel(AssetModel assetModel) {
|
||||
assetModel.setUpdateTime(DateUtils.getNowDate());
|
||||
return assetModelMapper.updateAssetModel(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetModelByIds(Long[] ids) {
|
||||
return assetModelMapper.deleteAssetModelByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetModelById(Long id) {
|
||||
return assetModelMapper.deleteAssetModelById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.service.DataAssetService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.DataAssetMapper;
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
|
||||
@Service
|
||||
public class DataAssetServiceImpl implements DataAssetService {
|
||||
|
||||
@Autowired
|
||||
private DataAssetMapper dataAssetMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public DataAsset selectDataAssetById(Long id) {
|
||||
return dataAssetMapper.selectDataAssetById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<DataAsset> selectDataAssetList(DataAsset dataAsset) {
|
||||
return dataAssetMapper.selectDataAssetList(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDataAsset(DataAsset dataAsset) {
|
||||
dataAsset.setCreateTime(DateUtils.getNowDate());
|
||||
return dataAssetMapper.insertDataAsset(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDataAsset(DataAsset dataAsset) {
|
||||
dataAsset.setUpdateTime(DateUtils.getNowDate());
|
||||
return dataAssetMapper.updateDataAsset(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAssetByIds(Long[] ids) {
|
||||
return dataAssetMapper.deleteDataAssetByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAssetById(Long id) {
|
||||
return dataAssetMapper.deleteDataAssetById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.etl.service.impl;
|
|||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -9,14 +10,15 @@ import java.util.Map;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.etl.domain.AssetsModule;
|
||||
import com.muyu.etl.domain.TableAssets;
|
||||
import com.muyu.etl.domain.VTClass;
|
||||
import com.muyu.etl.domain.*;
|
||||
import com.muyu.etl.domain.custom.AssetsModule;
|
||||
import com.muyu.etl.domain.custom.VTClass;
|
||||
import com.muyu.etl.mapper.AssetModelMapper;
|
||||
import com.muyu.etl.mapper.DataAssetMapper;
|
||||
import com.muyu.etl.service.DataSourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.DataSourceMapper;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
|
||||
@Service
|
||||
public class DataSourceServiceImpl implements DataSourceService {
|
||||
|
@ -24,6 +26,12 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
@Autowired
|
||||
private DataSourceMapper dataSourceMapper;
|
||||
|
||||
@Autowired
|
||||
private DataAssetMapper dataAssetMapper;
|
||||
|
||||
@Autowired
|
||||
private AssetModelMapper assetModelMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
|
@ -44,33 +52,6 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
@Override
|
||||
public List<DataSource> selectDataSourceList(DataSource dataSource) {
|
||||
List<DataSource> dataSources = dataSourceMapper.selectDataSourceList(dataSource);
|
||||
dataSources.stream()
|
||||
.map(source -> {
|
||||
String user = source.getUsername();
|
||||
String password = source.getPassword();
|
||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||
String jdbcUrl = "jdbc:mysql://"+source.getLinkAddress()+":"+source.getPort()+"/"+source.getDatabaseName();
|
||||
Connection conn = null;
|
||||
Result result = this.testConnection(source);
|
||||
if(result.getCode()==200){
|
||||
try {
|
||||
Class.forName(jdbcDriver);
|
||||
conn = DriverManager.getConnection(jdbcUrl,user,password);
|
||||
ArrayList<String> tableNames = new ArrayList<>();
|
||||
String sql="SELECT table_name FROM information_schema.tables WHERE table_schema = '"+source.getDatabaseName()+"'";
|
||||
PreparedStatement ps = conn.prepareStatement(sql);
|
||||
ResultSet resultSet = ps.executeQuery();
|
||||
while (resultSet.next()){
|
||||
tableNames.add(resultSet.getString("table_name"));
|
||||
}
|
||||
source.setTableList(tableNames);
|
||||
ps.close();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}).toList();
|
||||
return dataSources;
|
||||
}
|
||||
|
||||
|
@ -146,18 +127,18 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
return Result.success("连接成功");
|
||||
}
|
||||
|
||||
public AssetsModule getStructrue(DataSource dataSource){
|
||||
public AssetsModule getStructure(DataSource dataSource){
|
||||
String user = dataSource.getUsername();
|
||||
String password = dataSource.getPassword();
|
||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||
String jdbcUrl = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||
Connection conn = null;
|
||||
ArrayList<Map<String, VTClass>> kvtList = new ArrayList<>();
|
||||
List<Map<String, VTClass>> kvtList = new ArrayList<>();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
try {
|
||||
Class.forName(jdbcDriver);
|
||||
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
|
@ -166,18 +147,18 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
ResultSetMetaData rsd = resultSet.getMetaData();
|
||||
for(int i = 1; i <= rsd.getColumnCount(); i++) {
|
||||
String substring = rsd.getColumnClassName(i).substring(rsd.getColumnClassName(i).indexOf("java.lang.") + 10);
|
||||
System.out.println("java类型:"+substring);
|
||||
System.out.println("数据库类型:"+rsd.getColumnTypeName(i));
|
||||
System.out.println("字段名称:"+rsd.getCatalogName(i));
|
||||
System.out.print("java类型:"+substring);
|
||||
System.out.print("数据库类型:"+rsd.getColumnTypeName(i));
|
||||
System.out.print("字段名称:"+rsd.getColumnName(i));
|
||||
System.out.println();
|
||||
map.put(rsd.getColumnName(i),substring);
|
||||
}
|
||||
int columnCount = rsd.getColumnCount();
|
||||
// 遍历每一行的数据
|
||||
while (resultSet.next()){
|
||||
HashMap<String, VTClass> stringVTClassHashMap = new HashMap<>();
|
||||
Map<String, VTClass> stringVTClassHashMap = new HashMap<>();
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
//根据索引或列名获取数据
|
||||
// 根据列索引或列名获取数据
|
||||
String columnName = rsd.getColumnName(i);
|
||||
String type = map.get(columnName);
|
||||
Object value = resultSet.getObject(i);
|
||||
|
@ -199,13 +180,13 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
return assetsModule;
|
||||
}
|
||||
|
||||
public List<TableAssets> getTableAssets(DataSource dataSource){
|
||||
public List<AssetModel> getTableAssets(DataSource dataSource, String tableName){
|
||||
String user = dataSource.getUsername();
|
||||
String password = dataSource.getPassword();
|
||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||
String jdbcUrl = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||
Connection conn = null;
|
||||
List<TableAssets> tableAssets = new ArrayList<>();
|
||||
List<AssetModel> assetModels = new ArrayList<>();
|
||||
try {
|
||||
Class.forName(jdbcDriver);
|
||||
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
||||
|
@ -219,24 +200,60 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
PreparedStatement pst = conn.prepareStatement("DESCRIBE "+dataSource.getTableName());
|
||||
PreparedStatement pst = conn.prepareStatement("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 = '"+dataSource.getDatabaseName()+"' AND TABLE_NAME = '"+tableName+"'");
|
||||
ResultSet resultSet = pst.executeQuery();
|
||||
ResultSetMetaData rsd = resultSet.getMetaData();
|
||||
while (resultSet.next()) {
|
||||
TableAssets tableAsset = new TableAssets();
|
||||
tableAsset.setField(resultSet.getString("Field"));
|
||||
tableAsset.setType(resultSet.getString("Type"));
|
||||
tableAsset.setNull(resultSet.getString("Null"));
|
||||
tableAsset.setKey(resultSet.getString("Key"));
|
||||
tableAsset.setDefault(resultSet.getString("Default"));
|
||||
tableAssets.add(tableAsset);
|
||||
AssetModel assetModel = new AssetModel();
|
||||
|
||||
assetModel.setComment(resultSet.getString("COLUMN_COMMENT"));
|
||||
assetModel.setName(resultSet.getString("COLUMN_NAME"));
|
||||
if (resultSet.getString("CHARACTER_MAXIMUM_LENGTH")!=null){
|
||||
assetModel.setLength(resultSet.getString("CHARACTER_MAXIMUM_LENGTH"));
|
||||
}else if (resultSet.getString("NUMERIC_PRECISION")!=null){
|
||||
assetModel.setLength(resultSet.getString("NUMERIC_PRECISION"));
|
||||
}else{
|
||||
assetModel.setLength("-");
|
||||
}
|
||||
if (resultSet.getString("NUMERIC_SCALE")!=null){
|
||||
assetModel.setDecimalPlaces(resultSet.getString("NUMERIC_SCALE"));
|
||||
}else{
|
||||
assetModel.setDecimalPlaces("-");
|
||||
}
|
||||
//是否不可为空
|
||||
if (resultSet.getString("IS_NULLABLE").equals("NO")){
|
||||
assetModel.setIsNull("N");
|
||||
}else{
|
||||
assetModel.setIsNull("Y");
|
||||
}
|
||||
//是否有默认值
|
||||
if (resultSet.getString("COLUMN_DEFAULT")!=null){
|
||||
assetModel.setDefaultValue(resultSet.getString("COLUMN_DEFAULT"));
|
||||
}else{
|
||||
assetModel.setDefaultValue("-");
|
||||
}
|
||||
assetModel.setIsDict("");
|
||||
assetModel.setDictKey("");
|
||||
assetModel.setType(resultSet.getString("DATA_TYPE"));
|
||||
//是否主键
|
||||
if ("PRI".equals(resultSet.getString("COLUMN_KEY"))){
|
||||
assetModel.setIsPrimaryKey("Y");
|
||||
}else{
|
||||
assetModel.setIsPrimaryKey("N");
|
||||
}
|
||||
assetModel.setCreateBy(SecurityUtils.getUsername());
|
||||
assetModel.setCreateTime(new Date());
|
||||
assetModel.setMappingType("String");
|
||||
assetModels.add(assetModel);
|
||||
}
|
||||
|
||||
pst.close();
|
||||
} catch(SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tableAssets;
|
||||
return assetModels;
|
||||
}
|
||||
|
||||
public AssetsModule getAssets(DataSource dataSource){
|
||||
String user = dataSource.getUsername();
|
||||
String password = dataSource.getPassword();
|
||||
|
@ -244,7 +261,7 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
String jdbcUrl = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||
Connection conn = null;
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
List<TableAssets> tableAssets = getTableAssets(dataSource);
|
||||
List<AssetModel> assetModels = getTableAssets(dataSource,dataSource.getTableName());
|
||||
try {
|
||||
Class.forName(jdbcDriver);
|
||||
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
||||
|
@ -257,19 +274,17 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
ResultSetMetaData rsd = resultSet.getMetaData();
|
||||
for(int i = 1; i <= rsd.getColumnCount(); i++) {
|
||||
String substring = rsd.getColumnClassName(i).substring(rsd.getColumnClassName(i).indexOf("java.lang.") + 10);
|
||||
System.out.print("java类型:"+substring);
|
||||
System.out.print(" 数据库类型:"+rsd.getColumnTypeName(i));
|
||||
System.out.print(" 字段名称:"+rsd.getColumnName(i));
|
||||
System.out.println();
|
||||
map.put(rsd.getColumnName(i),substring);
|
||||
}
|
||||
for (AssetModel tableAsset : assetModels) {
|
||||
tableAsset.setMappingType(map.get(tableAsset.getType()));
|
||||
}
|
||||
pst.close();
|
||||
} catch(SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AssetsModule assetsModule = new AssetsModule();
|
||||
assetsModule.setStructure(map);
|
||||
assetsModule.setTableAssets(tableAssets);
|
||||
return assetsModule;
|
||||
}
|
||||
|
||||
|
@ -281,8 +296,62 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||
|
||||
@Override
|
||||
public Result structureList(DataSource dataSource) {
|
||||
AssetsModule kvt = getStructrue(dataSource);
|
||||
AssetsModule kvt = getStructure(dataSource);
|
||||
return Result.success(kvt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result synchronousData(DataSource dataSource) {
|
||||
String user = dataSource.getUsername();
|
||||
String password = dataSource.getPassword();
|
||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||
String jdbcUrl = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||
Connection conn = null;
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
ArrayList<DataAsset> dataAssets = new ArrayList<>();
|
||||
try {
|
||||
Class.forName(jdbcDriver);
|
||||
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
||||
String sql="SELECT TABLE_NAME t_name,TABLE_COMMENT table_comment,TABLE_ROWS table_rows,(SELECT count(*) FROM INFORMATION_SCHEMA.columns WHERE TABLE_SCHEMA = '"+dataSource.getDatabaseName()+"' and TABLE_NAME=t_name) fields FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='"+dataSource.getDatabaseName()+"'";
|
||||
PreparedStatement ps = conn.prepareStatement(sql);
|
||||
ResultSet resultSet = ps.executeQuery();
|
||||
while (resultSet.next()){
|
||||
DataAsset dataAsset = new DataAsset();
|
||||
dataAsset.setTableName(resultSet.getString("t_name"));
|
||||
dataAsset.setTableComment(resultSet.getString("table_comment"));
|
||||
dataAsset.setTableCount(Long.valueOf(resultSet.getString("table_rows")));
|
||||
dataAsset.setFields(Long.valueOf(resultSet.getString("fields")));
|
||||
dataAsset.setDataSourceId(dataSource.getId());
|
||||
dataAsset.setCreateBy(SecurityUtils.getUsername());
|
||||
dataAsset.setCreateTime(new Date());
|
||||
dataAssets.add(dataAsset);
|
||||
}
|
||||
dataAssetMapper.batchInsert(dataAssets);
|
||||
for (DataAsset dataAsset : dataAssets) {
|
||||
List<AssetModel> tableAssets = getTableAssets(dataSource, dataAsset.getTableName());
|
||||
tableAssets.stream().forEach(assetModel -> assetModel.setDataAssetId(dataAsset.getId()));
|
||||
assetModelMapper.batchInsert(tableAssets);
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result dataAssetList(DataSource dataSource) {
|
||||
DataAsset dataAsset = new DataAsset();
|
||||
dataAsset.setDataSourceId(dataSource.getId());
|
||||
List<DataAsset> dataAssets = dataAssetMapper.selectDataAssetList(dataAsset);
|
||||
return Result.success(dataAssets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result assetModelList(DataAsset dataAsset) {
|
||||
AssetModel assetModel = new AssetModel();
|
||||
assetModel.setDataAssetId(dataAsset.getId());
|
||||
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
||||
return Result.success(assetModels);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
<?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.AssetModelMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.AssetModel" id="AssetModelResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dataAssetId" column="data_asset_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="isPrimaryKey" column="is_primary_key" />
|
||||
<result property="type" column="type" />
|
||||
<result property="mappingType" column="mapping_type" />
|
||||
<result property="length" column="length" />
|
||||
<result property="decimalPlaces" column="decimal_places" />
|
||||
<result property="isNull" column="is_null" />
|
||||
<result property="isDict" column="is_dict" />
|
||||
<result property="defaultValue" column="default_value" />
|
||||
<result property="dictKey" column="dict_key" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAssetModelVo">
|
||||
select id, data_asset_id, name, comment, is_primary_key, type, mapping_type, length, decimal_places, is_null, is_dict,default_value, dict_key, create_by, create_time, update_by, update_time, remark from asset_model
|
||||
</sql>
|
||||
|
||||
<select id="selectAssetModelList" parameterType="com.muyu.etl.domain.AssetModel" resultMap="AssetModelResult">
|
||||
<include refid="selectAssetModelVo"/>
|
||||
<where>
|
||||
<if test="dataAssetId != null "> and data_asset_id = #{dataAssetId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isPrimaryKey != null and isPrimaryKey != ''"> and is_primary_key = #{isPrimaryKey}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="mappingType != null and mappingType != ''"> and mapping_type = #{mappingType}</if>
|
||||
<if test="length != null and length != ''"> and length = #{length}</if>
|
||||
<if test="decimalPlaces != null and decimalPlaces != ''"> and decimal_places = #{decimalPlaces}</if>
|
||||
<if test="isNull != null and isNull != ''"> and is_null = #{isNull}</if>
|
||||
<if test="isDict != null and isDict != ''"> and is_dict = #{isDict}</if>
|
||||
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
|
||||
<if test="dictKey != null and dictKey != ''"> and dict_key = #{dictKey}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAssetModelById" parameterType="Long" resultMap="AssetModelResult">
|
||||
<include refid="selectAssetModelVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAssetModel" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into asset_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dataAssetId != null">data_asset_id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="isPrimaryKey != null">is_primary_key,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="mappingType != null">mapping_type,</if>
|
||||
<if test="length != null">length,</if>
|
||||
<if test="decimalPlaces != null">decimal_places,</if>
|
||||
<if test="isNull != null">is_null,</if>
|
||||
<if test="isDict != null">is_dict,</if>
|
||||
<if test="defaultValue != null">default_value,</if>
|
||||
<if test="dictKey != null">dict_key,</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>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataAssetId != null">#{dataAssetId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="isPrimaryKey != null">#{isPrimaryKey},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="mappingType != null">#{mappingType},</if>
|
||||
<if test="length != null">#{length},</if>
|
||||
<if test="decimalPlaces != null">#{decimalPlaces},</if>
|
||||
<if test="isNull != null">#{isNull},</if>
|
||||
<if test="isDict != null">#{isDict},</if>
|
||||
<if test="defaultValue != null">#{defaultValue},</if>
|
||||
<if test="dictKey != null">#{dictKey},</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>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" >
|
||||
insert into `asset_model`
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
`data_asset_id`,
|
||||
`name`,
|
||||
comment,
|
||||
is_primary_key,
|
||||
`type`,
|
||||
mapping_type,
|
||||
`length`,
|
||||
decimal_places,
|
||||
is_null,
|
||||
is_dict,
|
||||
default_value,
|
||||
dict_key,
|
||||
create_by,
|
||||
create_time,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="tableAssets" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="item.dataAssetId != null">#{item.dataAssetId},</if>
|
||||
<if test="item.name != null">#{item.name},</if>
|
||||
<if test="item.comment != null">#{item.comment},</if>
|
||||
<if test="item.isPrimaryKey != null">#{item.isPrimaryKey},</if>
|
||||
<if test="item.type != null">#{item.type},</if>
|
||||
<if test="item.mappingType != null">#{item.mappingType},</if>
|
||||
<if test="item.length != null">#{item.length},</if>
|
||||
<if test="item.decimalPlaces != null">#{item.decimalPlaces},</if>
|
||||
<if test="item.isNull != null">#{item.isNull},</if>
|
||||
<if test="item.isDict != null">#{item.isDict},</if>
|
||||
<if test="item.defaultValue != null">#{item.defaultValue},</if>
|
||||
<if test="item.dictKey != null">#{item.dictKey},</if>
|
||||
<if test="item.createBy != null and item.createBy != ''">#{item.createBy},</if>
|
||||
<if test="item.createTime != null">#{item.createTime},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
<update id="updateAssetModel" parameterType="com.muyu.etl.domain.AssetModel">
|
||||
update asset_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dataAssetId != null">data_asset_id = #{dataAssetId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="isPrimaryKey != null">is_primary_key = #{isPrimaryKey},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="mappingType != null">mapping_type = #{mappingType},</if>
|
||||
<if test="length != null">length = #{length},</if>
|
||||
<if test="decimalPlaces != null">decimal_places = #{decimalPlaces},</if>
|
||||
<if test="isNull != null">is_null = #{isNull},</if>
|
||||
<if test="isDict != null">is_dict = #{isDict},</if>
|
||||
<if test="defaultValue != null">default_value = #{defaultValue},</if>
|
||||
<if test="dictKey != null">dict_key = #{dictKey},</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>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAssetModelById" parameterType="Long">
|
||||
delete from asset_model where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAssetModelByIds" parameterType="String">
|
||||
delete from asset_model where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,120 @@
|
|||
<?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.DataAssetMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.DataAsset" id="DataAssetResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dataSourceId" column="data_source_id" />
|
||||
<result property="tableName" column="table_name" />
|
||||
<result property="tableComment" column="table_comment" />
|
||||
<result property="tableCount" column="table_count" />
|
||||
<result property="fields" column="fields" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDataAssetVo">
|
||||
select id, data_source_id, table_name, table_comment, table_count, fields, create_by, create_time, update_by, update_time, remark from data_asset
|
||||
</sql>
|
||||
|
||||
<select id="selectDataAssetList" parameterType="com.muyu.etl.domain.DataAsset" resultMap="DataAssetResult">
|
||||
<include refid="selectDataAssetVo"/>
|
||||
<where>
|
||||
<if test="dataSourceId != null "> and data_source_id = #{dataSourceId}</if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
||||
<if test="tableComment != null and tableComment != ''"> and table_comment = #{tableComment}</if>
|
||||
<if test="tableCount != null "> and table_count = #{tableCount}</if>
|
||||
<if test="fields != null "> and fields = #{fields}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDataAssetById" parameterType="Long" resultMap="DataAssetResult">
|
||||
<include refid="selectDataAssetVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDataAsset" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into data_asset
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">data_source_id,</if>
|
||||
<if test="tableName != null">table_name,</if>
|
||||
<if test="tableComment != null">table_comment,</if>
|
||||
<if test="tableCount != null">table_count,</if>
|
||||
<if test="fields != null">fields,</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>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">#{dataSourceId},</if>
|
||||
<if test="tableName != null">#{tableName},</if>
|
||||
<if test="tableComment != null">#{tableComment},</if>
|
||||
<if test="tableCount != null">#{tableCount},</if>
|
||||
<if test="fields != null">#{fields},</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>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchInsert" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into data_asset
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
data_source_id,
|
||||
`table_name`,
|
||||
table_comment,
|
||||
table_count,
|
||||
fields,
|
||||
create_by,
|
||||
create_time,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="dataAssets" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{item.dataSourceId},
|
||||
#{item.tableName},
|
||||
#{item.tableComment},
|
||||
#{item.tableCount},
|
||||
#{item.fields},
|
||||
#{item.createBy},
|
||||
#{item.createTime},
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDataAsset" parameterType="com.muyu.etl.domain.DataAsset">
|
||||
update data_asset
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">data_source_id = #{dataSourceId},</if>
|
||||
<if test="tableName != null">table_name = #{tableName},</if>
|
||||
<if test="tableComment != null">table_comment = #{tableComment},</if>
|
||||
<if test="tableCount != null">table_count = #{tableCount},</if>
|
||||
<if test="fields != null">fields = #{fields},</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>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDataAssetById" parameterType="Long">
|
||||
delete from data_asset where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDataAssetByIds" parameterType="String">
|
||||
delete from data_asset where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue