diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java index 0fd52d2..740abdc 100644 --- a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java @@ -15,13 +15,7 @@ import com.lframework.xingyun.basedata.entity.ProductRetail; import com.lframework.xingyun.basedata.entity.ProductSale; import com.lframework.xingyun.basedata.enums.ColumnType; import com.lframework.xingyun.basedata.enums.ProductType; -import com.lframework.xingyun.basedata.service.product.ProductBrandService; -import com.lframework.xingyun.basedata.service.product.ProductBundleService; -import com.lframework.xingyun.basedata.service.product.ProductCategoryService; -import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; -import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; -import com.lframework.xingyun.basedata.service.product.ProductRetailService; -import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import com.lframework.xingyun.basedata.service.product.*; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; @@ -171,6 +165,12 @@ public class GetProductBo extends BaseBo { @ApiModelProperty("属性") private List properties; + /** + * 库存 + */ + @ApiModelProperty("库存") + private BigDecimal stock; + public GetProductBo() { } @@ -242,6 +242,8 @@ public class GetProductBo extends BaseBo { } } } + ProductService productService = ApplicationUtil.getBean(ProductService.class); + this.stock = productService.getStock(dto.getId()); } @Data diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java index 9e9d70a..fb57e46 100644 --- a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java @@ -103,7 +103,7 @@ public class QueryProductBo extends BaseBo { * 库存 */ @ApiModelProperty("库存") - private Integer stock; + private BigDecimal stock; public QueryProductBo() { diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java index 24d4efb..51754d6 100644 --- a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java @@ -545,9 +545,9 @@ public class ProductServiceImpl extends BaseMpServiceImpl { * @param productId * @return */ - Integer getStock(@Param("productId") String productId); + BigDecimal getStock(@Param("productId") String productId); } diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java index e08986b..826bbda 100644 --- a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java @@ -7,6 +7,8 @@ import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; + +import java.math.BigDecimal; import java.util.Collection; import java.util.List; @@ -117,5 +119,5 @@ public interface ProductService extends BaseMpService { * @param id * @return */ - Integer getStock(String id); + BigDecimal getStock(String id); } diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml index a72166b..e308a2e 100644 --- a/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml @@ -163,7 +163,7 @@ ORDER BY g.code - SELECT SUM(stock_num) FROM tbl_product_stock WHERE product_id = #{productId}