48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package iet.ustb.sf.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import iet.ustb.sf.common.R;
|
|
import iet.ustb.sf.service.TableColumnService;
|
|
import iet.ustb.sf.vo.ColumnVo;
|
|
import iet.ustb.sf.vo.TableVo;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* TableColumnController
|
|
*
|
|
* @author huangge1199
|
|
* @since 2025/8/6 15:44:56
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/tableColumn")
|
|
@Tag(name = "数据库表列配置")
|
|
public class TableColumnController {
|
|
|
|
@Resource
|
|
private TableColumnService tableColumnService;
|
|
|
|
@Operation(summary = "查询所有表信息")
|
|
@PostMapping("/getTablesInfo")
|
|
public R<List<TableVo>> getTablesInfo() {
|
|
List<TableVo> result = tableColumnService.getTablesInfo();
|
|
return R.ok(result);
|
|
}
|
|
|
|
@Operation(summary = "根据表名查询表字段")
|
|
@PostMapping("/getColumnsByTableName")
|
|
public R<List<ColumnVo>> getColumnsByTableName(@RequestBody JSONObject params) {
|
|
String tableName = params.getString("tableName");
|
|
List<ColumnVo> result = tableColumnService.getColumnsByTableName(tableName);
|
|
return R.ok(result);
|
|
}
|
|
}
|