package com.dsk.web.controller.customer;

import com.dsk.common.annotation.RepeatSubmit;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerFollowRecordService;
import com.dsk.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 客户跟进记录相关
 *
 * @author lcl
 * @create 2023/5/18
 */
@RestController
@RequestMapping("/customer/follow/record")
public class CustomerFollowRecordController extends BaseController {

    @Autowired
    private ICustomerFollowRecordService baseService;

    /**
     * 查询客户跟进记录列表
     */
//    @PreAuthorize("@ss.hasPermi('customer:follow:record:list')")
    @GetMapping("/list")
    public TableDataInfo selectPageList(CustomerFollowRecordSearchDto dto){
        startPage();
        return getDataTable(baseService.selectList(dto));
    }

    /**
     * 添加客户跟进记录
     */
//    @PreAuthorize("@ss.hasPermi('customer:follow:record:add')")
    @PostMapping()
    @RepeatSubmit
    public AjaxResult add(@RequestBody CustomerFollowRecord followRecord){
        return AjaxResult.success(baseService.add(followRecord));
    }

    /**
     * 删除客户跟进记录
     */
//    @PreAuthorize("@ss.hasPermi('customer:follow:record:del')")
    @DeleteMapping("/{id}")
    @RepeatSubmit
    public AjaxResult del(@PathVariable("id") Long id){
        return AjaxResult.success(baseService.del(id));
    }

}
