master
Jiang Peng 2024-05-05 15:34:51 +08:00
parent 9daa2558b4
commit ae35c4a607
36 changed files with 192 additions and 705 deletions

View File

@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-04-22 * @date 2024-04-22
@ -71,10 +71,10 @@ public class AssetModelController extends BaseController
@PutMapping("UpdateAssetModel") @PutMapping("UpdateAssetModel")
public Result edit(@RequestBody AssetModel assetModel) public Result edit(@RequestBody AssetModel assetModel)
{ {
// 调用资产模型服务更新资产模型信息并将结果转换为Ajax形式返回
return toAjax(assetModelService.updateAssetModel(assetModel)); return toAjax(assetModelService.updateAssetModel(assetModel));
} }
/** /**
* *
*/ */

View File

@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-04-20 * @date 2024-04-20
@ -111,6 +111,7 @@ public class DataSourceController extends BaseController
public Result synchronization(@RequestBody DataSource dataSource){ public Result synchronization(@RequestBody DataSource dataSource){
return dataSourceService.synchronization(dataSource); return dataSourceService.synchronization(dataSource);
} }
@PostMapping("dataAssetList") @PostMapping("dataAssetList")
public Result dataAssetList(@RequestBody DataSource dataSource){ public Result dataAssetList(@RequestBody DataSource dataSource){
return dataSourceService.dataAssetList(dataSource); return dataSourceService.dataAssetList(dataSource);
@ -123,4 +124,5 @@ public class DataSourceController extends BaseController
public Result statisticsInfo(){ public Result statisticsInfo(){
return dataSourceService.statisticsInfo(); return dataSourceService.statisticsInfo();
} }
} }

View File

@ -4,7 +4,6 @@ import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.etl.domain.Dictionary; import com.muyu.etl.domain.Dictionary;
import com.muyu.etl.service.DictionaryService; import com.muyu.etl.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -14,7 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-04-24 * @date 2024-04-24
@ -70,15 +69,14 @@ public class DictionaryController extends BaseController
* *
*/ */
@PutMapping @PutMapping
public Result edit(@RequestBody Dictionary dictionary) public Result edit(@RequestBody Dictionary dictionary) {
{
return toAjax(dictionaryService.updateDictionary(dictionary)); return toAjax(dictionaryService.updateDictionary(dictionary));
} }
/** /**
* *
*/ */
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids) public Result remove(@PathVariable Long[] ids)
{ {
return toAjax(dictionaryService.deleteDictionaryByIds(ids)); return toAjax(dictionaryService.deleteDictionaryByIds(ids));
@ -87,10 +85,8 @@ public class DictionaryController extends BaseController
public Result getDictionaryList(@RequestParam("dataSourceId") Long dataSourceId){ public Result getDictionaryList(@RequestParam("dataSourceId") Long dataSourceId){
return dictionaryService.getDictionaryList(dataSourceId); return dictionaryService.getDictionaryList(dataSourceId);
} }
@GetMapping("delDict")
// @GetMapping("delDict") public Result delDict(Long id){
// public Result delDict(Long id){ return dictionaryService.delDict(id);
// return dictionaryService.delDict(id); }
// }
} }

View File

@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-04-24 * @date 2024-04-24
@ -82,4 +82,8 @@ public class DictionaryDataController extends BaseController
{ {
return toAjax(dictionaryDataService.deleteDictionaryDataByIds(ids)); return toAjax(dictionaryDataService.deleteDictionaryDataByIds(ids));
} }
@PostMapping("delById")
public Result delById(@RequestParam Long id){
return toAjax(dictionaryDataService.deleteDictionaryDataById(id));
}
} }

View File

