package com.cmvr.web.controller.aima;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.cmvr.common.annotation.Log;
import com.cmvr.common.core.controller.BaseController;
import com.cmvr.common.core.domain.AjaxResult;
import com.cmvr.common.enums.BusinessType;
import com.cmvr.aima.domain.AimaPhone;
import com.cmvr.aima.service.IAimaPhoneService;
import com.cmvr.common.utils.poi.ExcelUtil;
import com.cmvr.common.core.page.TableDataInfo;

/**
 * 爱玛手机管理Controller
 * 
 * @author cmvr-iot
 * @since 2026-06-22
 */
@RestController
@RequestMapping("/aima/phone")
@Api(tags = "爱玛电动车--手机管理")
public class AimaPhoneController extends BaseController
{
    @Autowired
    private IAimaPhoneService aimaPhoneService;

    /**
     * 查询爱玛手机管理列表
     */
    @ApiOperation("查询爱玛手机管理列表")
    @PreAuthorize("@ss.hasPermi('aima:phone:list')")
    @GetMapping("/list")
    public TableDataInfo list(AimaPhone aimaPhone)
    {
        startPage();
        List<AimaPhone> list = aimaPhoneService.selectAimaPhoneList(aimaPhone);
        return getDataTable(list);
    }

    /**
     * 导出爱玛手机管理列表
     */
    @ApiOperation("导出爱玛手机管理列表")
    @PreAuthorize("@ss.hasPermi('aima:phone:export')")
    @Log(title = "爱玛手机管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AimaPhone aimaPhone)
    {
        List<AimaPhone> list = aimaPhoneService.selectAimaPhoneList(aimaPhone);
        ExcelUtil<AimaPhone> util = new ExcelUtil<>(AimaPhone.class);
        util.exportExcel(response, list, "爱玛手机管理数据");
    }

    /**
     * 获取爱玛手机管理详细信息
     */
    @ApiOperation("获取爱玛手机管理详细信息")
    @PreAuthorize("@ss.hasPermi('aima:phone:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(aimaPhoneService.selectAimaPhoneById(id));
    }

    /**
     * 新增爱玛手机管理
     */
    @ApiOperation("新增爱玛手机管理")
    @PreAuthorize("@ss.hasPermi('aima:phone:add')")
    @Log(title = "爱玛手机管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AimaPhone aimaPhone)
    {
        return toAjax(aimaPhoneService.insertAimaPhone(aimaPhone));
    }

    /**
     * 修改爱玛手机管理
     */
    @ApiOperation("修改爱玛手机管理")
    @PreAuthorize("@ss.hasPermi('aima:phone:edit')")
    @Log(title = "爱玛手机管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AimaPhone aimaPhone)
    {
        return toAjax(aimaPhoneService.updateAimaPhone(aimaPhone));
    }

    /**
     * 删除爱玛手机管理
     */
    @ApiOperation("删除爱玛手机管理")
    @PreAuthorize("@ss.hasPermi('aima:phone:remove')")
    @Log(title = "爱玛手机管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(aimaPhoneService.deleteAimaPhoneByIds(ids));
    }
}
