fine:()修改规格
parent
016d40672d
commit
e5215e5af3
|
@ -63,12 +63,14 @@ public class TableFie{
|
||||||
|
|
||||||
public static TableFie customerBuild(TableFie tableFie, Supplier<TableFie> function) {
|
public static TableFie customerBuild(TableFie tableFie, Supplier<TableFie> function) {
|
||||||
return TableFie.builder()
|
return TableFie.builder()
|
||||||
|
.id(tableFie.getId())
|
||||||
.field(tableFie.getField())
|
.field(tableFie.getField())
|
||||||
.type(tableFie.getType())
|
.type(tableFie.getType())
|
||||||
.collation(tableFie.getCollation())
|
.collation(tableFie.getCollation())
|
||||||
.nullable(tableFie.getNullable())
|
.nullable(tableFie.getNullable())
|
||||||
.primarys(tableFie.getPrimarys())
|
.primarys(tableFie.getPrimarys())
|
||||||
.annotation(tableFie.getAnnotation())
|
.annotation(tableFie.getAnnotation())
|
||||||
|
.tableId(tableFie.getTableId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domain.TableFie;
|
import com.muyu.common.domain.TableFie;
|
||||||
|
import com.muyu.common.domain.TableNames;
|
||||||
import com.muyu.server.service.TableFieldService;
|
import com.muyu.server.service.TableFieldService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -29,15 +30,14 @@ public class TableFieldController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据字段
|
* 查询所有数据字段
|
||||||
* @param tableFie 所有数据字段列表请求参数
|
* @ 所有数据字段列表请求参数
|
||||||
* @return 数据字段列表
|
* @return 数据字段列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping(path = "/list" ,method = RequestMethod.POST)
|
@RequestMapping(path = "/list" ,method = RequestMethod.POST)
|
||||||
@Operation(summary = "抽取数据字段",description = "所有数据字段列表请求参数")
|
@Operation(summary = "抽取数据字段",description = "所有数据字段列表请求参数")
|
||||||
public Result<List<TableFie>> selectList(
|
public Result<List<TableFie>> selectList(){
|
||||||
@Validated @RequestBody TableFie tableFie){
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
tableFieldService.selectList(tableFie),"已同步"
|
tableFieldService.selectList(),"已同步"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,4 +80,15 @@ public class TableFieldController {
|
||||||
return Result.success(null,"操作成功");
|
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.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.common.domain.TableFie;
|
import com.muyu.common.domain.TableFie;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
|
@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TableFieldMapper extends BaseMapper<TableFie> {
|
public interface TableFieldMapper extends BaseMapper<TableFie> {
|
||||||
|
List<TableFie> selectByName(@Param("tableName") String tableName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.server.service;
|
package com.muyu.server.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domain.TableFie;
|
import com.muyu.common.domain.TableFie;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,8 +16,11 @@ import java.util.List;
|
||||||
public interface TableFieldService extends IService<TableFie> {
|
public interface TableFieldService extends IService<TableFie> {
|
||||||
/**
|
/**
|
||||||
* 查询所有数据字段
|
* 查询所有数据字段
|
||||||
* @param tableFie 所有数据字段列表请求参数
|
* @ 所有数据字段列表请求参数
|
||||||
* @return 数据字段列表
|
* @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()
|
List<DataName> list = dataNameService.list().stream()
|
||||||
.map(DataName::dataNameBuild).toList();
|
.map(DataName::dataNameBuild).toList();
|
||||||
|
|
||||||
ArrayList<TableNames> namesArrayList = new ArrayList<>();
|
ArrayList<TableNames> namesArrayList = new ArrayList<>();
|
||||||
|
|
||||||
ArrayList<TableFie> fieArrayList = new ArrayList<>();
|
ArrayList<TableFie> fieArrayList = new ArrayList<>();
|
||||||
|
|
||||||
list.forEach(dataName -> {
|
list.forEach(dataName -> {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(String.valueOf(dataName.getId()))) {
|
if (StringUtils.isNotBlank(String.valueOf(dataName.getId()))) {
|
||||||
List<TableNames> tableNames = tableRunNameService.list(new LambdaQueryWrapper<TableNames>()
|
List<TableNames> tableNames = tableRunNameService.list(new LambdaQueryWrapper<TableNames>()
|
||||||
.eq(TableNames::getDataId, dataName.getId()))
|
.eq(TableNames::getDataId, dataName.getId()))
|
||||||
.stream()
|
.stream()
|
||||||
.map(TableNames::tableNamesBuild).toList();
|
.map(TableNames::tableNamesBuild)
|
||||||
namesArrayList.addAll(tableNames);
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
tableNames.forEach(tableName -> {
|
tableNames.forEach(tableName -> {
|
||||||
if (StringUtils.isNotBlank(String.valueOf(tableName.getId()))) {
|
namesArrayList.add(tableName);
|
||||||
List<TableFie> list1 = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
dataName.setTableNames(namesArrayList);
|
||||||
.eq(TableFie::getTableId, tableName.getId()))
|
List<TableNames> tableNames1 = dataName.getTableNames();
|
||||||
.stream()
|
|
||||||
.map(TableFie::tableFieBuild).toList();
|
|
||||||
fieArrayList.addAll(list1);
|
|
||||||
|
|
||||||
}
|
tableNames1.forEach(tableName1 -> {
|
||||||
tableName.setTableFie(fieArrayList);
|
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;
|
return list;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domain.TableFie;
|
import com.muyu.common.domain.TableFie;
|
||||||
import com.muyu.server.mapper.TableFieldMapper;
|
import com.muyu.server.mapper.TableFieldMapper;
|
||||||
import com.muyu.server.service.TableFieldService;
|
import com.muyu.server.service.TableFieldService;
|
||||||
|
@ -26,22 +27,21 @@ public class TableFieldServiceImpl
|
||||||
extends ServiceImpl<TableFieldMapper, TableFie>
|
extends ServiceImpl<TableFieldMapper, TableFie>
|
||||||
implements TableFieldService {
|
implements TableFieldService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TableFieldMapper tableFieldMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TableFieldServicelimt tableFieldServicelimt;
|
private TableFieldServicelimt tableFieldServicelimt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据字段
|
* 查询所有数据字段
|
||||||
* @param tableFie 所有数据字段列表请求参数
|
* 所有数据字段列表请求参数
|
||||||
* @return 数据字段列表
|
* @return 数据字段列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TableFie> selectList(TableFie tableFie) {
|
public List<TableFie> selectList() {
|
||||||
LambdaQueryWrapper<TableFie> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.like(
|
List<TableFie> tableFieList = this.list();
|
||||||
StringUtils.isNotBlank(tableFie.getType()),
|
|
||||||
TableFie::getType, tableFie.getType()
|
|
||||||
);
|
|
||||||
List<TableFie> tableFieList = this.list(queryWrapper);
|
|
||||||
return tableFieList.stream()
|
return tableFieList.stream()
|
||||||
.map(orderPaytableField -> customerBuild(
|
.map(orderPaytableField -> customerBuild(
|
||||||
orderPaytableField,
|
orderPaytableField,
|
||||||
|
@ -53,4 +53,9 @@ public class TableFieldServiceImpl
|
||||||
)
|
)
|
||||||
.toList();
|
.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