| | |
| | | wrapper.like(StrUtil.isNotEmpty(product.getProductName()),Product::getProductName,product.getProductName()); |
| | | wrapper.like(StrUtil.isNotEmpty(product.getMainCode()),Product::getMainCode,product.getMainCode()); |
| | | wrapper.like(StrUtil.isNotEmpty(product.getErpCode()),Product::getErpCode,product.getErpCode()); |
| | | return R.ok(productService.page(page, wrapper)); |
| | | wrapper.orderByDesc(Product::getCreateTime); |
| | | Page<Product> page1 = productService.pageByScope(page, wrapper); |
| | | List<Product> list = page1.getRecords(); |
| | | for(Product product1 : list){ |
| | | Product parent = productService.getById(product1.getParentId()); |
| | | if(parent==null){ |
| | | product1.setParentName("根级产品"); |
| | | }else { |
| | | product1.setParentName(parent.getProductName()); |
| | | } |
| | | } |
| | | page1.setRecords(list); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PreAuthorize("@pms.hasPermission('business_product_view')" ) |
| | | @Inner(value = false) |
| | | public R getProductList(@ParameterObject Product product) { |
| | | return R.ok(productService.getProductList(product)); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param product 产品信息 |
| | | * @return |
| | | */ |
| | | @Operation(summary = "分页查询" , description = "分页查询" ) |
| | | @GetMapping("/listByParentId" ) |
| | | @PreAuthorize("@pms.hasPermission('business_product_view')" ) |
| | | //@Inner(value = false) |
| | | public R getProductListByParentId(@ParameterObject Product product) { |
| | | LambdaQueryWrapper<Product> wrapper = Wrappers.lambdaQuery(); |
| | | return R.ok(productService.list(wrapper)); |
| | | wrapper.like(StrUtil.isNotEmpty(product.getProductName()),Product::getProductName,product.getProductName()); |
| | | wrapper.eq(product.getParentId()!=null,Product::getParentId,product.getParentId()); |
| | | wrapper.last("limit 30"); |
| | | return R.ok(productService.listByScope(wrapper)); |
| | | } |
| | | |
| | | /** |