| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria; |
| | | import com.oying.modules.pc.product.domain.enums.ProductStatusEnum; |
| | | import com.oying.modules.pc.product.service.ProductImageService; |
| | | import com.oying.modules.pc.product.service.ProductLabelService; |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | criteria.setCategoryId(categoryId); |
| | | criteria.setSecondCategoryId(secondCategoryId); |
| | | criteria.setBlurry(blurry); |
| | | criteria.setShelfStatus(ProductStatusEnum.AVAILABLE.getValue()); |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | PageResult<Product> productPageResult = productService.queryAll(criteria, page); |
| | | |
| | |
| | | PageResult<ProductCustomerView> viewPageResult = new PageResult<>( |
| | | productList.stream().map(i -> { |
| | | ProductCustomerView view = new ProductCustomerView(); |
| | | BeanUtils.copyProperties(i, view); |
| | | BeanUtil.copyProperties(i, view); |
| | | return view; |
| | | }).collect(Collectors.toList()), |
| | | productPageResult.getTotalElements()); |
| | |
| | | /*@PreAuthorize("@el.check('merchant:product:byProductId')")*/ |
| | | public ResponseEntity<?> getProductDetails(@PathVariable Long productId) { |
| | | Product product = productService.getById(productId); |
| | | if (ObjUtil.isEmpty(product)) { |
| | | return ResponseEntity.ok(R.success()); |
| | | } |
| | | ProductCustomerView customerView = new ProductCustomerView(); |
| | | BeanUtil.copyProperties(product, customerView); |
| | | if (ObjUtil.isNotEmpty(product)) { |
| | | customerView.setImages(productImageService.queryImagesByProductId(productId).stream().map(i -> { |
| | | ProductImageCustomerView imageCustomerView = new ProductImageCustomerView(); |