| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | |
| | | |
| | | // 类型匹配 todo |
| | | if (goodQuery.getType() != null && goodQuery.getType().size() > 0) { |
| | | for (String s : goodQuery.getType()) { |
| | | wrapper.apply("FIND_IN_SET('" + s + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | for (int i = 0; i < goodQuery.getType().size(); i++) { |
| | | // if (i == 0){ |
| | | // wrapper.apply("FIND_IN_SET('" + goodQuery.getType().get(i) + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | // }else{ |
| | | wrapper.or().apply("FIND_IN_SET('" + goodQuery.getType().get(i) + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | // } |
| | | } |
| | | } |
| | | wrapper.eq("isDelete", 0); |
| | |
| | | wrapper = keywords != null && !"".equals(keywords.trim()) ? wrapper.like("name", keywords) : wrapper; |
| | | // 类型匹配 todo |
| | | if (goodQuery.getType() != null && goodQuery.getType().size() > 0) { |
| | | for (String s : goodQuery.getType()) { |
| | | wrapper.apply("FIND_IN_SET('" + s + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | for (int i = 0; i < goodQuery.getType().size(); i++) { |
| | | if (i == 0){ |
| | | wrapper.apply("FIND_IN_SET('" + goodQuery.getType().get(i) + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | }else{ |
| | | wrapper.or().apply("FIND_IN_SET('" + goodQuery.getType().get(i) + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | } |
| | | } |
| | | } |
| | | wrapper.eq("isDelete", 0); |
| | | // sort排序 |
| | | wrapper.orderByAsc("CASE WHEN sort IS NULL THEN 1 ELSE 0 END") |
| | | .orderByAsc("sort") |
| | | .orderByDesc("sort") |
| | | .orderByDesc("createTime"); |
| | | return R.ok(goodsService.page(new PageInfo<>(goodQuery.getPageNumber(), goodQuery.getPageSize()), wrapper)); |
| | | } |
| | |
| | | if (!Constants.ONE.equals(order.getState())) { |
| | | throw new GlobalException("订单已发货,无法修改收货地址!"); |
| | | } |
| | | order.setConsigneeName(recipient.getAddress()); |
| | | order.setConsigneeName(recipient.getRecipient()); |
| | | order.setConsigneePhone(recipient.getRecipientPhone()); |
| | | order.setConsigneeAddress(recipient.getProvince()+recipient.getCity()+recipient.getAddress()); |
| | | orderService.updateById(order); |
| | |
| | | if (!Constants.ONE.equals(order.getState())) { |
| | | throw new GlobalException("订单已发货,无法修改收货地址!"); |
| | | } |
| | | order.setConsigneeName(recipient.getAddress()); |
| | | order.setConsigneeName(recipient.getRecipient()); |
| | | order.setConsigneePhone(recipient.getRecipientPhone()); |
| | | order.setConsigneeAddress(recipient.getProvince()+recipient.getCity()+recipient.getAddress()); |
| | | orderService.updateById(order); |