package com.zcloud.modules.sys.controller;

import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.modules.sys.entity.BusImgfilesEntity;
import com.zcloud.modules.sys.service.BusImgfilesService;
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.Map;

/**
 * @Author fangjiakai
 * @Desc 图片附件(BusImgfiles)表控制层
 * @Date 2023-10-19 15:09:20
 */
@Api(tags = "图片附件")
@RestController
@RequestMapping("busImgfiles")
public class BusImgfilesController extends AbstractController {

    @Autowired
    private BusImgfilesService busImgfilesService;

    @ApiOperation("图片附件-新增数据")
    @SysLog("图片附件-新增数据")
//	@RequiresPermissions("BusImgfiles:save")
    @PostMapping("/save")
    public R insert(@RequestBody BusImgfilesEntity param) {
        busImgfilesService.save(param);

        return R.ok();
    }

    @ApiOperation("图片附件-编辑数据")
    @SysLog("图片附件-编辑数据")
//    @RequiresPermissions("BusImgfiles:update")
    @PostMapping("/update")
    public R update(@RequestBody BusImgfilesEntity param) {
        busImgfilesService.updateById(param);

        return R.ok();
    }


    @ApiOperation("图片附件-删除数据")
    @SysLog("图片附件-删除数据")
//    @RequiresPermissions("BusImgfiles:delete")
    @PostMapping("/delete")
    public R delete(@RequestBody BusImgfilesEntity param) {
        busImgfilesService.delete(param.getImgfilesId());
        return R.ok();
    }

    @ApiOperation("图片附件-分页查询")
    @SysLog("图片附件-分页查询")
//    @RequiresPermissions("BusImgfiles:list")
    @PostMapping("/listPage")
    public R listPage(@RequestBody Map<String, Object> params) {
        PageUtils page = busImgfilesService.listPage(params);

		return R.ok().put("page", page);
    }


    @ApiOperation("图片附件-根据ID查详情")
    @SysLog("图片附件-根据ID查详情")
//    @RequiresPermissions("BusImgfiles:info")
    @PostMapping("/info")
    public R info(@RequestBody BusImgfilesEntity param) {
        BusImgfilesEntity busImgfiles = busImgfilesService.getById(param.getImgfilesId());
        return R.ok().put("busImgfiles", busImgfiles);
    }

}
