feat():钢种返回格式

This commit is contained in:
Allenxy
2024-10-10 14:46:24 +08:00
parent 217d1ae9d3
commit 9f45fefdbd

View File

@@ -2,6 +2,7 @@ package com.fizz.business.controller;
import com.fizz.business.domain.SteelGradeInfo; import com.fizz.business.domain.SteelGradeInfo;
import com.fizz.business.service.SteelGradeInfoService; import com.fizz.business.service.SteelGradeInfoService;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -20,25 +21,25 @@ public class SteelGradeInfoController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("查询钢种列表") @ApiOperation("查询钢种列表")
public List<SteelGradeInfo> list() { public R<List<SteelGradeInfo>> list() {
return steelGradeInfoService.list(); return R.ok(steelGradeInfoService.list());
} }
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增") @ApiOperation("新增")
public boolean add(@RequestBody SteelGradeInfo steelGradeInfo) { public R<Boolean> add(@RequestBody SteelGradeInfo steelGradeInfo) {
return steelGradeInfoService.save(steelGradeInfo); return R.ok(steelGradeInfoService.save(steelGradeInfo));
} }
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("更新") @ApiOperation("更新")
public boolean update(@RequestBody SteelGradeInfo steelGradeInfo) { public R<Boolean> update(@RequestBody SteelGradeInfo steelGradeInfo) {
return steelGradeInfoService.updateById(steelGradeInfo); return R.ok(steelGradeInfoService.updateById(steelGradeInfo));
} }
@ApiOperation("删除") @ApiOperation("删除")
@DeleteMapping("/delete/{id}") @DeleteMapping("/delete/{id}")
public boolean delete(@PathVariable Integer id) { public R<Boolean> delete(@PathVariable Integer id) {
return steelGradeInfoService.removeById(id); return R.ok(steelGradeInfoService.removeById(id));
} }
} }