package com.prolog.cs.biz.inbound.controller.common;

import com.prolog.cs.basic.common.model.BaseBizFile;
import com.prolog.cs.biz.inbound.service.PictureManagementService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "图片管理")
@RestController
@RequestMapping("/pictureManagement")
public class PictureManagementController {

    @Autowired
    private PictureManagementService service;

    @UserLog("保存或更新文件")
    @ApiOperation("保存或更新文件")
    @PostMapping("/saveOrUpdateFile")
    public RestMessage<Object> saveOrUpdateFile(@RequestBody List<BaseBizFile> dataList) {
        return RestMessage.newInstance(true, "保存成功!", service.saveOrUpdateFile(dataList));
    }

    @UserLog("删除文件")
    @ApiOperation("删除文件")
    @PostMapping("/del")
    public RestMessage<Object> del(@RequestBody List<BaseBizFile> dataList) {
        return RestMessage.newInstance(true, "删除成功!", service.del(dataList));
    }
}
