package com.ruoyi.message.frequency.goeasymessage.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.message.frequency.goeasymessage.entity.GoeasyMessage;
import com.ruoyi.message.frequency.goeasymessage.service.GoeasyMessageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * goeasy消息Controller
 * 
 * @author liwenlong
 * @date 2024-04-17
 */
@RestController
@RequestMapping("/frequency/goeasymessage")
public class GoeasyMessageController extends BaseController
{
    @Autowired
    private GoeasyMessageService goeasyMessageService;

    /**
     * 查询goeasy消息列表
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:list')")
    @PostMapping("/list")
    public TableDataInfo<GoeasyMessage> list(@RequestBody GoeasyMessage goeasyMessage)
    {
        startPage();
        List<GoeasyMessage> list = goeasyMessageService.selectGoeasyMessageList(goeasyMessage);
        return getDataTable(list);
    }

    /**
     * 导出goeasy消息列表
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:export')")
    @Log(title = "goeasy消息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GoeasyMessage goeasyMessage)
    {
        List<GoeasyMessage> list = goeasyMessageService.selectGoeasyMessageList(goeasyMessage);
        ExcelUtil<GoeasyMessage> util = new ExcelUtil<GoeasyMessage>(GoeasyMessage.class);
        return util.exportExcel(list, "goeasy消息数据");
    }

    /**
     * 获取goeasy消息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult<GoeasyMessage> getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(goeasyMessageService.selectGoeasyMessageById(id));
    }

    /**
     * 新增goeasy消息
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:add')")
    @Log(title = "goeasy消息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GoeasyMessage goeasyMessage)
    {
        return toAjax(goeasyMessageService.insertGoeasyMessage(goeasyMessage));
    }

    /**
     * 修改goeasy消息
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:edit')")
    @Log(title = "goeasy消息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GoeasyMessage goeasyMessage)
    {
        return toAjax(goeasyMessageService.updateGoeasyMessage(goeasyMessage));
    }

    /**
     * 删除goeasy消息
     */
    //@PreAuthorize("@ss.hasPermi('frequency:goeasymessage:remove')")
    @Log(title = "goeasy消息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}/{delFlag}")
    public AjaxResult remove(@PathVariable("ids") Long[] ids,@PathVariable("delFlag") Integer delFlag)
    {
        return toAjax(goeasyMessageService.deleteGoeasyMessageByIds(ids,delFlag));
    }
}
