package com.dsk.biz.controller;

import com.dsk.biz.domain.CustomerFollowRecord;
import com.dsk.biz.domain.bo.CustomerFollowRecordSearchDto;
import com.dsk.biz.domain.vo.CustomerFollowRecordListVo;
import com.dsk.biz.service.ICustomerFollowRecordService;
import com.dsk.common.annotation.RepeatSubmit;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
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<CustomerFollowRecordListVo> selectPageList(CustomerFollowRecordSearchDto dto, PageQuery pageQuery){
        return baseService.selectList(dto, pageQuery);
    }

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

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

}
