kongdeqiang
2024-04-22 7bc78d8f70a4d11e46f8bd640228804a3dd0dc68
src/main/java/com/boying/controller/ViolationTypeController.java
@@ -6,17 +6,21 @@
import com.boying.entity.ViolationType;
import com.boying.service.ViolationTypeService;
import io.swagger.models.auth.In;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("ffzf/violationtype")
@RequiredArgsConstructor
@Tag(description = "ffzf/violationtype" , name = "违章类型接口" )
public class ViolationTypeController {
    private final ViolationTypeService violationTypeService;
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page) {
        QueryWrapper<ViolationType> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -25,23 +29,27 @@
    }
    @PostMapping("/save")
    @Operation(summary = "新增违章类型" , description = "新增违章类型" )
    public Object save(ViolationType violationType) {
        violationTypeService.saveOrUpdate(violationType);
        return R.ok("保存成功");
    }
    @GetMapping("/{id}")
    @Operation(summary = "根据id查询" , description = "根据id查询" )
    public Object getObj(@PathVariable Integer id) {
        return R.ok(violationTypeService.getById(id));
    }
    @PostMapping("/delete")
    @Operation(summary = "删除违章类型" , description = "删除违章类型" )
    public Object delete(Long id) {
        violationTypeService.removeById(id);
        return R.ok("删除成功");
    }
    @PostMapping("/findAll")
    @Operation(summary = "查询所有" , description = "查询所有" )
    public Object findAll() {
        return R.ok(violationTypeService.list());
    }