| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 客户档案Controller |
| | |
| | | * 查询客户档案列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(Customer customer) { |
| | | startPage(); |
| | | List<Customer> list = customerService.selectCustomerList(customer); |
| | | return getDataTable(list); |
| | | public IPage<Customer> list(Page page, Customer customer) { |
| | | return customerService.selectCustomerList(page, customer); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (ids != null && ids.length > 0) { |
| | | list = customerService.selectCustomerListByIds(ids); |
| | | } else { |
| | | |
| | | list = customerService.selectCustomerList(customer); |
| | | list = customerService.selectCustomerLists(customer); |
| | | } |
| | | ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class); |
| | | util.exportExcel(response, list, "客户档案数据"); |
| | |
| | | * 修改客户档案 |
| | | */ |
| | | @Log(title = "客户档案", businessType = BusinessType.UPDATE) |
| | | @PutMapping ("/updateCustomer") |
| | | @PostMapping("/updateCustomer") |
| | | public AjaxResult edit(@RequestBody Customer customer) { |
| | | return toAjax(customerService.updateCustomer(customer)); |
| | | } |
| | |
| | | * 删除客户档案 |
| | | */ |
| | | @Log(title = "客户档案", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | @DeleteMapping("/delCustomer") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | } |
| | | return toAjax(customerService.deleteCustomerByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 查询客户 |
| | | */ |
| | | @GetMapping("/customerList") |
| | | public List customerList(Customer customer) { |
| | | return customerService.customerList(customer); |
| | | } |
| | | } |