package jnpf.limsController;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import jnpf.limsEntity.ZhiliangBiaozhunGuanliEntity;
|
import jnpf.limsService.ZhiliangBiaozhunGuanliService;
|
import jnpf.util.R;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
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.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.Map;
|
|
@Slf4j
|
@Tag(name = "lims后台基础配置接口", description = "质量标准等基础配置查询入口")
|
@RestController
|
@RequestMapping("/lims/biz/config")
|
public class LimsBizConfigController {
|
|
@Autowired
|
private ZhiliangBiaozhunGuanliService zhiliangBiaozhunGuanliService;
|
|
// ======================== 质量标准 ========================
|
|
/**
|
* 通过样品 ID 查询质量标准(单条)
|
*/
|
@Operation(summary = "通过样品ID查询质量标准")
|
@GetMapping("/zhiliang-biaozhun/get-by-yangpin-id")
|
public R<ZhiliangBiaozhunGuanliEntity> getZhiliangBiaozhunByYangpinId(
|
@RequestParam("yangpinId") String yangpinId) {
|
if (yangpinId == null || yangpinId.isEmpty()) {
|
return R.error("样品ID不能为空");
|
}
|
ZhiliangBiaozhunGuanliEntity entity = zhiliangBiaozhunGuanliService.findByYangpinId(yangpinId);
|
if (entity == null) {
|
return R.error("未找到对应的质量标准数据");
|
}
|
return R.success(entity);
|
}
|
|
/**
|
* 质量标准版本升级:把传入的 formData(主表 + 动态 tableFieldXxxxxx 子表)整体复制为新一份,
|
* 新主表 biz_enabled=disabled,新子表 f_foreign_id 关联新主表 f_id,历史数据不动。
|
*/
|
@Operation(summary = "质量标准版本升级")
|
@PostMapping("/zhiliang-biaozhun/version-upgrade")
|
public R<String> versionUpgradeZhiliangBiaozhun(@RequestBody Map<String, Object> formData) {
|
String newId = zhiliangBiaozhunGuanliService.versionUpgrade(formData);
|
if (newId == null) {
|
return R.success();
|
}
|
return R.success("升级成功", newId);
|
}
|
}
|