| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获取供应商详情") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('srm:supplier:query')") |
| | | public CommonResult<SrmSupplierRespVO> getSupplier(@RequestParam("id") Long id) { |
| | | SrmSupplierDO supplier = supplierService.getSupplier(id); |
| | | return success(BeanUtils.toBean(supplier, SrmSupplierRespVO.class)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "供应商分页查询") |
| | | @PreAuthorize("@ss.hasPermission('srm:supplier:query')") |
| | | public CommonResult<PageResult<SrmSupplierRespVO>> getSupplierPage(@Valid SrmSupplierPageReqVO pageReqVO) { |
| | | PageResult<SrmSupplierDO> pageResult = supplierService.getSupplierPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, SrmSupplierRespVO.class)); |
| | |
| | | SrmSupplierExcelVO excelVO = BeanUtils.toBean(supplier, SrmSupplierExcelVO.class); |
| | | excelVO.setType(toTypeLabel(supplier.getType())); |
| | | excelVO.setStatus(toStatusLabel(supplier.getStatus())); |
| | | excelVO.setOnlineStatusLabel(toOnlineStatusLabel(supplier.getOnlineStatus())); |
| | | excelVO.setPurchaseCategoryLabel(toPurchaseCategoryLabel(supplier.getPurchaseCategory())); |
| | | excelList.add(excelVO); |
| | | } |
| | | ExcelUtils.write(response, "供应商数据.xlsx", "供应商", SrmSupplierExcelVO.class, excelList); |
| | |
| | | /** |
| | | * 状态 0 启用 / 1 禁用 -> 中文文案;空值返回空 |
| | | */ |
| | | private static String toPurchaseCategoryLabel(Integer purchaseCategory) { |
| | | if (purchaseCategory == null || purchaseCategory == 0) { |
| | | return "未分类"; |
| | | } |
| | | return purchaseCategory == 2 ? "原辅料" : "代理商品"; |
| | | } |
| | | |
| | | private static String toOnlineStatusLabel(Integer onlineStatus) { |
| | | if (onlineStatus == null) { |
| | | return "在线"; |
| | | } |
| | | return onlineStatus == 2 ? "离线" : "在线"; |
| | | } |
| | | |
| | | private static String toStatusLabel(Integer status) { |
| | | if (status == null) { |
| | | return null; |