| package doumeemes.api.ext; | 
|   | 
| import doumeemes.api.BaseController; | 
| import doumeemes.core.annotation.excel.ExcelExporter; | 
| import doumeemes.core.annotation.pr.PreventRepeat; | 
| import doumeemes.core.model.ApiResponse; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.dao.business.model.Customer; | 
| import doumeemes.dao.ext.dto.QueryCustomerExtDTO; | 
| import doumeemes.dao.ext.vo.CustomerExtListVO; | 
| import doumeemes.service.business.CustomerService; | 
| import doumeemes.service.ext.CustomerExtService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 客户信息接口 | 
|  * @author 江蹄蹄 | 
|  * @date 2022/04/20 10:59 | 
|  */ | 
| @RestController | 
| @RequestMapping("/ext/customerExt") | 
| @Api(tags = "客户信息接口") | 
| public class CustomerExtController extends BaseController { | 
|   | 
|     @Autowired | 
|     private CustomerExtService customerExtService; | 
|      | 
|     @Autowired | 
|     private CustomerService customerService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("ext:customerext:create") | 
|     public ApiResponse create(@RequestBody Customer customer) { | 
|         return ApiResponse.success(customerService.create(customer)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("ext:customerext:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         customerService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除") | 
|     @GetMapping("/delete/batch") | 
|     @RequiresPermissions("ext:customerext:delete") | 
|     public ApiResponse deleteByIds(@RequestParam String ids) { | 
|         String [] idArray = ids.split(","); | 
|         List<Integer> idList = new ArrayList<>(); | 
|         for (String id : idArray) { | 
|             idList.add(Integer.valueOf(id)); | 
|         } | 
|         customerService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("根据ID修改") | 
|     @PostMapping("/updateById") | 
|     @RequiresPermissions("ext:customerext:update") | 
|     public ApiResponse updateById(@RequestBody Customer customer) { | 
|         customerService.updateById(customer); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @RequiresPermissions("ext:customerext:query") | 
|     public ApiResponse<PageData<CustomerExtListVO>> findPage (@RequestBody PageWrap<QueryCustomerExtDTO> pageWrap) { | 
|         return ApiResponse.success(customerExtService.findPage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     @RequiresPermissions("ext:customerext:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<QueryCustomerExtDTO> pageWrap, HttpServletResponse response) { | 
|         ExcelExporter.build(CustomerExtListVO.class).export(customerExtService.findPage(pageWrap).getRecords(), "客户信息", response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @RequiresPermissions("ext:customerext:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(customerService.findById(id)); | 
|     } | 
| } |