package com.fjhx.controller.customer;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.customer.CustomerLink;
import com.fjhx.params.customer.CustomerLinkVo;
import com.fjhx.service.customer.CustomerLinkService;
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.Map;

/**
 * <p>
 * 客户联系人 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-10-25
 */
@RestController
@RequestMapping("/customerLink")
public class CustomerLinkController {

    @Autowired
    private CustomerLinkService customerLinkService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition){
        Page<CustomerLink> result = customerLinkService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody CustomerLinkVo customerLinkVo){
        customerLinkService.add(customerLinkVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody CustomerLinkVo customerLinkVo){
        customerLinkService.edit(customerLinkVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody CustomerLinkVo customerLinkVo){
        customerLinkService.delete(customerLinkVo);
        return R.success();
    }

}

