Commit 0a7fa72b3a202f61989450a05968735deb190b68
1 parent
91f37e75
fix(product): 修复@Select查询JSON字段无法解析的问题
Showing
1 changed file
with
3 additions
and
1 deletions
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
| ... | ... | @@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.type.IntegerListTypeHandler; | |
| 7 | 8 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; |
| 8 | 9 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 9 | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| ... | ... | @@ -21,11 +22,12 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * 查询商品 SPU(包含已删除) |
| 24 | - * 注意:使用 @Results 手动指定 typeHandler,否则 @Select 不会应用 autoResultMap,sliderPicUrls 字段无法解析 JSON | |
| 25 | + * 注意:使用 @Results 手动指定 typeHandler,否则 @Select 不会应用 autoResultMap,sliderPicUrls,deliveryTypes 字段无法解析 JSON | |
| 25 | 26 | */ |
| 26 | 27 | @Select("SELECT * FROM product_spu WHERE id = #{id}") |
| 27 | 28 | @Results({ |
| 28 | 29 | @Result(column = "slider_pic_urls", property = "sliderPicUrls", typeHandler = JacksonTypeHandler.class), |
| 30 | + @Result(column = "delivery_types", property = "deliveryTypes", typeHandler = IntegerListTypeHandler.class), | |
| 29 | 31 | }) |
| 30 | 32 | ProductSpuDO selectByIdIncludeDeleted(@Param("id") Long id); |
| 31 | 33 | ... | ... |