package com.fjhx.customer.controller.customer;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.customer.entity.customer.vo.CustomerUserVo;
import com.fjhx.customer.entity.customer.dto.CustomerUserSelectDto;
import com.fjhx.customer.entity.customer.dto.CustomerUserDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.customer.service.customer.CustomerUserService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>
 * 客户用户表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-04
 */
@RestController
@RequestMapping("/customerUser")
public class CustomerUserController {

    @Autowired
    private CustomerUserService customerUserService;

    /**
     * 客户用户表列表
     */
    @PostMapping("/list")
    public List<CustomerUserVo> list(@RequestBody CustomerUserSelectDto dto) {
        return customerUserService.getList(dto);
    }

    /**
     * 客户用户表分页
     */
    @PostMapping("/page")
    public Page<CustomerUserVo> page(@RequestBody CustomerUserSelectDto dto) {
        return customerUserService.getPage(dto);
    }

    /**
     * 客户用户表明细
     */
    @PostMapping("/detail")
    public CustomerUserVo detail(@RequestBody BaseSelectDto dto) {
        return customerUserService.detail(dto.getId());
    }

    /**
     * 客户用户表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody CustomerUserDto customerUserDto) {
        customerUserService.add(customerUserDto);
    }

    /**
     * 客户用户表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody CustomerUserDto customerUserDto) {
        customerUserService.edit(customerUserDto);
    }

    /**
     * 客户用户表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        customerUserService.delete(dto.getId());
    }

}
