package com.xly.web; import com.xly.service.FormResolverService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * FormCollect 的**FK 二级选择器**数据端点:外键字段(客户/产品/物料…)的候选从对应表实时取, * 多列展示 + 名称搜索 + 分页。 * *
前端渲染 {@code type=fkselect} 字段时调
* {@code GET /api/agent/form/options?table=elecustomer&q=..&page=1&pageSize=20},
* 返回 {@code {columns:[{col,label}…], rows:[{sId, 列:值…}], total, page, pageSize}}。
* 安全:{@link FormResolverService#fkOptionPage} 只允许「在字段字典里作为外键目标出现过」的表,
* 并按名称字段模糊匹配 + 租户过滤 + LIMIT,避免任意读表。
*/
@RestController
@RequestMapping("/api/agent/form")
public class FormController {
private final FormResolverService resolver;
public FormController(FormResolverService resolver) {
this.resolver = resolver;
}
@GetMapping("/options")
public Map