修复更新上架,排序问题
This commit is contained in:
1 parent
36a6e96c58
commit
1bb89a854e
2 files changed
+17
-1
No files matched your search
+9
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.product.controller.admin.device.vo.DeviceProductS
|
||||
import cn.iocoder.yudao.module.product.controller.admin.device.vo.DeviceProductSpuPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.device.vo.DeviceProductSpuRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.device.vo.DeviceProductSpuSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuCreatorDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
@@ -71,6 +72,14 @@ public class DeviceProductSpuController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新售货机商品 SPU 状态(上架/下架)")
|
||||
@PreAuthorize("@ss.hasPermission('product:spu:update')")
|
||||
public CommonResult<Boolean> updateDeviceProductSpuStatus(@Valid @RequestBody ProductSpuUpdateStatusReqVO updateReqVO) {
|
||||
productSpuService.updateSpuStatus(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除售货机商品 SPU")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
+8
-1
@@ -109,7 +109,14 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
|
||||
query.orderBy(true, pageReqVO.getSortAsc(), ProductSpuDO::getCreateTime)
|
||||
.orderByDesc(ProductSpuDO::getSort).orderByDesc(ProductSpuDO::getId);
|
||||
} else {
|
||||
query.orderByDesc(ProductSpuDO::getSort).orderByDesc(ProductSpuDO::getId);
|
||||
// App 端售货机商品(传 deviceId)默认按最低价优先展示
|
||||
if (pageReqVO.getDeviceId() != null && !pageReqVO.getDeviceId().isEmpty()) {
|
||||
query.orderByAsc(ProductSpuDO::getPrice)
|
||||
.orderByDesc(ProductSpuDO::getSort)
|
||||
.orderByDesc(ProductSpuDO::getId);
|
||||
} else {
|
||||
query.orderByDesc(ProductSpuDO::getSort).orderByDesc(ProductSpuDO::getId);
|
||||
}
|
||||
}
|
||||
return selectPage(pageReqVO, query);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user