| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.pojo.Document; |
| | | import com.yuanchu.mom.service.DocumentService; |
| | | import com.yuanchu.mom.vo.Result; |
| | |
| | | private DocumentService documentService; |
| | | |
| | | @PostMapping |
| | | @ValueAuth |
| | | public Result createDocument( Document document) { |
| | | documentService.save(document); |
| | | return Result.success("ok"); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ValueAuth |
| | | public Document getDocumentById(@PathVariable Integer id) { |
| | | return documentService.getById(id); |
| | | } |
| | | |
| | | @PutMapping("updateDocument") |
| | | @ValueAuth |
| | | public Result updateDocument(@RequestBody Document document) { |
| | | return Result.success(documentService.updateById(document)); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ValueAuth |
| | | public Result deleteDocumentById(@PathVariable Integer id) { |
| | | return Result.success(documentService.removeById(id)); |
| | | } |
| | | |
| | | @GetMapping("/getListByDId/{id}") |
| | | @ValueAuth |
| | | public Result getAllDocuments(@PathVariable Integer id) { |
| | | LambdaQueryWrapper<Document> lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Document::getDeviceId,id); |