guyue
4 天以前 89f8649e8cf9bc12b9e29abb0adc4f9b77273143
src/main/java/com/linghu/controller/TypeController.java
@@ -33,6 +33,7 @@
    }
    @PostMapping("/batch")
    @ApiOperation(value = "批量添加类型")
    public ResponseResult<Void> batchAdd(@RequestBody List<Type> types) {
        types.forEach(type -> type.setDel_flag(0));
@@ -44,6 +45,7 @@
    }
    @DeleteMapping("/{typeId}")
    @ApiOperation(value = "删除类型")
    public ResponseResult<Void> delete(@PathVariable Integer typeId) {
        Type type = new Type();
        type.setType_id(typeId);
@@ -56,6 +58,7 @@
    }
    @PutMapping
    @ApiOperation(value = "更新类型")
    public ResponseResult<Void> update(@RequestBody Type type) {
        boolean success = typeService.updateById(type);
        if (success) {
@@ -65,6 +68,7 @@
    }
    @PutMapping("/batch")
    @ApiOperation(value = "批量更新类型")
    public ResponseResult<Void> batchUpdate(@RequestBody List<Type> types) {
        boolean success = typeService.updateBatchById(types);
        if (success) {
@@ -74,6 +78,7 @@
    }
    @GetMapping("/{typeId}")
    @ApiOperation(value = "根据ID查询类型")
    public ResponseResult<Type> getById(@PathVariable Integer typeId) {
        Type type = typeService.getById(typeId);
        if (type != null && type.getDel_flag() != 1) {
@@ -83,6 +88,7 @@
    }
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除类型")
    public ResponseResult<Void> batchDelete(@RequestBody List<Integer> typeIds) {
        List<Type> types = typeIds.stream().map(id -> {
            Type type = new Type();
@@ -98,6 +104,7 @@
    }
    @GetMapping("/list")
    @ApiOperation(value = "查询类型列表,不传页数和大小就查全部")
    public ResponseResult<List<Type>> list(
            @RequestParam(required = false) Integer page,
            @RequestParam(required = false) Integer pageSize) {