package com.ruoyi.web.controller.app;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.ss.complaint.domain.SmComplaint;
import com.ruoyi.ss.complaint.service.ISmComplaintService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

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

    @Autowired
    private ISmComplaintService complaintService;

    /**
     * 创建投诉建议
     * @param smComplaint
     * @return
     */
    @ApiOperation("创建投诉建议")
    @PostMapping
    public AjaxResult add(@RequestBody @Validated({ValidGroup.FrontCreate.class}) SmComplaint smComplaint) {
        smComplaint.setUserId(getUserId());
        return AjaxResult.success(complaintService.insertSmComplaint(smComplaint));
    }

}
