Skip to content

feat: crud from semantic#5

Open
mengnankkkk wants to merge 3 commits into
mainfrom
feat_semantic_1
Open

feat: crud from semantic#5
mengnankkkk wants to merge 3 commits into
mainfrom
feat_semantic_1

Conversation

@mengnankkkk
Copy link
Copy Markdown
Member

@mengnankkkk mengnankkkk commented May 30, 2026

添加语义层的crud操作
主要修改:

  • 修改datasource.sql
    -与其配套的mapper service controller

@mengnankkkk mengnankkkk requested review from VLSMB and lzq986 May 30, 2026 11:21
Copy link
Copy Markdown
Member

@VLSMB VLSMB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ptal

@RequestParam(defaultValue = "20") Integer pageSize,
@RequestParam(name = "keywordPrefix", required = false) String keywordPrefix,
@RequestParam(defaultValue = "asc") String sortOrder) {
return Result.success(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该对参数进行基础的合理性校验,比如字符串是否为空,page是否为负数之类的

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面的也都有这个问题。控制器方法应该做参数校验,否则跟直接使用Service层没有区别了


private final ColumnSemanticService columnSemanticService;

public TableColumnSemanticController(ColumnSemanticService columnSemanticService) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以改用lombok的注解省去这个全参构造器

import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/semantic/tables/{tableName}/columns")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得将变化参数放在路由的最后语义会更清晰一些,/api/semantic/tables/columns/{tableName}或者/api/semantic/table_columns/{tableName}都行


@RestController
@RequestMapping("/api/semantic/tables/{tableName}/relations")
public class TableRelationSemanticController {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题同上一个Controller


@RestController
@RequestMapping("/api/semantic/tables")
public class TableSemanticController {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

private final DatasourceService datasourceService;
private final ColumnSemanticInfoMapper columnSemanticInfoMapper;

public ColumnSemanticServiceImpl(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也可以用lombok注解

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants