package com.easyproject.web.controller.operate;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.easyproject.service.domain.operate.OperateMindReader;
import com.easyproject.system.service.operate.IOperateMindReaderService;
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.easyproject.common.annotation.Log;
import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.common.enums.BusinessType;
import com.easyproject.common.core.page.TableDataInfo;

/**
 * 猜你所想Controller
 *
 * @author easyproject
 * @date 2025-03-19
 */
@RestController
@RequestMapping("/system/mindReader")
public class OperateMindReaderController extends BaseController {
    @Autowired
    private IOperateMindReaderService operateMindReaderService;

    /**
     * 查询猜你所想列表
     */
    @PreAuthorize("@ss.hasPermi('system:mindReader:list')")
    @GetMapping("/list")
    public TableDataInfo list(OperateMindReader operateMindReader) {
        startPage();
        List<OperateMindReader> list = operateMindReaderService.selectOperateMindReaderList(operateMindReader);
        return getDataTable(list);
    }

    /**
     * 获取猜你所想详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:mindReader:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(operateMindReaderService.selectOperateMindReaderById(id));
    }

    /**
     * 新增猜你所想
     */
    @PreAuthorize("@ss.hasPermi('system:mindReader:add')")
    @Log(title = "猜你所想", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OperateMindReader operateMindReader) {
        return toAjax(operateMindReaderService.insertOperateMindReader(operateMindReader));
    }

    /**
     * 修改猜你所想
     */
    @PreAuthorize("@ss.hasPermi('system:mindReader:edit')")
    @Log(title = "猜你所想", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OperateMindReader operateMindReader) {
        return toAjax(operateMindReaderService.updateOperateMindReader(operateMindReader));
    }

    /**
     * 删除猜你所想
     */
    @PreAuthorize("@ss.hasPermi('system:mindReader:remove')")
    @Log(title = "猜你所想", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(operateMindReaderService.deleteOperateMindReaderByIds(ids));
    }
}
