|
@@ -1,17 +1,24 @@
|
|
package cn.iocoder.yudao.module.museum.controller.admin.museuminfo;
|
|
package cn.iocoder.yudao.module.museum.controller.admin.museuminfo;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoRespVO;
|
|
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoRespVO;
|
|
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
|
|
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
|
|
import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
|
|
import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
|
|
import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
|
|
import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
@Tag(name = "博物馆-标本库")
|
|
@Tag(name = "博物馆-标本库")
|
|
@RestController
|
|
@RestController
|
|
@@ -22,25 +29,45 @@ public class MuseumInfoController {
|
|
@Resource
|
|
@Resource
|
|
private MuseumInfoService museumInfoService;
|
|
private MuseumInfoService museumInfoService;
|
|
|
|
|
|
|
|
+ //TODO 判断标本编号是否重复
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "新增标本")
|
|
@Operation(summary = "新增标本")
|
|
- public Integer createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
|
|
- return museumInfoService.createMuseumInfo(saveVO);
|
|
|
|
|
|
+ public CommonResult<Integer> createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
|
|
+ String sampleId = saveVO.getSampleId();
|
|
|
|
+
|
|
|
|
+// MuseumInfoDO result = museumInfoService.;
|
|
|
|
+// if (result!=null){
|
|
|
|
+// return CommonResult.error(1,"标本编号已存在");
|
|
|
|
+// }else {
|
|
|
|
+ return CommonResult.success(museumInfoService.createMuseumInfo(saveVO));
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
- @PutMapping("/update")
|
|
|
|
@Operation(summary = "更新标本")
|
|
@Operation(summary = "更新标本")
|
|
public CommonResult<Boolean> updateMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
public CommonResult<Boolean> updateMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
|
|
|
|
+// saveVO.setSampleType(1);
|
|
museumInfoService.updateMuseumInfo(saveVO);
|
|
museumInfoService.updateMuseumInfo(saveVO);
|
|
return CommonResult.success(true);
|
|
return CommonResult.success(true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //TODO 需要提供原因,调用更新方法
|
|
@DeleteMapping("/delete")
|
|
@DeleteMapping("/delete")
|
|
@Operation(summary = "删除标本")
|
|
@Operation(summary = "删除标本")
|
|
public CommonResult<Boolean> deleteMuseumInfo(@RequestParam("id") Integer id){
|
|
public CommonResult<Boolean> deleteMuseumInfo(@RequestParam("id") Integer id){
|
|
museumInfoService.deleteMuseumInfo(id);
|
|
museumInfoService.deleteMuseumInfo(id);
|
|
return CommonResult.success(true);
|
|
return CommonResult.success(true);
|
|
}
|
|
}
|
|
|
|
+ // @DeleteMapping("/delete")
|
|
|
|
+// @Operation(summary = "删除")
|
|
|
|
+// public CommonResult<Boolean> deleteMuseumText(@RequestParam("id") Integer id ){
|
|
|
|
+// MuseumTextSaveVO saveVO =new MuseumTextSaveVO();
|
|
|
|
+//// saveVO.setId();
|
|
|
|
+//// saveVO.set()
|
|
|
|
+//// museumTextService.updateMuseumText(saveVO);
|
|
|
|
+//
|
|
|
|
+// museumTextService.deleteMuseumText(id);
|
|
|
|
+// return CommonResult.success(true);
|
|
|
|
+
|
|
|
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
@Operation(summary = "查找标本")
|
|
@Operation(summary = "查找标本")
|
|
@@ -50,4 +77,42 @@ public class MuseumInfoController {
|
|
return CommonResult.success(result1);
|
|
return CommonResult.success(result1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @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()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //@GetMapping("/get")
|
|
|
|
+// @Operation(summary = "查询")
|
|
|
|
+// public CommonResult<List<MuseumTextRespVO>> getMuseumText(@RequestParam("id") Integer id){
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// 1.
|
|
|
|
+ //TODO LIST Map
|
|
|
|
+// TODO 1.2.3.代表哪种标本类型
|
|
|
|
+// 返回某种标本类型的List数组
|
|
|
|
+// Integer
|
|
|
|
+// Map<> 键值对
|
|
|
|
+
|
|
|
|
+// public CommonResult<Map<String,Integer>> getMap(@RequestParam("id") Integer id){
|
|
|
|
+// Map<String,Integer> result =new HashMap<>();
|
|
|
|
+// Integer Ynmber = null;
|
|
|
|
+// result.put("陨石数量",Ynmber);
|
|
|
|
+// return CommonResult.success(result);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// public CommonResult<MuseumTextRespVO> getdo(@RequestParam("id") Integer id){
|
|
|
|
+// MuseumTextRespVO DO =new MuseumTextRespVO();
|
|
|
|
+//// Integer Ynmber = selectMuseumInfoBySampleType(1)
|
|
|
|
+//// Integer hs = selectMuseumInfoBySampleType(2)
|
|
|
|
+//// DO.setYnumber(Ynmber);
|
|
|
|
+// }
|
|
|
|
+
|
|
}
|
|
}
|