|
|
@@ -24,15 +24,8 @@ public class ShowroomController extends BaseController {
|
|
|
private ShowroomRepo showroomRepo;
|
|
|
private ShowCollectionRepo showCollectionRepo;
|
|
|
|
|
|
- //@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
public Showroom save(@RequestBody Showroom record) {
|
|
|
-// if (record.getId() != null) {
|
|
|
-// Showroom orig = showroomRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
|
|
|
-// ObjUtils.merge(orig, record);
|
|
|
-// return showroomRepo.save(orig);
|
|
|
-// }
|
|
|
-// return showroomRepo.save(record);
|
|
|
return showroomService.save(SecurityUtils.getAuthenticatedUser().getId(), record);
|
|
|
}
|
|
|
|
|
|
@@ -41,7 +34,6 @@ public class ShowroomController extends BaseController {
|
|
|
return showroomService.update(SecurityUtils.getAuthenticatedUser().getId(), record);
|
|
|
}
|
|
|
|
|
|
- //@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
|
public Page<Showroom> all(@RequestBody PageQuery pageQuery) {
|
|
|
return showroomService.all(pageQuery);
|
|
|
@@ -49,7 +41,9 @@ public class ShowroomController extends BaseController {
|
|
|
|
|
|
@GetMapping("/get/{id}")
|
|
|
public Showroom get(@PathVariable Long id) {
|
|
|
- return showroomRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
+ Showroom showroom = showroomRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
+ showroom.setCollections(showCollectionRepo.findAllByShowroomId(id));
|
|
|
+ return showroom;
|
|
|
}
|
|
|
|
|
|
@PostMapping("/del/{id}")
|
|
|
@@ -64,5 +58,10 @@ public class ShowroomController extends BaseController {
|
|
|
List<Showroom> data = all(pageQuery).getContent();
|
|
|
ExcelUtils.export(response, data);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/{id}/share")
|
|
|
+ public void addShare(@PathVariable Long id) {
|
|
|
+ showroomRepo.addShare(id, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|