|
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
@@ -32,22 +33,22 @@ public class MuseumInfoController {
|
|
|
//TODO 判断标本编号是否重复
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "新增标本")
|
|
|
- public CommonResult<Integer> createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
|
- String sampleId = saveVO.getSampleId();
|
|
|
-
|
|
|
-// MuseumInfoDO result = museumInfoService.;
|
|
|
-// if (result!=null){
|
|
|
-// return CommonResult.error(1,"标本编号已存在");
|
|
|
-// }else {
|
|
|
+ public CommonResult<Integer> createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO) {
|
|
|
+ String sampleId = saveVO.getSampleId();
|
|
|
+ MuseumInfoDO result = museumInfoService.getMuseumInfoBySampleId(sampleId);
|
|
|
+ if (result != null) {
|
|
|
+ return CommonResult.error(1, "标本编号已存在");
|
|
|
+ } else {
|
|
|
return CommonResult.success(museumInfoService.createMuseumInfo(saveVO));
|
|
|
-// }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "更新标本")
|
|
|
public CommonResult<Boolean> updateMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
|
+ museumInfoService.updateMuseumInfo(saveVO);
|
|
|
+ return CommonResult.success(true);
|
|
|
// saveVO.setSampleType(1);
|
|
|
- museumInfoService.updateMuseumInfo(saveVO);
|
|
|
- return CommonResult.success(true);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//TODO 需要提供原因,调用更新方法
|
|
@@ -71,23 +72,47 @@ public class MuseumInfoController {
|
|
|
|
|
|
@GetMapping("/get")
|
|
|
@Operation(summary = "查找标本")
|
|
|
- public CommonResult<MuseumInfoRespVO> getMuseumInfo(@RequestParam("id") Integer id){
|
|
|
+ public CommonResult<MuseumInfoRespVO> selectMuseumInfo(@RequestParam("id") Integer id){
|
|
|
MuseumInfoDO result = museumInfoService.selectMuseumInfo(id);
|
|
|
MuseumInfoRespVO result1 = BeanUtils.toBean(result,MuseumInfoRespVO.class);
|
|
|
return CommonResult.success(result1);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/selectMuseumInfoList")
|
|
|
+ @Operation(summary = "查询SampleTypeList")
|
|
|
+ public CommonResult<List<MuseumInfoDO>> getMuseumInfoList(@RequestParam("sampleType") Integer sampleType){
|
|
|
+ List<MuseumInfoDO> result = museumInfoService.selectMuseumInfoListBySampleType(sampleType);
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获取分页")
|
|
|
-// @PreAuthorize("@ss.hasPermission('system:user:query')")
|
|
|
- public CommonResult<MuseumInfoPageReqVO> pageMuseumInfo(@Valid MuseumInfoPageReqVO pageReqVO){
|
|
|
- PageResult<MuseumInfoDO> pageResult = museumInfoService.getUserPage(pageReqVO);
|
|
|
- if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
- return success(new PageResult<>(pageResult.getTotal()));
|
|
|
- }
|
|
|
+ @PreAuthorize("@ss.hasPermission('museum:museuminfo:query')")
|
|
|
+ public CommonResult<PageResult<MuseumInfoRespVO>> getMuseumInfoPage(@Valid MuseumInfoPageReqVO pageVO){
|
|
|
+ PageResult<MuseumInfoDO> pageResult = museumInfoService.getMuseumInfoPage(pageVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, MuseumInfoRespVO.class));
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// @GetMapping("/get")
|
|
|
+// @Operation(summary = "list数组")
|
|
|
+// public CommonResult<MuseumInfoRespVO> getdo(@RequestParam("sampleType") Integer sampleType){
|
|
|
+// MuseumInfoRespVO list =new MuseumInfoRespVO();
|
|
|
+// Integer Ynmber = selectMuseumInfoBySampleType(1)
|
|
|
+// Integer hs = selectMuseumInfoBySampleType(2)
|
|
|
+
|
|
|
+// DO.setYnmber(Ynmber);
|
|
|
+
|
|
|
+
|
|
|
+// public CommonResult<MuseumInfoRespVO> getMuseumInfo(@RequestParam("sampleId") String sampleId){
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
//@GetMapping("/get")
|
|
|
// @Operation(summary = "查询")
|
|
|
// public CommonResult<List<MuseumTextRespVO>> getMuseumText(@RequestParam("id") Integer id){
|
|
@@ -115,4 +140,6 @@ public class MuseumInfoController {
|
|
|
//// DO.setYnumber(Ynmber);
|
|
|
// }
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|