| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.ycl.entity.NewsDepartment;
|
| | | import com.ycl.service.NewsDepartmentService;
|
| | | import io.swagger.annotations.Api;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsDepartment")
|
| | | @Api(tags = "机构管理")
|
| | | public class NewsDepartmentController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsDepartment> page, NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.page(page, new QueryWrapper<>(newsDepartment)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsDepartmentService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.save(newsDepartment));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.updateById(newsDepartment));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsDepartmentService.removeByIds(idList));
|
| | | }
|