Browse Source

fixed 商品价格为0前端不显示

fushengqian 1 year ago
parent
commit
a67fba9be7

+ 6 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -123,6 +123,12 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
                 lambdaQueryWrapper.lt(MtGoods::getStock, 1);
             }
         }
+        String hasPrice = paginationRequest.getSearchParams().get("hasPrice") == null ? "" : paginationRequest.getSearchParams().get("hasPrice").toString();
+        if (StringUtils.isNotBlank(hasPrice)) {
+            if (hasPrice.equals(YesOrNoEnum.YES.getKey())) {
+                lambdaQueryWrapper.gt(MtGoods::getPrice, 0);
+            }
+        }
         lambdaQueryWrapper.orderByAsc(MtGoods::getSort);
         List<MtGoods> goodsList = mtGoodsMapper.selectList(lambdaQueryWrapper);
         List<GoodsDto> dataList = new ArrayList<>();

+ 1 - 1
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientGoodsController.java

@@ -143,6 +143,7 @@ public class ClientGoodsController extends BaseController {
 
         Map<String, Object> searchParams = new HashMap<>();
         searchParams.put("status", StatusEnum.ENABLED.getKey());
+        searchParams.put("hasPrice", YesOrNoEnum.YES.getKey());
         if (storeId > 0) {
             searchParams.put("storeId", storeId.toString());
         }
@@ -158,7 +159,6 @@ public class ClientGoodsController extends BaseController {
         }
 
         paginationRequest.setSearchParams(searchParams);
-        paginationRequest.setSortColumn(new String[]{"sort asc", "id desc"});
         PaginationResponse<GoodsDto> paginationResponse = goodsService.queryGoodsListByPagination(paginationRequest);
 
         return getSuccessResult(paginationResponse);

+ 2 - 0
fuint-repository/src/main/resources/mapper/MtGoodsMapper.xml

@@ -7,6 +7,7 @@
             AND t.CATE_ID = #{cateId}
         </if>
         and t.MERCHANT_ID = #{merchantId}
+        and t.PRICE > 0
         and t.STATUS = 'A' order by t.sort asc
     </select>
 
@@ -18,6 +19,7 @@
         <if test="storeId != null and storeId > 0">
             and (t.STORE_ID = #{storeId} or t.STORE_ID = 0)
         </if>
+        and t.PRICE > 0
         and (t.name like concat('%',#{keyword},'%') or t.goods_no = #{keyword} or t.ID = #{keyword} or t.description like concat('%',#{keyword},'%'))
         order by t.sort asc
     </select>