package com.fjhx.customer.controller.customer;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsDto;
import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * 客户跟进记录 前端控制器
 * </p>
 *
 * @author
 * @since 2023-05-05
 */
@RestController
@RequestMapping("/customerFollowRecords")
public class CustomerFollowRecordsController {

    @Autowired
    private CustomerFollowRecordsService customerFollowRecordsService;

    /**
     * 客户跟进记录分页
     */
    @PostMapping("/page")
    public Page<CustomerFollowRecordsVo> page(@RequestBody CustomerFollowRecordsSelectDto dto) {
        return customerFollowRecordsService.getPage(dto);
    }

    /**
     * 客户跟进记录明细
     */
    @PostMapping("/detail")
    public CustomerFollowRecordsVo detail(@RequestBody BaseSelectDto dto) {
        return customerFollowRecordsService.detail(dto.getId());
    }

    /**
     * 客户跟进记录新增
     */
    @PostMapping("/add")
    public void add(@RequestBody CustomerFollowRecordsDto customerFollowRecordsDto) {
        customerFollowRecordsService.add(customerFollowRecordsDto);
    }

    /**
     * 客户跟进记录编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody CustomerFollowRecordsDto customerFollowRecordsDto) {
        customerFollowRecordsService.edit(customerFollowRecordsDto);
    }

    /**
     * 客户跟进记录删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        customerFollowRecordsService.delete(dto.getId());
    }

    /**
     * 跟进记录列表
     */
    @PostMapping("/followList")
    public List<CustomerFollowRecordsVo> followList(@RequestBody CustomerFollowRecordsSelectDto dto) {
        return customerFollowRecordsService.followList(dto.getCustomerId());
    }

}
