fix: 修复用户信息查询和订单查询的问题

1. 在QyUserApplicationService中添加对ab98UserId为null的判断,避免空指针异常
2. 在ShopGoodsMapper的SQL查询中增加goods_detail和usage_instruction字段
3. 在SearchShopOrderQuery中添加goodsId查询条件,支持按商品ID筛选订单
This commit is contained in:
dzq 2025-06-03 17:34:00 +08:00
parent 4cdabe3db3
commit 695e70e7a5
3 changed files with 9 additions and 3 deletions

View File

@ -63,8 +63,12 @@ public class QyUserApplicationService {
dto.setRoleName(sysRole.getRoleName());
}
}
Ab98UserEntity ab98User = ab98UserService.getById(user.getAb98UserId());
dto.setOpenid(ab98User.getOpenid());
if (user.getAb98UserId() != null) {
Ab98UserEntity ab98User = ab98UserService.getById(user.getAb98UserId());
if (ab98User != null) {
dto.setOpenid(ab98User.getOpenid());
}
}
return dto;
}

View File

@ -85,7 +85,7 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetListByShopId(@Param("shopId")Long shopId);
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
"g.stock, g.status, g.auto_approval, g.cover_img, SUM(cc.stock) AS total_stock, " +
"g.stock, g.status, g.auto_approval, g.cover_img, g.goods_detail, g.usage_instruction, SUM(cc.stock) AS total_stock, " +
"GROUP_CONCAT(DISTINCT cc.cell_no) AS cell_no_str, " +
"GROUP_CONCAT(DISTINCT sc.cabinet_name) AS cabinet_name " +
"FROM shop_goods g " +

View File

@ -18,6 +18,7 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
private String userid;
private Long cellId;
private Long cabinetId;
private Long goodsId;
private Integer status;
private Integer payStatus;
private Date startTime;
@ -39,6 +40,7 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
.or()
.eq("o.userid", StringUtils.trim(userid)))
.eq(cabinetId != null, "cc.cabinet_id", cabinetId)
.eq(goodsId!= null, "og.goods_id", goodsId)
.eq(status != null, "o.status", status)
.eq(payStatus != null, "o.pay_status", payStatus)
.eq(StrUtil.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod)