package com.ruoyi.mall.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.mall.domain.MallMemberExpect;
import com.ruoyi.mall.service.IMallMemberExpectService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 我的意愿学校记录Controller
 * 
 * @author ruoyi
 * @date 2023-11-03
 */
@RestController
@RequestMapping("/mall/mallMemberExpect")
public class MallMemberExpectController extends BaseController
{
    @Autowired
    private IMallMemberExpectService mallMemberExpectService;

    /**
     * 查询我的意愿学校记录列表
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:list')")
    @GetMapping("/list")
    public TableDataInfo list(MallMemberExpect mallMemberExpect)
    {
        startPage();
        List<MallMemberExpect> list = mallMemberExpectService.selectMallMemberExpectList(mallMemberExpect);
        return getDataTable(list);
    }

    /**
     * 导出我的意愿学校记录列表
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:export')")
    @Log(title = "我的意愿学校记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MallMemberExpect mallMemberExpect)
    {
        List<MallMemberExpect> list = mallMemberExpectService.selectMallMemberExpectList(mallMemberExpect);
        ExcelUtil<MallMemberExpect> util = new ExcelUtil<MallMemberExpect>(MallMemberExpect.class);
        util.exportExcel(response, list, "我的意愿学校记录数据");
    }

    /**
     * 获取我的意愿学校记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:query')")
    @GetMapping(value = "/{expectId}")
    public AjaxResult getInfo(@PathVariable("expectId") Long expectId)
    {
        return AjaxResult.success(mallMemberExpectService.selectMallMemberExpectByExpectId(expectId));
    }

    /**
     * 新增我的意愿学校记录
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:add')")
    @Log(title = "我的意愿学校记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MallMemberExpect mallMemberExpect)
    {
        return toAjax(mallMemberExpectService.insertMallMemberExpect(mallMemberExpect));
    }

    /**
     * 修改我的意愿学校记录
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:edit')")
    @Log(title = "我的意愿学校记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MallMemberExpect mallMemberExpect)
    {
        return toAjax(mallMemberExpectService.updateMallMemberExpect(mallMemberExpect));
    }

    /**
     * 删除我的意愿学校记录
     */
    @PreAuthorize("@ss.hasPermi('mall:mallMemberExpect:remove')")
    @Log(title = "我的意愿学校记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{expectIds}")
    public AjaxResult remove(@PathVariable Long[] expectIds)
    {
        return toAjax(mallMemberExpectService.deleteMallMemberExpectByExpectIds(expectIds));
    }
}
