新版
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -45,23 +47,17 @@ public class UserEbookBuyServiceImpl extends ServiceImpl<UserEbookBuyDao, UserEb
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addBookForUser(Integer userId, List<Integer> bookIds) {
|
||||
for (Integer i:bookIds){
|
||||
List<UserEbookBuyEntity> userEbookBuyEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<UserEbookBuyEntity>().eq(UserEbookBuyEntity::getUserId, userId).eq(UserEbookBuyEntity::getBookId, i));
|
||||
if(userEbookBuyEntities.size()==0){
|
||||
UserEbookBuyEntity userEbookBuyEntity = new UserEbookBuyEntity();
|
||||
userEbookBuyEntity.setUserId(userId);
|
||||
userEbookBuyEntity.setBookId(i);
|
||||
userEbookBuyEntity.setPayTime(new Date());
|
||||
this.save(userEbookBuyEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user