Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-04 15:48:11 +08:00
10 changed files with 79 additions and 22 deletions

View File

@@ -54,7 +54,18 @@ public class ShopStorageServiceImpl extends ServiceImpl<ShopStorageMapper, ShopS
queryWrapper.eq(ShopStorage::getPhone, phone);
}
queryWrapper.orderBy(ShopStorage::getId, false);
return page(PageUtil.buildPage(), queryWrapper);
Page<ShopStorage> shopStoragePage = page(PageUtil.buildPage(), queryWrapper);
shopStoragePage.getRecords().forEach(item -> {
if (item.getNum() == 0) {
item.setStatus(0);
}
if (item.getExpTime().isBefore(DateUtil.date().toLocalDateTime())) {
item.setStatus(2);
}
});
updateBatch(shopStoragePage.getRecords());
return shopStoragePage;
}
@Override
@@ -104,9 +115,13 @@ public class ShopStorageServiceImpl extends ServiceImpl<ShopStorageMapper, ShopS
}
shopStorage.setNum(shopStorage.getNum() + shopStorageEditDTO.getNum());
if (shopStorage.getNum() == 0) {
shopStorage.setStatus(0);
}
boolean b = updateById(shopStorage);
if (b) {
ShopStorageRecord record = new ShopStorageRecord();
record.setStorageId(shopStorage.getId());
record.setTime(DateUtil.date().toLocalDateTime());