package com.ruoyi.ibs.custmap.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ibs.custmap.domain.dto.CustMapSearchDTO;
import com.ruoyi.ibs.custmap.service.CustMapSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Author 吴凯程
 * @Date 2025/6/23
 **/
@Api(tags = "地图拓客-我的模板接口")
@RestController
@RequestMapping("/cust/map/search/template")
public class CustMapSearchController {

    @Resource
    private CustMapSearchService custMapSearchService;

    @ApiOperation("保存查询模板")
    @PostMapping("/save")
    public AjaxResult saveCustMapSearchTemplate(@RequestBody @Valid CustMapSearchDTO custMapSearchDTO)
    {
        return AjaxResult.success(custMapSearchService.saveCustMapSearchTemplate(custMapSearchDTO));
    }

    @ApiOperation("获取查询模板")
    @GetMapping("/get")
    public AjaxResult getCustMapSearchTemplate()
    {
        return AjaxResult.success(custMapSearchService.getCustMapSearchTemplate());
    }

    @ApiOperation("删除查询模板")
    @PostMapping("/delete")
    public AjaxResult deleteCustMapSearchTemplate(@RequestParam String templateId) {
        return AjaxResult.success(custMapSearchService.deleteCustMapSearchTemplate(templateId));
    }
}