@ -3,7 +3,6 @@ package com.muyu.etl.domain;
import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@ -15,7 +14,6 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@NoArgsConstructor @NoArgsConstructor
@SuperBuilder @SuperBuilder
public class AssetAccredit extends BaseEntity { public class AssetAccredit extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */

View File

@ -8,7 +8,6 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
/** /**
@ -18,9 +17,9 @@ import java.util.Date;
* @Date 2024/4/22 20:41 * @Date 2024/4/22 20:41
*/ */
@Data @Data
@SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@SuperBuilder
public class DataAsset extends BaseEntity { public class DataAsset extends BaseEntity {
private Long id; private Long id;
private Long dataSourceId; private Long dataSourceId;
@ -29,67 +28,16 @@ public class DataAsset extends BaseEntity {
private Long tableCount; private Long tableCount;
private Long fields; private Long fields;
public Long getId() { public DataAsset dataAsset(DataAsset dataAsset , ResultSet resultSet){
return id; return DataAsset.builder()
} .id(dataAsset.getId())
.dataSourceId(dataAsset.getDataSourceId())
public void setId(Long id) { .tableName(dataAsset.getTableName())
this.id = id; .tableComment(dataAsset.getTableComment())
} .tableCount(dataAsset.getTableCount())
.fields(dataAsset.getFields())
public Long getDataSourceId() { .updateBy(SecurityUtils.getUsername())
return dataSourceId; .updateTime(new Date())
} .build();
public void setDataSourceId(Long dataSourceId) {
this.dataSourceId = dataSourceId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableComment() {
return tableComment;
}
public void setTableComment(String tableComment) {
this.tableComment = tableComment;
}
public Long getTableCount() {
return tableCount;
}
public void setTableCount(Long tableCount) {
this.tableCount = tableCount;
}
public Long getFields() {
return fields;
}
public void setFields(Long 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);
}
} }
} }

View File

@ -17,28 +17,23 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DictionaryData extends BaseEntity { public class DictionaryData extends BaseEntity {
private Long id; private Long id;
/** /**
* Id * Id
*/ */
private Long dictionaryId; private Long dictionaryId;
/** /**
* *
*/ */
private String label; private String label;
/** /**
* *
*/ */
private String val; private String val;
private List<Dictionary> dictionaryDatas;
/** /**
* *
*/ */
private Boolean isEdit = false; private Boolean isEdit = false;
private List<Dictionary> dictionaryDatas;
} }

View File

@ -1,19 +0,0 @@
package com.muyu.etl.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Statistics {
// 数据资产ID
private Long dataAsset;
// 资产模型ID
private Long assetModel;
// 数据模型ID
private Long dataModel;
}

View File

@ -1,14 +1,12 @@
package com.muyu.etl.domain.custom; package com.muyu.etl.domain.custom;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder
public class Statistics { public class Statistics {
/** /**

View File

@ -1,67 +0,0 @@
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;
}

View File

@ -1,15 +0,0 @@
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;
}

View File

@ -12,7 +12,6 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@SuperBuilder @SuperBuilder
public class AccreditModel { public class AccreditModel {
/** /**
* ID * ID
*/ */
@ -22,5 +21,4 @@ public class AccreditModel {
* ID * ID
*/ */
private List<Long> deptAccreditModelIds; private List<Long> deptAccreditModelIds;
} }

View File

@ -12,9 +12,7 @@ import java.util.List;
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
public class AssetAccreditReq { public class AssetAccreditReq {
private List<Long> deptIds; private List<Long> deptIds;
private Long userId; private Long userId;
private Long dataAssetId; private Long dataAssetId;
} }

View File

@ -12,9 +12,7 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@SuperBuilder @SuperBuilder
public class SourceAccreditReq { public class SourceAccreditReq {
private List<Long> deptIds;
private List<Long> deptIds; private Long userId;
private Long userId; private Long dataSourceId;
private Long dataSourceId;
} }

View File

@ -4,14 +4,11 @@ import com.muyu.etl.domain.AssetAccredit;
import com.muyu.etl.domain.req.AssetAccreditReq; import com.muyu.etl.domain.req.AssetAccreditReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.PropertyValues;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface AssetAccreditMapper { public interface AssetAccreditMapper {
List<AssetAccredit> selectAssetAccreditList(AssetAccredit assetAccredit); List<AssetAccredit> selectAssetAccreditList(AssetAccredit assetAccredit);
public AssetAccredit selectAssetAccreditById(Long id); public AssetAccredit selectAssetAccreditById(Long id);
@ -31,5 +28,4 @@ public interface AssetAccreditMapper {
List<AssetAccredit> getSourceAccreditByUserId(Long userId); List<AssetAccredit> getSourceAccreditByUserId(Long userId);
void insertBachAssetAccredit(@Param("assetAccredits") List<AssetAccredit> assetAccredits); void insertBachAssetAccredit(@Param("assetAccredits") List<AssetAccredit> assetAccredits);
} }

View File

@ -68,7 +68,5 @@ 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); void updateAssetModelDiction(Long id);
} }

