package com.yonge.cooleshow.admin.controller;

import com.yonge.cooleshow.biz.dal.entity.SysImComplaint;
import com.yonge.cooleshow.biz.dal.service.SysImComplaintService;
import com.yonge.cooleshow.biz.dal.service.SysUserService;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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 javax.annotation.Resource;
import java.util.Date;

/**
 * (SysImComplaint)表控制层
 *
 * @author zx
 * @since 2022-06-13 16:37:00
 */
@RestController
@Api(tags = "消息（群组）投诉")
@RequestMapping("sysImComplaint")
public class SysImComplaintController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private SysImComplaintService sysImComplaintService;
    @Resource
    private SysUserService sysUserService;

    @ApiOperation(value = "新增")
    @PostMapping("/add")
    @PreAuthorize("@pcs.hasPermissions('sysImComplaint/add')")
    public HttpResponseResult<Boolean> add(@RequestBody SysImComplaint sysImComplaint) {
        sysImComplaint.setUserId(sysUserService.getUserId());
        Date now = new Date();
        sysImComplaint.setUpdateTime(now);
        sysImComplaint.setCreateTime(now);
        return succeed(sysImComplaintService.save(sysImComplaint));
    }

}

