gongchunyi
6 天以前 c4397c52164a2a3a553ed726ed31012d4ba7ce25
src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -9,8 +9,10 @@
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@@ -31,7 +33,7 @@
     * 查询客户档案列表
     */
    @GetMapping("/list")
    public IPage<Customer> list(Page page, Customer customer) {
    public IPage<Customer> list(Page<Customer> page, Customer customer) {
        return customerService.selectCustomerList(page, customer);
    }
@@ -52,12 +54,30 @@
        util.exportExcel(response, list, "客户档案数据");
    }
    @PostMapping("/downloadTemplate")
    @Log(title = "客户档案-下载模板", businessType = BusinessType.EXPORT)
    public void downloadTemplate(HttpServletResponse response) {
        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
        util.importTemplateExcel(response, "客户档案模板");
    }
    /**
     * 导入客户档案
     */
    @Log(title = "客户档案", businessType = BusinessType.IMPORT)
    @PostMapping("/importData")
    public AjaxResult importData(MultipartFile file) throws Exception {
        return customerService.importData(file);
    }
    /**
     * 获取客户档案详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(customerService.selectCustomerById(id));
        return success(customerService.selectCustomerDetailById(id));
    }
    /**
@@ -97,4 +117,11 @@
    public List customerList(Customer customer) {
        return customerService.customerList(customer);
    }
    @GetMapping("/regions")
    @ApiOperation("获取客户地区")
    public AjaxResult getRegions() {
        List<String> regionsList = customerService.regionsList();
        return AjaxResult.success(regionsList);
    }
}