View File

@ -65,9 +65,7 @@ public interface DataAssetMapper
public int deleteDataAssetByIds(Long[] ids); public int deleteDataAssetByIds(Long[] ids);
void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets); void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets);
List<DataAsset> selectById(Long id); List<DataAsset> selectById(Long id);
List<DataAsset> getDataAssetByAssetId(@Param("assetIds") List<Long> assetIds); List<DataAsset> getDataAssetByAssetId(@Param("assetIds") List<Long> assetIds);
} }

View File

@ -56,7 +56,5 @@ 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); List<Dictionary> getDictionaryDataList(@Param("string") List<String> string);
} }

View File

@ -3,13 +3,18 @@ package com.muyu.etl.mapper;
import com.muyu.etl.domain.SourceAccredit; import com.muyu.etl.domain.SourceAccredit;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2024-04-25
*/
@Mapper @Mapper
public interface SourceAccreditMapper { public interface SourceAccreditMapper
{
/** /**
* *
* *
@ -67,5 +72,4 @@ public interface SourceAccreditMapper {
void insertBatchSourceAccredit(@Param("sourceAccredits") List<SourceAccredit> sourceAccredits); void insertBatchSourceAccredit(@Param("sourceAccredits") List<SourceAccredit> sourceAccredits);
void deleteSourceAccreditByDeptUser(@Param("deptIds") List<Long> deptIds, @Param("userId") Long userId, @Param("dataSourceId") Long dataSourceId); void deleteSourceAccreditByDeptUser(@Param("deptIds") List<Long> deptIds, @Param("userId") Long userId, @Param("dataSourceId") Long dataSourceId);
} }

View File

@ -3,28 +3,22 @@ package com.muyu.etl.service;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.etl.domain.AssetAccredit; import com.muyu.etl.domain.AssetAccredit;
import com.muyu.etl.domain.req.AssetAccreditReq; import com.muyu.etl.domain.req.AssetAccreditReq;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@Service @Service
public interface AssetAccreditService { public interface AssetAccreditService {
List<AssetAccredit> selectAssetAccreditList(AssetAccredit assetAccredit); List<AssetAccredit> selectAssetAccreditList(AssetAccredit assetAccredit);
AssetAccredit selectAssetAccreditById(Long id); AssetAccredit selectAssetAccreditById(Long id);
public Result insertAssetAccredit(AssetAccreditReq assetAccreditReq); public Result insertAssetAccredit(AssetAccreditReq assetAccreditReq);
public int updateAssetAccredit(AssetAccredit assetAccredit); public int updateAssetAccredit(AssetAccredit assetAccredit);
public int deleteAssetAccreditByIds(Long[] ids); public int deleteAssetAccreditByIds(Long[] ids);
public int deleteAssetAccreditById(Long id); public int deleteAssetAccreditById(Long id);
Result getAssetAccreditByDataAssetId(Long id); Result getAssetAccreditByDataAssetId(Long id);
Result deleteAssetAccreditByAssetId(AssetAccreditReq assetAccreditReq); Result deleteAssetAccreditByAssetId(AssetAccreditReq assetAccreditReq);
} }

View File

@ -1,6 +1,5 @@
package com.muyu.etl.service; package com.muyu.etl.service;
import com.muyu.common.core.domain.Result;
import com.muyu.etl.domain.DictionaryData; import com.muyu.etl.domain.DictionaryData;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -55,9 +54,4 @@ public interface DictionaryDataService {
* @return * @return
*/ */
public int deleteDictionaryDataById(Long id); public int deleteDictionaryDataById(Long id);
Result getDictionaryList(Long dataSourceId);
Result delDict(Long id);
} }

