feat(product): 查询产品时增加销售价和库存信息

- 在 QueryProductBo 中添加销售价和库存字段
- 实现 ProductService 中的 getStock 方法
- 在 ProductMapper 中添加 getStock 接口- 更新 ProductMapper.xml,添加库存查询 SQL
- 移除客户和供应商相关代码中的助记码字段
- 调整销售订单、采购订单等中的审批人和抄送人 ID
- 新增 YdoolPersonIds 枚举类,用于定义审批人和抄送人 ID
This commit is contained in:
lijiaqi 2024-11-19 15:53:14 +08:00
parent 00c1db8105
commit 1fe802ca6f
6 changed files with 19 additions and 14 deletions

View File

@ -15,13 +15,7 @@ import com.lframework.xingyun.basedata.entity.ProductRetail;
import com.lframework.xingyun.basedata.entity.ProductSale; import com.lframework.xingyun.basedata.entity.ProductSale;
import com.lframework.xingyun.basedata.enums.ColumnType; import com.lframework.xingyun.basedata.enums.ColumnType;
import com.lframework.xingyun.basedata.enums.ProductType; import com.lframework.xingyun.basedata.enums.ProductType;
import com.lframework.xingyun.basedata.service.product.ProductBrandService; import com.lframework.xingyun.basedata.service.product.*;
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 io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
@ -171,6 +165,12 @@ public class GetProductBo extends BaseBo<Product> {
@ApiModelProperty("属性") @ApiModelProperty("属性")
private List<PropertyBo> properties; private List<PropertyBo> properties;
/**
* 库存
*/
@ApiModelProperty("库存")
private BigDecimal stock;
public GetProductBo() { public GetProductBo() {
} }
@ -242,6 +242,8 @@ public class GetProductBo extends BaseBo<Product> {
} }
} }
} }
ProductService productService = ApplicationUtil.getBean(ProductService.class);
this.stock = productService.getStock(dto.getId());
} }
@Data @Data

View File

@ -103,7 +103,7 @@ public class QueryProductBo extends BaseBo<Product> {
* 库存 * 库存
*/ */
@ApiModelProperty("库存") @ApiModelProperty("库存")
private Integer stock; private BigDecimal stock;
public QueryProductBo() { public QueryProductBo() {

View File

@ -545,9 +545,9 @@ public class ProductServiceImpl extends BaseMpServiceImpl<ProductMapper, Product
} }
@Override @Override
public Integer getStock(String id) { public BigDecimal getStock(String id) {
Integer stock = this.getBaseMapper().getStock(id); BigDecimal stock = this.getBaseMapper().getStock(id);
return ObjectUtil.isNull(stock) ? 0 : stock; return ObjectUtil.isNull(stock) ? BigDecimal.valueOf(0) : stock;
} }
@CacheEvict(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") @CacheEvict(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")

View File

@ -11,6 +11,7 @@ import com.lframework.xingyun.template.core.annotations.sort.Sorts;
import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -111,5 +112,5 @@ public interface ProductMapper extends BaseMapper<Product> {
* @param productId * @param productId
* @return * @return
*/ */
Integer getStock(@Param("productId") String productId); BigDecimal getStock(@Param("productId") String productId);
} }

View File

@ -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.QueryProductSelectorVo;
import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo;
import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo;
import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -117,5 +119,5 @@ public interface ProductService extends BaseMpService<Product> {
* @param id * @param id
* @return * @return
*/ */
Integer getStock(String id); BigDecimal getStock(String id);
} }

View File

@ -163,7 +163,7 @@
</where> </where>
ORDER BY g.code ORDER BY g.code
</select> </select>
<select id="getStock" resultType="java.lang.Integer"> <select id="getStock" resultType="java.math.BigDecimal">
SELECT SUM(stock_num) FROM tbl_product_stock WHERE product_id = #{productId} SELECT SUM(stock_num) FROM tbl_product_stock WHERE product_id = #{productId}
</select> </select>