use of cn.lili.modules.member.entity.dos.StoreCollection in project lilishop by lilishop.
the class StoreCollectionServiceImpl method deleteStoreCollection.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteStoreCollection(String storeId) {
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper();
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
queryWrapper.eq("store_id", storeId);
storeService.updateStoreCollectionNum(new CollectionDTO(storeId, -1));
return this.remove(queryWrapper);
}
use of cn.lili.modules.member.entity.dos.StoreCollection in project lilishop by lilishop.
the class StoreCollectionServiceImpl method addStoreCollection.
@Override
@Transactional(rollbackFor = Exception.class)
public StoreCollection addStoreCollection(String storeId) {
if (this.getOne(new LambdaUpdateWrapper<StoreCollection>().eq(StoreCollection::getMemberId, UserContext.getCurrentUser().getId()).eq(StoreCollection::getStoreId, storeId)) == null) {
StoreCollection storeCollection = new StoreCollection(UserContext.getCurrentUser().getId(), storeId);
this.save(storeCollection);
storeService.updateStoreCollectionNum(new CollectionDTO(storeId, 1));
return storeCollection;
}
throw new ServiceException(ResultCode.USER_COLLECTION_EXIST);
}
Aggregations