fix:字典表完善
parent
c5488049c1
commit
646e4c2c41
|
@ -68,12 +68,13 @@ public class AssetModelController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改【请填写功能名称】
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping("UpdateAssetModel")
|
||||||
public Result edit(@RequestBody AssetModel assetModel)
|
public Result edit(@RequestBody AssetModel assetModel)
|
||||||
{
|
{
|
||||||
return toAjax(assetModelService.updateAssetModel(assetModel));
|
return toAjax(assetModelService.updateAssetModel(assetModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】
|
* 删除【请填写功能名称】
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
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.etl.domain.Dictionary;
|
||||||
|
import com.muyu.etl.service.DictionaryService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dictionary")
|
||||||
|
public class DictionaryController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Dictionary>> getDictionaryList(Dictionary dictionary)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Dictionary> list = dictionaryService.selectDictionaryList(dictionary);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Dictionary dictionary)
|
||||||
|
{
|
||||||
|
List<Dictionary> list = dictionaryService.selectDictionaryList(dictionary);
|
||||||
|
ExcelUtil<Dictionary> util = new ExcelUtil<Dictionary>(Dictionary.class);
|
||||||
|
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取【请填写功能名称】详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(dictionaryService.selectDictionaryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PostMapping("/dictionary")
|
||||||
|
public Result add(@RequestBody Dictionary dictionary)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryService.insertDictionary(dictionary));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody Dictionary dictionary)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryService.updateDictionary(dictionary));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryService.deleteDictionaryByIds(ids));
|
||||||
|
}
|
||||||
|
@GetMapping("GetDictionaryList")
|
||||||
|
public Result getDictionaryList(@RequestParam("dataSourceId") Long dataSourceId){
|
||||||
|
return dictionaryService.getDictionaryList(dataSourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GetMapping("delDict")
|
||||||
|
// public Result delDict(Long id){
|
||||||
|
// return dictionaryService.delDict(id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -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.etl.domain.DictionaryData;
|
||||||
|
import com.muyu.etl.service.DictionaryDataService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data")
|
||||||
|
public class DictionaryDataController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private DictionaryDataService dictionaryDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<DictionaryData>> list(DictionaryData dictionaryData)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<DictionaryData> list = dictionaryDataService.selectDictionaryDataList(dictionaryData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DictionaryData dictionaryData)
|
||||||
|
{
|
||||||
|
List<DictionaryData> list = dictionaryDataService.selectDictionaryDataList(dictionaryData);
|
||||||
|
ExcelUtil<DictionaryData> util = new ExcelUtil<DictionaryData>(DictionaryData.class);
|
||||||
|
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取【请填写功能名称】详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(dictionaryDataService.selectDictionaryDataById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody DictionaryData dictionaryData)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryDataService.insertDictionaryData(dictionaryData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody DictionaryData dictionaryData)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryDataService.updateDictionaryData(dictionaryData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(dictionaryDataService.deleteDictionaryDataByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ package com.muyu.etl.domain;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName AssetModel
|
* @ClassName AssetModel
|
||||||
* @Description 描述
|
* @Description 描述
|
||||||
|
@ -24,6 +26,8 @@ public class AssetModel extends BaseEntity {
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
private String isDict;
|
private String isDict;
|
||||||
private String dictKey;
|
private String dictKey;
|
||||||
|
private Long dictionaryId;
|
||||||
|
private List<DictionaryData> dictionaryDatas;
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
package com.muyu.etl.domain;
|
package com.muyu.etl.domain;
|
||||||
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName DataAsset
|
||||||
|
* @Description 描述
|
||||||
|
* @Author HaoRan.Zhang
|
||||||
|
* @Date 2024/4/22 20:41
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class DataAsset extends BaseEntity {
|
public class DataAsset extends BaseEntity {
|
||||||
|
@ -63,4 +76,20 @@ public class DataAsset extends BaseEntity {
|
||||||
public void setFields(Long fields) {
|
public void setFields(Long fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataAsset dataAssetBuild(DataSource dataSource,ResultSet resultSet){
|
||||||
|
try {
|
||||||
|
return DataAsset.builder()
|
||||||
|
.tableName(resultSet.getString("t_name"))
|
||||||
|
.tableComment(resultSet.getString("table_comment") == null ? "-":resultSet.getString("table_comment"))
|
||||||
|
.tableCount(Long.valueOf(resultSet.getString("table_rows")))
|
||||||
|
.fields(Long.valueOf(resultSet.getString("fields")))
|
||||||
|
.dataSourceId(dataSource.getId())
|
||||||
|
.createBy(SecurityUtils.getUsername())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,5 @@ public class DataSource extends BaseEntity {
|
||||||
private String tableName;
|
private String tableName;
|
||||||
private List<TableDetail> tableList;
|
private List<TableDetail> tableList;
|
||||||
private String modeName;
|
private String modeName;
|
||||||
private String JdbcDriver;
|
private String jdbcDriver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,34 +7,34 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Dictionary
|
||||||
|
* @Description 描述
|
||||||
|
* @Author HaoRan.Zhang
|
||||||
|
* @Date 2024/4/25 15:02
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class Dictionary extends BaseEntity {
|
public class Dictionary extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称
|
* 字典名称
|
||||||
*/
|
*/
|
||||||
private String dictionaryName;
|
private String dictionaryName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典key
|
* 字典Key
|
||||||
*/
|
*/
|
||||||
private String dictionaryKey;
|
private String dictionaryKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源ID
|
* 数据源ID
|
||||||
*/
|
*/
|
||||||
private Long dataSourceId;
|
private Long dataSourceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典集合
|
* 字典集合
|
||||||
*/
|
*/
|
||||||
private List<DictionaryData> dictionaryDataList;
|
private List<DictionaryData> dictionaryDataList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,20 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName DictionaryData
|
||||||
|
* @Description 描述
|
||||||
|
* @Author HaoRan.Zhang
|
||||||
|
* @Date 2024/4/25 15:05
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class DictionaryData extends BaseEntity {
|
public class DictionaryData extends BaseEntity {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表Id
|
* 字典表Id
|
||||||
*/
|
*/
|
||||||
|
@ -32,4 +39,6 @@ public class DictionaryData extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private Boolean isEdit = false;
|
private Boolean isEdit = false;
|
||||||
|
|
||||||
|
private List<Dictionary> dictionaryDatas;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,4 +68,7 @@ public interface AssetModelMapper
|
||||||
int clearTable1(@Param("id") Long[] id);
|
int clearTable1(@Param("id") Long[] id);
|
||||||
|
|
||||||
void batchInsert(@Param("tableAssets") List<AssetModel> tableAssets);
|
void batchInsert(@Param("tableAssets") List<AssetModel> tableAssets);
|
||||||
|
|
||||||
|
void updateAssetModelDiction(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,6 @@ public interface DataAssetMapper
|
||||||
|
|
||||||
void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets);
|
void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets);
|
||||||
|
|
||||||
|
List<DataAsset> selectById(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,4 +77,6 @@ public interface DataSourceMapper
|
||||||
List<DataAsset> selectDataAssetBachId(@Param("longs") List<Long> longs);
|
List<DataAsset> selectDataAssetBachId(@Param("longs") List<Long> longs);
|
||||||
|
|
||||||
List<DataSource> selectId(Long id);
|
List<DataSource> selectId(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface DictionaryDataMapper {
|
public interface DictionaryDataMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -57,4 +56,8 @@ public interface DictionaryDataMapper {
|
||||||
|
|
||||||
List<DictionaryData> getDictionaryDataList(@Param("dictionaryIds") List<Long> dictionaryIds);
|
List<DictionaryData> getDictionaryDataList(@Param("dictionaryIds") List<Long> dictionaryIds);
|
||||||
|
|
||||||
|
void delDict(@Param("longs") List<Long> longs);
|
||||||
|
|
||||||
|
void deleteDictionaryDataBy(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface DictionaryMapper {
|
public interface DictionaryMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -58,4 +57,6 @@ public interface DictionaryMapper {
|
||||||
|
|
||||||
List<Dictionary> getDictionaryList(@Param("dataSourceId") Long dataSourceId);
|
List<Dictionary> getDictionaryList(@Param("dataSourceId") Long dataSourceId);
|
||||||
|
|
||||||
|
List<Dictionary> getDictionaryDataList(@Param("string") List<String> string);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,17 +64,14 @@ public interface DataSourceService
|
||||||
*/
|
*/
|
||||||
public int deleteDataSourceById(Long id);
|
public int deleteDataSourceById(Long id);
|
||||||
|
|
||||||
|
|
||||||
Result test(DataSource dataSource);
|
Result test(DataSource dataSource);
|
||||||
|
|
||||||
|
|
||||||
Result assetsList(DataSource dataSource);
|
Result assetsList(DataSource dataSource);
|
||||||
|
|
||||||
Result structureList(DataSource dataSource);
|
Result structureList(DataSource dataSource);
|
||||||
|
|
||||||
Result synchronization(DataSource dataSource);
|
Result synchronization(DataSource dataSource);
|
||||||
|
|
||||||
|
|
||||||
Result dataAssetList(DataSource dataSource);
|
Result dataAssetList(DataSource dataSource);
|
||||||
|
|
||||||
Result assetModelList(DataAsset dataAsset);
|
Result assetModelList(DataAsset dataAsset);
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package com.muyu.etl.service;
|
package com.muyu.etl.service;
|
||||||
|
|
||||||
import com.muyu.etl.domain.DictionaryData;
|
import com.muyu.etl.domain.DictionaryData;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
public interface DictionaryDataService {
|
public interface DictionaryDataService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -53,5 +54,4 @@ public interface DictionaryDataService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDictionaryDataById(Long id);
|
public int deleteDictionaryDataById(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.muyu.etl.domain.Dictionary;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface DictionaryService {
|
public interface DictionaryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -55,7 +54,8 @@ public interface DictionaryService {
|
||||||
*/
|
*/
|
||||||
public int deleteDictionaryById(Long id);
|
public int deleteDictionaryById(Long id);
|
||||||
|
|
||||||
|
|
||||||
Result getDictionaryList(Long dataSourceId);
|
Result getDictionaryList(Long dataSourceId);
|
||||||
|
|
||||||
|
Result delDict(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.etl.domain.*;
|
import com.muyu.etl.domain.*;
|
||||||
|
import com.muyu.etl.domain.Dictionary;
|
||||||
import com.muyu.etl.mapper.AssetModelMapper;
|
import com.muyu.etl.mapper.AssetModelMapper;
|
||||||
import com.muyu.etl.mapper.DataAssetMapper;
|
import com.muyu.etl.mapper.DataAssetMapper;
|
||||||
import com.muyu.etl.mapper.DataSourceMapper;
|
import com.muyu.etl.mapper.DataSourceMapper;
|
||||||
|
@ -24,14 +25,19 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DataSourceServiceImpl implements DataSourceService{
|
public class DataSourceServiceImpl implements DataSourceService{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSourceMapper dataSourceMapper;
|
private DataSourceMapper dataSourceMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetModelMapper assetModelMapper;
|
private AssetModelMapper assetModelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataAssetMapper dataAssetMapper;
|
private DataAssetMapper dataAssetMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictionaryServiceImpl dictionaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -66,6 +72,11 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
public int insertDataSource(DataSource dataSource) {
|
public int insertDataSource(DataSource dataSource) {
|
||||||
dataSource.setCreateTime(DateUtils.getNowDate());
|
dataSource.setCreateTime(DateUtils.getNowDate());
|
||||||
dataSource.setCreateBy(SecurityUtils.getUsername());
|
dataSource.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
if("Mysql".equals(dataSource.getType())){
|
||||||
|
dataSource.setJdbcDriver("com.mysql.cj.jdbc.Driver");
|
||||||
|
}else {
|
||||||
|
dataSource.setJdbcDriver("org.postgresql.Driver");
|
||||||
|
}
|
||||||
return dataSourceMapper.insertDataSource(dataSource);
|
return dataSourceMapper.insertDataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +91,11 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
{
|
{
|
||||||
dataSource.setUpdateTime(DateUtils.getNowDate());
|
dataSource.setUpdateTime(DateUtils.getNowDate());
|
||||||
dataSource.setUpdateBy(SecurityUtils.getUsername());
|
dataSource.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
if("Mysql".equals(dataSource.getType())){
|
||||||
|
dataSource.setJdbcDriver("com.mysql.cj.jdbc.Driver");
|
||||||
|
}else {
|
||||||
|
dataSource.setJdbcDriver("org.postgresql.Driver");
|
||||||
|
}
|
||||||
return dataSourceMapper.updateDataSource(dataSource);
|
return dataSourceMapper.updateDataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +218,10 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
return "byte[]";
|
return "byte[]";
|
||||||
case "longtext":
|
case "longtext":
|
||||||
return "Clob";
|
return "Clob";
|
||||||
// ... 其他类型映射,包括日期、时间、字符串、二进制、Blob、枚举、集合等
|
case "double":
|
||||||
|
return "double";
|
||||||
default:
|
default:
|
||||||
|
//抛出新的IlLegalArgumentException(“不支持的数据类型:”+mappingType);
|
||||||
throw new IllegalArgumentException("Unsupported data type: " + mappingType);
|
throw new IllegalArgumentException("Unsupported data type: " + mappingType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,6 +238,7 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
// 设置MySQL JDBC驱动类名和数据库连接URL
|
// 设置MySQL JDBC驱动类名和数据库连接URL
|
||||||
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
||||||
String url = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
String url = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||||
|
|
||||||
Connection con = null;
|
Connection con = null;
|
||||||
ArrayList<AssetModel> tableAssets = new ArrayList<>();
|
ArrayList<AssetModel> tableAssets = new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
|
@ -238,9 +257,9 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
// 遍历查询结果,创建并填充资产模型列表
|
// 遍历查询结果,创建并填充资产模型列表
|
||||||
while (resultSet.next()){
|
while (resultSet.next()){
|
||||||
AssetModel assetModel = new AssetModel();
|
AssetModel assetModel = new AssetModel();
|
||||||
|
|
||||||
assetModel.setComment(resultSet.getString("COLUMN_COMMENT"));
|
assetModel.setComment(resultSet.getString("COLUMN_COMMENT"));
|
||||||
assetModel.setName(resultSet.getString("COLUMN_NAME"));
|
assetModel.setName(resultSet.getString("COLUMN_NAME"));
|
||||||
|
// int decimalPlaces = resultSet.getInt("DECIMAL_PLACES");
|
||||||
// 设置列长度或精度
|
// 设置列长度或精度
|
||||||
if (resultSet.getString("CHARACTER_MAXIMUM_LENGTH")!=null){
|
if (resultSet.getString("CHARACTER_MAXIMUM_LENGTH")!=null){
|
||||||
assetModel.setLength(resultSet.getString("CHARACTER_MAXIMUM_LENGTH"));
|
assetModel.setLength(resultSet.getString("CHARACTER_MAXIMUM_LENGTH"));
|
||||||
|
@ -249,6 +268,12 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
}else{
|
}else{
|
||||||
assetModel.setLength("-");
|
assetModel.setLength("-");
|
||||||
}
|
}
|
||||||
|
if (resultSet.getString("NUMERIC_SCALE")!=null){
|
||||||
|
assetModel.setDecimalPlaces(resultSet.getString("NUMERIC_SCALE"));
|
||||||
|
}else{
|
||||||
|
assetModel.setDecimalPlaces("0");
|
||||||
|
}
|
||||||
|
|
||||||
// 设置是否可为空
|
// 设置是否可为空
|
||||||
if (resultSet.getString("IS_NULLABLE").equals("YES")){
|
if (resultSet.getString("IS_NULLABLE").equals("YES")){
|
||||||
assetModel.setIsNull("Y");
|
assetModel.setIsNull("Y");
|
||||||
|
@ -257,6 +282,7 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
}
|
}
|
||||||
// 设置是否有默认值
|
// 设置是否有默认值
|
||||||
if (resultSet.getString("COLUMN_DEFAULT")!=null){
|
if (resultSet.getString("COLUMN_DEFAULT")!=null){
|
||||||
|
|
||||||
assetModel.setDefaultValue(resultSet.getString("COLUMN_DEFAULT"));
|
assetModel.setDefaultValue(resultSet.getString("COLUMN_DEFAULT"));
|
||||||
}else{
|
}else{
|
||||||
assetModel.setDefaultValue("-");
|
assetModel.setDefaultValue("-");
|
||||||
|
@ -264,10 +290,11 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
// 初始化其他属性
|
// 初始化其他属性
|
||||||
assetModel.setIsDict("");
|
assetModel.setIsDict("");
|
||||||
assetModel.setDictKey("");
|
assetModel.setDictKey("");
|
||||||
|
|
||||||
assetModel.setType("s");
|
assetModel.setType("s");
|
||||||
assetModel.setDecimalPlaces("0");
|
// assetModel.setDecimalPlaces("0");
|
||||||
|
|
||||||
String dataType = mapDataTypeToJavaClass(resultSet.getString("DATA_TYPE"));
|
String dataType = mapDataTypeToJavaClass(resultSet.getString("DATA_TYPE"));
|
||||||
System.out.println("==================================="+dataType);
|
|
||||||
assetModel.setMappingType(dataType);
|
assetModel.setMappingType(dataType);
|
||||||
assetModel.setType(resultSet.getString("DATA_TYPE"));
|
assetModel.setType(resultSet.getString("DATA_TYPE"));
|
||||||
// 设置是否为主键
|
// 设置是否为主键
|
||||||
|
@ -397,7 +424,24 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
//数据同步
|
//数据同步
|
||||||
@Override
|
@Override
|
||||||
public Result synchronization(DataSource dataSource) {
|
public Result synchronization(DataSource dataSource) {
|
||||||
Long id1 = dataSource.getId();
|
List<DataSource> dataSources = dataSourceMapper.selectId(dataSource.getId());
|
||||||
|
List<Long> longs = dataSources.stream().map(DataSource::getId).toList();
|
||||||
|
System.out.println("数据源的ID"+longs);
|
||||||
|
|
||||||
|
ArrayList<Long> longArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Long aLong : longs) {
|
||||||
|
List<DataAsset> dataAssets = dataAssetMapper.selectById(aLong);
|
||||||
|
List<Long> longList = dataAssets.stream().map(DataAsset::getId).toList();
|
||||||
|
System.out.println("数据模型的Id"+longList);
|
||||||
|
longArrayList.addAll(longList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long[] longs2 = longArrayList.toArray(Long[]::new);
|
||||||
|
if (longs2.length != 0){
|
||||||
|
assetModelMapper.clearTable1(longs2);
|
||||||
|
|
||||||
|
}
|
||||||
String username = dataSource.getUsername();
|
String username = dataSource.getUsername();
|
||||||
String password = dataSource.getPassword();
|
String password = dataSource.getPassword();
|
||||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||||
|
@ -418,30 +462,11 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
ResultSet resultSet = preparedStatement.executeQuery();
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
// 遍历结果集,将每条记录转换为DataAsset对象,并添加到数据列表中
|
// 遍历结果集,将每条记录转换为DataAsset对象,并添加到数据列表中
|
||||||
while (resultSet.next()){
|
while (resultSet.next()){
|
||||||
DataAsset dataAsset = new DataAsset();
|
dataAssets.add(new DataAsset().dataAssetBuild(dataSource,resultSet));
|
||||||
// 设置表名
|
|
||||||
dataAsset.setTableName(resultSet.getString("t_name"));
|
|
||||||
// 设置表注释
|
|
||||||
dataAsset.setTableComment(resultSet.getString("table_comment"));
|
|
||||||
// 设置表行数
|
|
||||||
dataAsset.setTableCount(resultSet.getLong("table_rows"));
|
|
||||||
// 设置字段数
|
|
||||||
dataAsset.setFields(resultSet.getLong("fields"));
|
|
||||||
// 设置数据源ID
|
|
||||||
dataAsset.setDataSourceId(dataSource.getId());
|
|
||||||
// 设置创建者为当前登录用户
|
|
||||||
dataAsset.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
// 设置创建时间为当前时间
|
|
||||||
dataAsset.setCreateTime(new Date());
|
|
||||||
// 将DataAsset对象添加到数据列表中
|
|
||||||
dataAssets.add(dataAsset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将 DataAsset 对象的 ID 提取出来并转换为 Long 数组
|
// 将 DataAsset 对象的 ID 提取出来并转换为 Long 数组
|
||||||
Long id = dataSource.getId();
|
int i = dataSourceMapper.clearTable(new Long[]{dataSource.getId()});
|
||||||
Long[] a = new Long[1];
|
|
||||||
a[0] = id;
|
|
||||||
int i = dataSourceMapper.clearTable(a);
|
|
||||||
dataSourceMapper.batchAdd(dataAssets);
|
dataSourceMapper.batchAdd(dataAssets);
|
||||||
for (DataAsset dataAsset : dataAssets) {
|
for (DataAsset dataAsset : dataAssets) {
|
||||||
List<AssetModel> tableAssets = getTableAssets(dataSource, dataAsset.getTableName());
|
List<AssetModel> tableAssets = getTableAssets(dataSource, dataAsset.getTableName());
|
||||||
|
@ -467,6 +492,19 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
AssetModel assetModel = new AssetModel();
|
AssetModel assetModel = new AssetModel();
|
||||||
assetModel.setDataAssetId(dataAsset.getId());
|
assetModel.setDataAssetId(dataAsset.getId());
|
||||||
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
||||||
|
List<String> strings = assetModels.stream().map(AssetModel::getDictKey).toList();
|
||||||
|
if (!strings.isEmpty()){
|
||||||
|
Result<List<Dictionary>> dictionaryDataList = dictionaryService.getDictionaryDataList(strings);
|
||||||
|
List<Dictionary> data = dictionaryDataList.getData();
|
||||||
|
assetModels.stream().forEach(assetModel1 -> {
|
||||||
|
data.stream().forEach(dictionary -> {
|
||||||
|
if (assetModel1.getDictKey().equals(dictionary.getDictionaryKey())) {
|
||||||
|
assetModel.setDictionaryDatas(dictionary.getDictionaryDataList());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
return Result.success(assetModels);
|
return Result.success(assetModels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +516,8 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
* @return Result 包含统计信息的结果对象,其中成功时携带Statistics对象,包含数据资产数量、数据模型数量和资产模型数量。
|
* @return Result 包含统计信息的结果对象,其中成功时携带Statistics对象,包含数据资产数量、数据模型数量和资产模型数量。
|
||||||
*/
|
*/
|
||||||
public Result statisticsInfo() {
|
public Result statisticsInfo() {
|
||||||
long sum; long sum1;
|
long datasum;
|
||||||
|
long assetssum;
|
||||||
// 查询所有的数据源
|
// 查询所有的数据源
|
||||||
List<DataSource> dataSources = dataSourceMapper.selectDataSourceList(new DataSource());
|
List<DataSource> dataSources = dataSourceMapper.selectDataSourceList(new DataSource());
|
||||||
// 查出数据源ID列表
|
// 查出数据源ID列表
|
||||||
|
@ -491,14 +530,14 @@ public class DataSourceServiceImpl implements DataSourceService{
|
||||||
statistics.setDataAsset((long) longs.size());
|
statistics.setDataAsset((long) longs.size());
|
||||||
System.out.println(statistics.getDataAsset());
|
System.out.println(statistics.getDataAsset());
|
||||||
// 统计所有数据资产的字段总数
|
// 统计所有数据资产的字段总数
|
||||||
sum = dataAssets.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getFields())).sum();
|
datasum = dataAssets.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getFields())).sum();
|
||||||
// 统计所有数据资产的表数量
|
// 统计所有数据资产的表数量
|
||||||
sum1 = dataAssets.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getTableCount())).sum();
|
assetssum = dataAssets.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getTableCount())).sum();
|
||||||
System.out.println("数据"+sum);
|
System.out.println("数据"+datasum);
|
||||||
System.out.println("资产"+sum1);
|
System.out.println("资产"+assetssum);
|
||||||
// 设置数据模型数量和资产模型数量
|
// 设置数据模型数量和资产模型数量
|
||||||
statistics.setDataModel(sum);
|
statistics.setDataModel(datasum);
|
||||||
statistics.setAssetModel(sum1);
|
statistics.setAssetModel(assetssum);
|
||||||
// 返回携带统计信息的成功结果
|
// 返回携带统计信息的成功结果
|
||||||
return Result.success(statistics);
|
return Result.success(statistics);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.etl.domain.DictionaryData;
|
import com.muyu.etl.domain.DictionaryData;
|
||||||
import com.muyu.etl.mapper.DictionaryDataMapper;
|
import com.muyu.etl.mapper.DictionaryDataMapper;
|
||||||
import com.muyu.etl.mapper.DictionaryMapper;
|
|
||||||
import com.muyu.etl.service.DictionaryDataService;
|
import com.muyu.etl.service.DictionaryDataService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -13,7 +12,6 @@ import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DictionaryDataServiceImpl implements DictionaryDataService {
|
public class DictionaryDataServiceImpl implements DictionaryDataService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryDataMapper dictionaryDataMapper;
|
private DictionaryDataMapper dictionaryDataMapper;
|
||||||
|
|
||||||
|
@ -92,5 +90,4 @@ public class DictionaryDataServiceImpl implements DictionaryDataService {
|
||||||
{
|
{
|
||||||
return dictionaryDataMapper.deleteDictionaryDataById(id);
|
return dictionaryDataMapper.deleteDictionaryDataById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package com.muyu.etl.service.impl;
|
package com.muyu.etl.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.etl.domain.Dictionary;
|
||||||
import com.muyu.etl.domain.DictionaryData;
|
import com.muyu.etl.domain.DictionaryData;
|
||||||
|
import com.muyu.etl.mapper.AssetModelMapper;
|
||||||
import com.muyu.etl.mapper.DictionaryDataMapper;
|
import com.muyu.etl.mapper.DictionaryDataMapper;
|
||||||
|
import com.muyu.etl.mapper.DictionaryMapper;
|
||||||
|
import com.muyu.etl.service.DictionaryService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.etl.mapper.DictionaryMapper;
|
|
||||||
import com.muyu.etl.domain.Dictionary;
|
import java.util.List;
|
||||||
import com.muyu.etl.service.DictionaryService;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service业务层处理
|
* 【请填写功能名称】Service业务层处理
|
||||||
|
@ -21,14 +21,17 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2024-04-25
|
* @date 2024-04-25
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DictionaryServiceImpl implements DictionaryService {
|
public class DictionaryServiceImpl implements DictionaryService
|
||||||
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryMapper dictionaryMapper;
|
private DictionaryMapper dictionaryMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryDataMapper dictionaryDataMapper;
|
private DictionaryDataMapper dictionaryDataMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AssetModelMapper assetModelMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
@ -115,4 +118,35 @@ public class DictionaryServiceImpl implements DictionaryService {
|
||||||
return Result.success(dictionaryList);
|
return Result.success(dictionaryList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result delDict(Long id) {
|
||||||
|
dictionaryDataMapper.deleteDictionaryDataBy(id);
|
||||||
|
dictionaryMapper.deleteDictionaryById(id);
|
||||||
|
assetModelMapper.updateAssetModelDiction(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典数据列表。
|
||||||
|
*/
|
||||||
|
public Result getDictionaryDataList(List<String> string){
|
||||||
|
// 通过字符串列表查询字典数据列表
|
||||||
|
List<Dictionary> dictionaryDataList = dictionaryMapper.getDictionaryDataList(string);
|
||||||
|
if (!dictionaryDataList.isEmpty()){
|
||||||
|
// 将字典数据列表中的每个字典项的ID提取出来,形成一个新的ID列表
|
||||||
|
List<Long> longs = dictionaryDataList.stream()
|
||||||
|
.map(Dictionary::getId).toList();
|
||||||
|
// 根据ID列表查询相应的字典详细数据列表
|
||||||
|
List<DictionaryData> dictionaryDataList1 = dictionaryDataMapper.getDictionaryDataList(longs);
|
||||||
|
// 为每个字典项设置其详细的字典数据列表
|
||||||
|
dictionaryDataList.stream()
|
||||||
|
.forEach(dictionary -> {
|
||||||
|
dictionaryDataList1.stream().filter(dictionaryData -> dictionaryData.getDictionaryId().equals(dictionary.getId())).toList();
|
||||||
|
dictionary.setDictionaryDataList(dictionaryDataList1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 返回成功结果,包含处理后的字典数据列表
|
||||||
|
return Result.success(dictionaryDataList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateAssetModelDiction">
|
||||||
|
update asset_model_copy1 set is_dict = '',dictionary_id = null where dictionary_id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteAssetModelById" parameterType="Long">
|
<delete id="deleteAssetModelById" parameterType="Long">
|
||||||
delete from asset_model_copy1 where id = #{id}
|
delete from asset_model_copy1 where id = #{id}
|
||||||
|
|
|
@ -37,6 +37,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectDataAssetVo"/>
|
<include refid="selectDataAssetVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectById" resultType="com.muyu.etl.domain.DataAsset">
|
||||||
|
select * from data_asset where data_source_id= #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDataAsset" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDataAsset" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into data_asset
|
insert into data_asset
|
||||||
|
|
|
@ -152,42 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<!-- <insert id="batchInsert" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">-->
|
|
||||||
<!-- insert into `asset_model` (-->
|
|
||||||
<!-- `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-->
|
|
||||||
<!-- ) values -->
|
|
||||||
<!-- <foreach collection="tableAssets" item="item" separator=",">-->
|
|
||||||
<!-- (-->
|
|
||||||
<!-- #{item.dataAssetId},-->
|
|
||||||
<!-- #{item.name},-->
|
|
||||||
<!-- #{item.comment},-->
|
|
||||||
<!-- #{item.isPrimaryKey},-->
|
|
||||||
<!-- #{item.type},-->
|
|
||||||
<!-- #{item.mappingType},-->
|
|
||||||
<!-- #{item.length},-->
|
|
||||||
<!-- #{item.decimalPlaces},-->
|
|
||||||
<!-- #{item.isNull},-->
|
|
||||||
<!-- #{item.isDict},-->
|
|
||||||
<!-- #{item.defaultValue},-->
|
|
||||||
<!-- #{item.dictKey},-->
|
|
||||||
<!-- #{item.createBy},-->
|
|
||||||
<!-- #{item.createTime}-->
|
|
||||||
<!-- )-->
|
|
||||||
<!-- </foreach>-->
|
|
||||||
<!-- </insert>-->
|
|
||||||
<insert id="batchAdd" useGeneratedKeys="true" keyProperty="id">
|
<insert id="batchAdd" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into data_asset
|
insert into data_asset
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -95,4 +95,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delDict">
|
||||||
|
delete dictionarydata where dictionary_id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDictionaryDataBy">
|
||||||
|
delete from dictionarydata where dictionary_id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -39,6 +39,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and data_source_id = #{dataSourceId}
|
and data_source_id = #{dataSourceId}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getDictionaryDataList" resultType="com.muyu.etl.domain.Dictionary">
|
||||||
|
<include refid="selectDictionaryVo"></include>
|
||||||
|
<where>
|
||||||
|
and dictionary_key in
|
||||||
|
<foreach item="string" collection="string" open="(" separator="," close=")">
|
||||||
|
#{string}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDictionary" parameterType="com.muyu.etl.domain.Dictionary" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDictionary" parameterType="com.muyu.etl.domain.Dictionary" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into dictionary
|
insert into dictionary
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
<?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.DataSourceMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.muyu.etl.domain.DataSource" id="DataSourceResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="dataSourceName" column="data_source_name" />
|
|
||||||
<result property="linkAddress" column="link_address" />
|
|
||||||
<result property="port" column="port" />
|
|
||||||
<result property="databaseName" column="database_name" />
|
|
||||||
<result property="username" column="username" />
|
|
||||||
<result property="password" column="password" />
|
|
||||||
<result property="connectionParam" column="connection_param" />
|
|
||||||
<result property="initNum" column="init_num" />
|
|
||||||
<result property="maxNum" column="max_num" />
|
|
||||||
<result property="maxWaitTime" column="max_wait_time" />
|
|
||||||
<result property="maxWaitSize" column="max_wait_size" />
|
|
||||||
<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" />
|
|
||||||
<result property="type" column="type" />
|
|
||||||
<result property="systemName" column="system_name" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectDataSourceVo">
|
|
||||||
select id, data_source_name, link_address, port, database_name, username, password, connection_param, init_num, max_num, max_wait_time, max_wait_size, create_by, create_time, update_by, update_time, remark, type, system_name from data_source
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectDataSourceList" parameterType="com.muyu.etl.domain.DataSource" resultMap="DataSourceResult">
|
|
||||||
<include refid="selectDataSourceVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
|
|
||||||
<if test="linkAddress != null and linkAddress != ''"> and link_address = #{linkAddress}</if>
|
|
||||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
|
||||||
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
|
||||||
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
|
||||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
|
||||||
<if test="connectionParam != null and connectionParam != ''"> and connection_param = #{connectionParam}</if>
|
|
||||||
<if test="initNum != null "> and init_num = #{initNum}</if>
|
|
||||||
<if test="maxNum != null "> and max_num = #{maxNum}</if>
|
|
||||||
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
|
|
||||||
<if test="maxWaitSize != null "> and max_wait_size = #{maxWaitSize}</if>
|
|
||||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
||||||
<if test="systemName != null and systemName != ''"> and system_name like concat('%', #{systemName}, '%')</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
|
|
||||||
<include refid="selectDataSourceVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertDataSource" parameterType="com.muyu.etl.domain.DataSource" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into data_source
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="dataSourceName != null">data_source_name,</if>
|
|
||||||
<if test="linkAddress != null">link_address,</if>
|
|
||||||
<if test="port != null">port,</if>
|
|
||||||
<if test="databaseName != null">database_name,</if>
|
|
||||||
<if test="username != null">username,</if>
|
|
||||||
<if test="password != null">password,</if>
|
|
||||||
<if test="connectionParam != null">connection_param,</if>
|
|
||||||
<if test="initNum != null">init_num,</if>
|
|
||||||
<if test="maxNum != null">max_num,</if>
|
|
||||||
<if test="maxWaitTime != null">max_wait_time,</if>
|
|
||||||
<if test="maxWaitSize != null">max_wait_size,</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>
|
|
||||||
<if test="type != null">type,</if>
|
|
||||||
<if test="systemName != null">system_name,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="dataSourceName != null">#{dataSourceName},</if>
|
|
||||||
<if test="linkAddress != null">#{linkAddress},</if>
|
|
||||||
<if test="port != null">#{port},</if>
|
|
||||||
<if test="databaseName != null">#{databaseName},</if>
|
|
||||||
<if test="username != null">#{username},</if>
|
|
||||||
<if test="password != null">#{password},</if>
|
|
||||||
<if test="connectionParam != null">#{connectionParam},</if>
|
|
||||||
<if test="initNum != null">#{initNum},</if>
|
|
||||||
<if test="maxNum != null">#{maxNum},</if>
|
|
||||||
<if test="maxWaitTime != null">#{maxWaitTime},</if>
|
|
||||||
<if test="maxWaitSize != null">#{maxWaitSize},</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>
|
|
||||||
<if test="type != null">#{type},</if>
|
|
||||||
<if test="systemName != null">#{systemName},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateDataSource" parameterType="com.muyu.etl.domain.DataSource">
|
|
||||||
update data_source
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="dataSourceName != null">data_source_name = #{dataSourceName},</if>
|
|
||||||
<if test="linkAddress != null">link_address = #{linkAddress},</if>
|
|
||||||
<if test="port != null">port = #{port},</if>
|
|
||||||
<if test="databaseName != null">database_name = #{databaseName},</if>
|
|
||||||
<if test="username != null">username = #{username},</if>
|
|
||||||
<if test="password != null">password = #{password},</if>
|
|
||||||
<if test="connectionParam != null">connection_param = #{connectionParam},</if>
|
|
||||||
<if test="initNum != null">init_num = #{initNum},</if>
|
|
||||||
<if test="maxNum != null">max_num = #{maxNum},</if>
|
|
||||||
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
|
|
||||||
<if test="maxWaitSize != null">max_wait_size = #{maxWaitSize},</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>
|
|
||||||
<if test="type != null">type = #{type},</if>
|
|
||||||
<if test="systemName != null">system_name = #{systemName},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteDataSourceById" parameterType="Long">
|
|
||||||
delete from data_source where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteDataSourceByIds" parameterType="String">
|
|
||||||
delete from data_source where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue