DgArchivesDestructionController.java 2.8 KB
package com.pashanhoo.destroy.controller;


import com.pashanhoo.common.Result;
import com.pashanhoo.destroy.entity.vo.AddDgArchivesDestructionRequest;
import com.pashanhoo.destroy.entity.vo.DgArchivesDestructionSearchRequest;
import com.pashanhoo.destroy.entity.vo.UpdateDgArchivesDestructionRequest;
import com.pashanhoo.destroy.service.DgArchivesDestructionService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>
 * 档案销毁 前端控制器
 * </p>
 *
 * @author
 * @since 2021-11-05
 */
@RestController
@RequestMapping("/system/dgArchivesDestruction/")
@Api(tags = "档案销毁接口")
public class DgArchivesDestructionController {
    @Autowired
    private DgArchivesDestructionService dgarchivesdestructionService;

    @PostMapping("insertDgArchivesDestruction")
    @ApiOperation("新增档案销毁")
    public Result insertDgArchivesDestruction(@RequestBody AddDgArchivesDestructionRequest request) {
        if (dgarchivesdestructionService.insertDgArchivesDestruction(request)) {
            return Result.ok();
        }
        return Result.error("新增失败");
    }

    @DeleteMapping("deleteDgArchivesDestructionByIds")
    @ApiOperation(value = "批量删除档案销毁")
    public Result deleteDgArchivesDestructionByIds(@ApiParam("档案销毁ID列表") @RequestParam(value = "idList") List<String> idList) {
        if (dgarchivesdestructionService.removeByIds(idList)) {
            return Result.ok("删除成功");
        }
        return Result.error("删除失败");
    }

    @PutMapping("updateDgArchivesDestruction")
    @ApiOperation("修改档案销毁")
    public Result updateDgArchivesDestruction(@RequestBody UpdateDgArchivesDestructionRequest request) {
        if (dgarchivesdestructionService.updateDgArchivesDestruction(request)) {
            return Result.ok("修改成功");
        }
        return Result.error("修改失败");
    }

    @GetMapping("getDgArchivesDestructionDetailById")
    @ApiOperation(value = "读取明细")
    public Result getDgArchivesDestructionDetailById(@ApiParam("档案销毁ID") @RequestParam String id) {
        return Result.ok(dgarchivesdestructionService.getDgArchivesDestructionDetailById(id));
    }

    @PostMapping("search")
    @ApiOperation(value = "根据条件进行列表查询")
    public Result searchDgArchivesDestructionList(@RequestBody DgArchivesDestructionSearchRequest request) {
        //TODO 默认排序条件设置
        request.defaultFillPageProp("", "");
        return Result.ok(dgarchivesdestructionService.searchDgArchivesDestructionList(request));
    }
}