| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.exception.EntityExistException; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.exception.EntityNotFoundException; |
| | | import com.oying.modules.pc.common.ValueUpdate; |
| | | import com.oying.modules.pc.store.converter.StoreAssembler; |
| | |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.PageUtil; |
| | | import com.oying.utils.SecurityUtils; |
| | | import com.oying.utils.StringUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean create(StoreCreateRequest request) { |
| | | public Store create(StoreCreateRequest request) { |
| | | // 检查店铺名称是否存在 |
| | | if (this.existsStoreName(request.getStoreName())) { |
| | | throw new BadRequestException("店铺名称已存在"); |
| | | } |
| | | // 创建店铺 |
| | | Store store = StoreAssembler.to(request); |
| | | storeMapper.insert(store); |
| | | this.processQualificationCreate(store, request.getQualificationList()); |
| | | this.bindUser(store.getStoreId()); |
| | | return true; |
| | | return store; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean existsStoreName(String storeName) { |
| | | if (StringUtils.isEmpty(storeName)) { |
| | | return true; |
| | | } |
| | | LambdaQueryWrapper<Store> wrapper = new LambdaQueryWrapper<Store>() |
| | | .eq(Store::getStoreName, storeName); |
| | | return storeMapper.selectCount(wrapper) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean existsByIdAndMerchantId(Long storeId, Long merchantId) { |
| | | if (storeId == null || merchantId == null) { |
| | | return false; |