View File

@ -53,9 +53,7 @@ public interface DictionaryService {
* @return * @return
*/ */
public int deleteDictionaryById(Long id); public int deleteDictionaryById(Long id);
Result getDictionaryList(Long dataSourceId); Result getDictionaryList(Long dataSourceId);
Result delDict(Long id); Result delDict(Long id);
} }

View File

@ -14,8 +14,8 @@ import java.util.List;
* @date 2024-04-25 * @date 2024-04-25
*/ */
@Service @Service
public interface SourceAccreditService { public interface SourceAccreditService
{
/** /**
* *
* *
@ -67,5 +67,4 @@ public interface SourceAccreditService {
Result getSourceAccreditByDataSourceId(Long id); Result getSourceAccreditByDataSourceId(Long id);
Result deleteSourceAccreditBySourceIds(SourceAccreditReq sourceAccreditReq); Result deleteSourceAccreditBySourceIds(SourceAccreditReq sourceAccreditReq);
} }

View File

@ -16,12 +16,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* @ClassName AssetAccreditServiceImpl
* @Description
* @Author HaoRan.Zhang
* @Date 2024/4/28 15:11
*/
@Service @Service
public class AssetAccreditServiceImpl implements AssetAccreditService { public class AssetAccreditServiceImpl implements AssetAccreditService {
@ -42,7 +36,6 @@ public class AssetAccreditServiceImpl implements AssetAccreditService {
@Override @Override
public Result insertAssetAccredit(AssetAccreditReq assetAccreditReq) { public Result insertAssetAccredit(AssetAccreditReq assetAccreditReq) {
// 根据资产ID删除资产授权信息 // 根据资产ID删除资产授权信息
deleteAssetAccreditByAssetId(assetAccreditReq); deleteAssetAccreditByAssetId(assetAccreditReq);
List<AssetAccredit> assetAccredits = new ArrayList<>(); List<AssetAccredit> assetAccredits = new ArrayList<>();
@ -116,7 +109,6 @@ public class AssetAccreditServiceImpl implements AssetAccreditService {
return Result.success(accreditModel); return Result.success(accreditModel);
} }
@Override @Override
public Result deleteAssetAccreditByAssetId(AssetAccreditReq assetAccreditReq) public Result deleteAssetAccreditByAssetId(AssetAccreditReq assetAccreditReq)
{ {

View File

@ -230,7 +230,7 @@ public class DataSourceServiceImpl implements DataSourceService{
case "varchar": case "varchar":
case "char": case "char":
case "text": case "text":
return "String"; return "String";
case "datetime": case "datetime":
return "Date"; return "Date";
case "blob": case "blob":
@ -425,7 +425,7 @@ public class DataSourceServiceImpl implements DataSourceService{
//数据同步 //数据同步
@Override @Override
public Result synchronization(DataSource dataSource) { public Result synchronization(DataSource dataSource) {
List<DataSource> dataSources = dataSourceMapper.selectId(dataSource.getId()); // 根据数据源ID查询所有相关数据源 List<DataSource> dataSources = dataSourceMapper.selectId(dataSource.getId()); // 根据数据源ID查询所有相关数据源-+
List<Long> longList = dataSources.stream().map(DataSource::getId).toList(); // 提取数据源ID列表 List<Long> longList = dataSources.stream().map(DataSource::getId).toList(); // 提取数据源ID列表
ArrayList<Long> l = new ArrayList<>(); ArrayList<Long> l = new ArrayList<>();
for (Long aLong : longList) { for (Long aLong : longList) {

View File

@ -1,14 +1,9 @@
package com.muyu.etl.service.impl; package com.muyu.etl.service.impl;
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.AssetModelService;
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;
@ -17,16 +12,9 @@ import java.util.List;
@Service @Service
public class DictionaryDataServiceImpl implements DictionaryDataService { public class DictionaryDataServiceImpl implements DictionaryDataService {
@Autowired @Autowired
private DictionaryDataMapper dictionaryDataMapper; private DictionaryDataMapper dictionaryDataMapper;
@Autowired
private DictionaryMapper dictionaryMapper;
@Autowired
private AssetModelMapper assetModelMapper;
/** /**
* *
* *
@ -102,66 +90,4 @@ public class DictionaryDataServiceImpl implements DictionaryDataService {
{ {
return dictionaryDataMapper.deleteDictionaryDataById(id); return dictionaryDataMapper.deleteDictionaryDataById(id);
} }
/**
*
*
* @param dataSourceId ID
* @return
*/
@Override
public Result getDictionaryList(Long dataSourceId) {
// 从字典mapper中查询指定数据源ID的字典列表
List<Dictionary> dictionaryList = dictionaryMapper.getDictionaryList(dataSourceId);
if (!dictionaryList.isEmpty()){
// 将字典列表中每个字典的ID提取出来形成一个新的ID列表
List<Long> longs = dictionaryList.stream()
.map(Dictionary::getId).toList();
// 根据提取出的ID列表从字典数据mapper中查询相应的字典数据列表
List<DictionaryData> dictionaryDataList = dictionaryDataMapper.getDictionaryDataList(longs);
// 为每个字典设置其对应的字典数据列表
dictionaryList.stream()
.forEach(dictionary->{
// 过滤出与当前字典ID匹配的字典数据并为当前字典设置这个列表
dictionaryDataList.stream().filter(dictionaryData -> dictionaryData.getDictionaryId().equals(dictionary.getId()) ).toList();
dictionary.setDictionaryDataList(dictionaryDataList);
});
}
// 返回成功结果,包含处理后的字典列表
return Result.success(dictionaryList);
}
@Override
public Result delDict(Long id) {
dictionaryDataMapper.deleteDictionaryDataBy(id);
dictionaryMapper.deleteDictionaryById(id);
assetModelMapper.updateAssetModelDiction(id);
return Result.success();
}
/**
*
*
* @param string
* @return
*/
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() ==(dictionary.getId())).toList();
dictionary.setDictionaryDataList(dictionaryDataList1);
});
}
// 返回成功结果,包含处理后的字典数据列表
return Result.success(dictionaryDataList);
}
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.etl.mapper.AssetModelMapper"> <mapper namespace="com.muyu.etl.mapper.AssetModelMapper">
<resultMap type="com.muyu.etl.domain.AssetModel" id="AssetModelResult"> <resultMap type="com.muyu.etl.domain.AssetModel" id="AssetModelResult">
@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataAssetId != null">#{dataAssetId},</if> <if test="dataAssetId != null">#{dataAssetId},</if>
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
@ -91,47 +91,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
</trim> </trim>
</insert> </insert>
<!-- <insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id" >--> <!-- <insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id" >-->
<!-- insert into `asset_model_copy1`--> <!-- insert into `asset_model_copy1`-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">--> <!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- `data_asset_id`,--> <!-- `data_asset_id`,-->
<!-- `name`,--> <!-- `name`,-->
<!-- `comment`,--> <!-- `comment`,-->
<!-- `is_primary_key`,--> <!-- `is_primary_key`,-->
<!-- `type`,--> <!-- `type`,-->
<!-- `mapping_type`,--> <!-- `mapping_type`,-->
<!-- `length`,--> <!-- `length`,-->
<!-- `decimal_places`,--> <!-- `decimal_places`,-->
<!-- `is_null`,--> <!-- `is_null`,-->
<!-- `is_dict`,--> <!-- `is_dict`,-->
<!-- `default_value`,--> <!-- `default_value`,-->
<!-- `dict_key`,--> <!-- `dict_key`,-->
<!-- `create_by`,--> <!-- `create_by`,-->
<!-- `create_time`,--> <!-- `create_time`,-->
<!-- </trim>--> <!-- </trim>-->
<!-- values--> <!-- values-->
<!-- <foreach collection="tableAssets" item="item" separator=",">--> <!-- <foreach collection="tableAssets" item="item" separator=",">-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">--> <!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <if test="item.dataAssetId != null">#{item.dataAssetId},</if>--> <!-- <if test="item.dataAssetId != null">#{item.dataAssetId},</if>-->
<!-- <if test="item.name != null">#{item.name},</if>--> <!-- <if test="item.name != null">#{item.name},</if>-->
<!-- <if test="item.comment != null">#{item.comment},</if>--> <!-- <if test="item.comment != null">#{item.comment},</if>-->
<!-- <if test="item.isPrimaryKey != null">#{item.isPrimaryKey},</if>--> <!-- <if test="item.isPrimaryKey != null">#{item.isPrimaryKey},</if>-->
<!-- <if test="item.type != null">#{item.type},</if>--> <!-- <if test="item.type != null">#{item.type},</if>-->
<!-- <if test="item.mappingType != null">#{item.mappingType},</if>--> <!-- <if test="item.mappingType != null">#{item.mappingType},</if>-->
<!-- <if test="item.length != null">#{item.length},</if>--> <!-- <if test="item.length != null">#{item.length},</if>-->
<!-- <if test="item.decimalPlaces != null">#{item.decimalPlaces},</if>--> <!-- <if test="item.decimalPlaces != null">#{item.decimalPlaces},</if>-->
<!-- <if test="item.isNull != null">#{item.isNull},</if>--> <!-- <if test="item.isNull != null">#{item.isNull},</if>-->
<!-- <if test="item.isDict != null">#{item.isDict},</if>--> <!-- <if test="item.isDict != null">#{item.isDict},</if>-->
<!-- <if test="item.defaultValue != null">#{item.defaultValue},</if>--> <!-- <if test="item.defaultValue != null">#{item.defaultValue},</if>-->
<!-- <if test="item.dictKey != null">#{item.dictKey},</if>--> <!-- <if test="item.dictKey != null">#{item.dictKey},</if>-->
<!-- <if test="item.createBy != null and item.createBy != ''">#{item.createBy},</if>--> <!-- <if test="item.createBy != null and item.createBy != ''">#{item.createBy},</if>-->
<!-- <if test="item.createTime != null">#{item.createTime},</if>--> <!-- <if test="item.createTime != null">#{item.createTime},</if>-->
<!-- </trim>--> <!-- </trim>-->
<!-- </foreach>--> <!-- </foreach>-->
<!-- </insert>--> <!-- </insert>-->
<insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id">
INSERT INTO `asset_model_copy1` ( INSERT INTO `asset_model_copy1` (
`data_asset_id`, `name`, `comment`, `is_primary_key`, `type`, `mapping_type`, `data_asset_id`, `name`, `comment`, `is_primary_key`, `type`, `mapping_type`,
@ -181,9 +181,6 @@ 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}

View File

@ -37,22 +37,19 @@ 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 id="selectById" resultType="com.muyu.etl.domain.DataAsset">
select * from data_asset where data_source_id= #{id} select * from data_asset where data_source_id= #{id}
</select> </select>
<select id="getDataAssetByAssetId" resultType="com.muyu.etl.domain.DataAsset"> <select id="getDataAssetByAssetId" resultType="com.muyu.etl.domain.DataAsset">
<include refid="selectDataAssetVo"/> <include refid="selectDataAssetVo"/>
<where> <where>
and id in ( and id in (
<foreach collection="assetIds" item="id" separator=","> <foreach collection="assetIds" item="id" separator=",">
#{id} #{id}
</foreach> </foreach>
) )
</where> </where>
</select> </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
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.etl.mapper.DataSourceMapper"> <mapper namespace="com.muyu.etl.mapper.DataSourceMapper">
@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maxWaitTime != null">max_wait_time,</if> <if test="maxWaitTime != null">max_wait_time,</if>
<if test="connectionParam != null">connection_param,</if> <if test="connectionParam != null">connection_param,</if>
<if test="systemName != null">systemName,</if> <if test="systemName != null">systemName,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataSourceName != null">#{dataSourceName},</if> <if test="dataSourceName != null">#{dataSourceName},</if>
<if test="linkAddress != null">#{linkAddress},</if> <if test="linkAddress != null">#{linkAddress},</if>
@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maxWaitTime != null">#{maxWaitTime},</if> <if test="maxWaitTime != null">#{maxWaitTime},</if>
<if test="connectionParam != null">#{connectionParam},</if> <if test="connectionParam != null">#{connectionParam},</if>
<if test="systemName != null">#{systemName},</if> <if test="systemName != null">#{systemName},</if>
</trim> </trim>
</insert> </insert>
<insert id="batchInsert" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsert" parameterType="com.muyu.etl.domain.DataAsset" useGeneratedKeys="true" keyProperty="id">
insert into data_asset insert into data_asset
@ -214,8 +214,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="clearTable"> <delete id="clearTable">
delete from data_asset where data_source_id in delete from data_asset where data_source_id in
<foreach collection="id" item="item" index="index" open="(" separator="," close=")"> <foreach collection="id" item="item" index="index" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -94,14 +94,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="delDict"> <delete id="delDict">
delete dictionarydata where dictionary_id in delete dictionarydata where dictionary_id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteDictionaryDataBy"> <delete id="deleteDictionaryDataBy">
delete from dictionarydata where dictionary_id = #{id} delete from dictionarydata where dictionary_id = #{id}
</delete> </delete>

View File

@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
and data_source_id = #{dataSourceId} and data_source_id = #{dataSourceId}
</where> </where>
Group by id
</select> </select>
<select id="getDictionaryDataList" resultType="com.muyu.etl.domain.Dictionary"> <select id="getDictionaryDataList" resultType="com.muyu.etl.domain.Dictionary">
<include refid="selectDictionaryVo"></include> <include refid="selectDictionaryVo"></include>

View File

@ -1,206 +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.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` (
`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="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>

View File

@ -1,120 +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.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>

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-modules</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-rule-engine</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- MuYu Common DataSource -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datasource</artifactId>
</dependency>
<!-- MuYu Common DataScope -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-log</artifactId>
</dependency>
<!-- MuYu Common Swagger -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-swagger</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,18 +1,22 @@
package com.muyu.etl; package com.muyu.rule.engine;
import com.muyu.common.security.annotation.EnableCustomConfig; import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients; import com.muyu.common.security.annotation.EnableMyFeignClients;
import com.muyu.common.swagger.annotation.EnableCustomSwagger2; import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
*
*
* @author muyu
*/
@EnableCustomConfig @EnableCustomConfig
@EnableCustomSwagger2 @EnableCustomSwagger2
@EnableMyFeignClients @EnableMyFeignClients
@SpringBootApplication @SpringBootApplication
public class MuYuEtlApplication { public class MuYuRuleEngineApplication {
public static void main (String[] args) { public static void main (String[] args) {
SpringApplication.run(MuYuEtlApplication.class, args); SpringApplication.run(MuYuRuleEngineApplication.class, args);
} }
} }

View File

@ -14,6 +14,7 @@
<module>muyu-job</module> <module>muyu-job</module>
<module>muyu-file</module> <module>muyu-file</module>
<module>muyu-etl</module> <module>muyu-etl</module>
<module>muyu-rule-engine</module>
</modules> </modules>
<artifactId>muyu-modules</artifactId> <artifactId>muyu-modules</artifactId>