package com.ruoyi.web.app;

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 com.ruoyi.bst.complaint.domain.Complaint;
import com.ruoyi.bst.complaint.service.ComplaintService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.LogBizType;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 投诉建议
 * @author 辉
 * 2024/3/7
 */
@Api(tags = "投诉建议")
@RestController
@RequestMapping("/app/complaint")
public class AppComplaintController extends BaseController {

    @Autowired
    private ComplaintService complaintService;

    /**
     * 创建投诉建议
     * @param complaint
     * @return
     */
    @ApiOperation("创建投诉建议")
    @PostMapping
    @Log(title = "创建投诉建议", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.COMPLAINT)
    public AjaxResult add(@RequestBody Complaint complaint) {
        complaint.setUserId(getUserId());
        return AjaxResult.success(complaintService.insertComplaint(complaint));
    }

}
