package com.xly.web; import com.xly.agent.AgentIdentity; import com.xly.service.AuthzService; import com.xly.service.FormResolverService; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; import java.util.Map; /** * FormCollect 的**FK 二级选择器**数据端点:外键字段(客户/产品/物料…)的候选从对应表实时取, * 多列展示 + 名称搜索 + 分页。 * *
前端调 {@code GET /api/agent/form/options?table=elecustomer&q=..&page=1&pageSize=20}, * 返回 {@code {columns:[{col,label}…], rows:[{sId, 列:值…}], total, page, pageSize}}。 * *
安全:需登录;**租户来自服务端内省的身份**(不接受客户端传 brandsid,否则不传即可跨租户全库翻页);
* 表名限于「在字段字典里作为外键目标出现过」的白名单(见 {@link FormResolverService#fkOptionPage})。
*/
@RestController
@RequestMapping("/api/agent/form")
public class FormController {
private final FormResolverService resolver;
private final AuthzService authz;
public FormController(FormResolverService resolver, AuthzService authz) {
this.resolver = resolver;
this.authz = authz;
}
@GetMapping("/options")
public Map