File src/main/java/com/darren/tommserver/controller/AlbumController.java changed (mode: 100644) (index f123b80..92f4c4c) |
... |
... |
package com.darren.tommserver.controller; |
3 |
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 |
4 |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
5 |
5 |
import com.darren.tommserver.core.response.ResponseData; |
import com.darren.tommserver.core.response.ResponseData; |
6 |
|
import com.darren.tommserver.core.response.SuccessResponseData; |
|
7 |
6 |
import com.darren.tommserver.entity.Album; |
import com.darren.tommserver.entity.Album; |
8 |
7 |
import com.darren.tommserver.service.AlbumService; |
import com.darren.tommserver.service.AlbumService; |
9 |
8 |
import org.springframework.web.bind.annotation.*; |
import org.springframework.web.bind.annotation.*; |
|
... |
... |
public class AlbumController { |
35 |
34 |
*/ |
*/ |
36 |
35 |
@GetMapping |
@GetMapping |
37 |
36 |
public ResponseData selectAll(Page<Album> page, Album album) { |
public ResponseData selectAll(Page<Album> page, Album album) { |
38 |
|
return new SuccessResponseData(albumService.page(page, new QueryWrapper<>(album))); |
|
|
37 |
|
return ResponseData.success(albumService.page(page, new QueryWrapper<>(album))); |
39 |
38 |
} |
} |
40 |
39 |
|
|
41 |
40 |
/** |
/** |
|
... |
... |
public class AlbumController { |
46 |
45 |
*/ |
*/ |
47 |
46 |
@GetMapping("{id}") |
@GetMapping("{id}") |
48 |
47 |
public ResponseData selectOne(@PathVariable Serializable id) { |
public ResponseData selectOne(@PathVariable Serializable id) { |
49 |
|
return new SuccessResponseData(this.albumService.getById(id)); |
|
|
48 |
|
return ResponseData.success(albumService.getById(id)); |
50 |
49 |
} |
} |
51 |
50 |
|
|
52 |
51 |
/** |
/** |
|
... |
... |
public class AlbumController { |
57 |
56 |
*/ |
*/ |
58 |
57 |
@PostMapping |
@PostMapping |
59 |
58 |
public ResponseData insert(@RequestBody Album album) { |
public ResponseData insert(@RequestBody Album album) { |
60 |
|
return new SuccessResponseData(albumService.save(album)); |
|
|
59 |
|
return ResponseData.success(albumService.save(album)); |
61 |
60 |
} |
} |
62 |
61 |
|
|
63 |
62 |
/** |
/** |
|
... |
... |
public class AlbumController { |
68 |
67 |
*/ |
*/ |
69 |
68 |
@PutMapping |
@PutMapping |
70 |
69 |
public ResponseData update(@RequestBody Album album) { |
public ResponseData update(@RequestBody Album album) { |
71 |
|
return new SuccessResponseData(albumService.updateById(album)); |
|
|
70 |
|
return ResponseData.success(albumService.updateById(album)); |
72 |
71 |
} |
} |
73 |
72 |
|
|
74 |
73 |
/** |
/** |
|
... |
... |
public class AlbumController { |
79 |
78 |
*/ |
*/ |
80 |
79 |
@DeleteMapping |
@DeleteMapping |
81 |
80 |
public ResponseData delete(@RequestParam("idList") List<Long> idList) { |
public ResponseData delete(@RequestParam("idList") List<Long> idList) { |
82 |
|
return new SuccessResponseData(albumService.removeByIds(idList)); |
|
|
81 |
|
return ResponseData.success(albumService.removeByIds(idList)); |
83 |
82 |
} |
} |
84 |
83 |
} |
} |
85 |
84 |
|
|