fine:()修改规格
parent
016d40672d
commit
e5215e5af3
|
@ -63,12 +63,14 @@ public class TableFie{
|
|||
|
||||
public static TableFie customerBuild(TableFie tableFie, Supplier<TableFie> function) {
|
||||
return TableFie.builder()
|
||||
.id(tableFie.getId())
|
||||
.field(tableFie.getField())
|
||||
.type(tableFie.getType())
|
||||
.collation(tableFie.getCollation())
|
||||
.nullable(tableFie.getNullable())
|
||||
.primarys(tableFie.getPrimarys())
|
||||
.annotation(tableFie.getAnnotation())
|
||||
.tableId(tableFie.getTableId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.controller;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
import com.muyu.common.domain.TableNames;
|
||||
import com.muyu.server.service.TableFieldService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -29,15 +30,14 @@ public class TableFieldController {
|
|||
|
||||
/**
|
||||
* 查询所有数据字段
|
||||
* @param tableFie 所有数据字段列表请求参数
|
||||
* @ 所有数据字段列表请求参数
|
||||
* @return 数据字段列表
|
||||
*/
|
||||
@RequestMapping(path = "/list" ,method = RequestMethod.POST)
|
||||
@Operation(summary = "抽取数据字段",description = "所有数据字段列表请求参数")
|
||||
public Result<List<TableFie>> selectList(
|
||||
@Validated @RequestBody TableFie tableFie){
|
||||
public Result<List<TableFie>> selectList(){
|
||||
return Result.success(
|
||||
tableFieldService.selectList(tableFie),"已同步"
|
||||
tableFieldService.selectList(),"已同步"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,15 @@ public class TableFieldController {
|
|||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:根据表名查询所有字段信息
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @return 字段集合
|
||||
*/
|
||||
@PostMapping("/selectByTableName")
|
||||
@Operation(summary = "根据表名获取所有字段")
|
||||
public Result<List<TableFie>> selectByName(String tableName){
|
||||
return Result.success(tableFieldService.selectByName(tableName),"操作成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ package com.muyu.server.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
|
@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface TableFieldMapper extends BaseMapper<TableFie> {
|
||||
List<TableFie> selectByName(@Param("tableName") String tableName);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,8 +16,11 @@ import java.util.List;
|
|||
public interface TableFieldService extends IService<TableFie> {
|
||||
/**
|
||||
* 查询所有数据字段
|
||||
* @param tableFie 所有数据字段列表请求参数
|
||||
* @ 所有数据字段列表请求参数
|
||||
* @return 数据字段列表
|
||||
*/
|
||||
List<TableFie> selectList(TableFie tableFie);
|
||||
List<TableFie> selectList();
|
||||
|
||||
|
||||
List<TableFie> selectByName(String tableName);
|
||||
}
|
||||
|
|
|
@ -107,31 +107,52 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
|||
|
||||
List<DataName> list = dataNameService.list().stream()
|
||||
.map(DataName::dataNameBuild).toList();
|
||||
|
||||
ArrayList<TableNames> namesArrayList = new ArrayList<>();
|
||||
|
||||
ArrayList<TableFie> fieArrayList = new ArrayList<>();
|
||||
|
||||
list.forEach(dataName -> {
|
||||
|
||||
if (StringUtils.isNotBlank(String.valueOf(dataName.getId()))) {
|
||||
List<TableNames> tableNames = tableRunNameService.list(new LambdaQueryWrapper<TableNames>()
|
||||
.eq(TableNames::getDataId, dataName.getId()))
|
||||
.stream()
|
||||
.map(TableNames::tableNamesBuild).toList();
|
||||
namesArrayList.addAll(tableNames);
|
||||
.map(TableNames::tableNamesBuild)
|
||||
.toList();
|
||||
|
||||
|
||||
tableNames.forEach(tableName -> {
|
||||
if (StringUtils.isNotBlank(String.valueOf(tableName.getId()))) {
|
||||
List<TableFie> list1 = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
||||
.eq(TableFie::getTableId, tableName.getId()))
|
||||
.stream()
|
||||
.map(TableFie::tableFieBuild).toList();
|
||||
fieArrayList.addAll(list1);
|
||||
namesArrayList.add(tableName);
|
||||
dataName.setTableNames(namesArrayList);
|
||||
List<TableNames> tableNames1 = dataName.getTableNames();
|
||||
|
||||
}
|
||||
tableName.setTableFie(fieArrayList);
|
||||
tableNames1.forEach(tableName1 -> {
|
||||
System.out.println(tableName1);
|
||||
if (StringUtils.isNotBlank(String.valueOf(tableName1.getId()))){
|
||||
List<TableFie> list1 = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
||||
.eq(TableFie::getTableId, tableName1.getId()))
|
||||
.stream()
|
||||
.map(TableFie::tableFieBuild).toList();
|
||||
System.out.println(list1);
|
||||
fieArrayList.addAll(list1);
|
||||
tableName1.setTableFie(fieArrayList);
|
||||
}
|
||||
});
|
||||
// tableNames1.forEach(tableName1 -> {
|
||||
// if (StringUtils.isNotBlank(String.valueOf(tableName1.getId()))) {
|
||||
// List<TableFie> list1 = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
||||
// .eq(TableFie::getTableId, tableName1.getId()))
|
||||
// .stream()
|
||||
// .map(TableFie::tableFieBuild).toList();
|
||||
// list1.forEach(tableFy -> {
|
||||
// fieArrayList.add(tableFy);
|
||||
// tableName1.setTableFie(fieArrayList);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
dataName.setTableNames(namesArrayList);
|
||||
});
|
||||
return list;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
import com.muyu.server.mapper.TableFieldMapper;
|
||||
import com.muyu.server.service.TableFieldService;
|
||||
|
@ -26,22 +27,21 @@ public class TableFieldServiceImpl
|
|||
extends ServiceImpl<TableFieldMapper, TableFie>
|
||||
implements TableFieldService {
|
||||
|
||||
@Autowired
|
||||
private TableFieldMapper tableFieldMapper;
|
||||
|
||||
@Autowired
|
||||
private TableFieldServicelimt tableFieldServicelimt;
|
||||
|
||||
/**
|
||||
* 查询所有数据字段
|
||||
* @param tableFie 所有数据字段列表请求参数
|
||||
* 所有数据字段列表请求参数
|
||||
* @return 数据字段列表
|
||||
*/
|
||||
@Override
|
||||
public List<TableFie> selectList(TableFie tableFie) {
|
||||
LambdaQueryWrapper<TableFie> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotBlank(tableFie.getType()),
|
||||
TableFie::getType, tableFie.getType()
|
||||
);
|
||||
List<TableFie> tableFieList = this.list(queryWrapper);
|
||||
public List<TableFie> selectList() {
|
||||
|
||||
List<TableFie> tableFieList = this.list();
|
||||
return tableFieList.stream()
|
||||
.map(orderPaytableField -> customerBuild(
|
||||
orderPaytableField,
|
||||
|
@ -53,4 +53,9 @@ public class TableFieldServiceImpl
|
|||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableFie> selectByName(String tableName) {
|
||||
return tableFieldMapper.selectByName(tableName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?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.server.mapper.TableFieldMapper">
|
||||
|
||||
<select id="selectByName" resultType="com.muyu.common.domain.TableFie">
|
||||
SELECT
|
||||
tablefie.*,
|
||||
table_name.`name`
|
||||
FROM
|
||||
tablefie
|
||||
LEFT JOIN table_name ON tablefie.table_id = table_name.id
|
||||
WHERE
|
||||
table_name.`name` = #{tableName}
|
||||
</select>
|
||||
</mapper>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue