Compare commits

..

No commits in common. "87f259cd6f9580d0f02dc1806061a0eebb4081f8" and "a0f21fc32c272b7f088639961228f22fc4e75a43" have entirely different histories.

1 changed files with 8 additions and 12 deletions

View File

@ -166,19 +166,15 @@ public class MallProductController extends BaseController {
R<ModelProduct> modelProductR = modelService.selectModelById(id);
ModelProduct data = modelProductR.getData();
if (Objects.nonNull(data)) {
Long userIdMax = SecurityUtils.getUserIdMax();
if (userIdMax != 0){
LambdaQueryWrapper<ModelPurchaseRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelPurchaseRecord::getUserId, userIdMax)
.eq(ModelPurchaseRecord::getProductId, id)
.eq(ModelPurchaseRecord::getProductType, 0);
ModelPurchaseRecord modelPurchaseRecord = modelPurchaseRecordMapper.selectOne(wrapper);
data.setIsBuy(1);
if (Objects.isNull(modelPurchaseRecord)) {
data.setIsBuy(0);
}
LambdaQueryWrapper<ModelPurchaseRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelPurchaseRecord::getUserId, SecurityUtils.getUserId())
.eq(ModelPurchaseRecord::getProductId, id)
.eq(ModelPurchaseRecord::getProductType, 0);
ModelPurchaseRecord modelPurchaseRecord = modelPurchaseRecordMapper.selectOne(wrapper);
data.setIsBuy(1);
if (Objects.isNull(modelPurchaseRecord)) {
data.setIsBuy(0);
}
data.setIsBuy(0);
modelProductR.setData(data);
}
return modelProductR;