|  |  |  | 
|---|
|  |  |  | baseCategory2.setShortPinyin(baseCategory.getShortPinyin()); | 
|---|
|  |  |  | baseCategoryMapper.insert(baseCategory2); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | long count = baseCategory.getBaseCategoryRequestParamList().stream().map(s -> s.getName().trim()).distinct().count(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateById(BaseCategoryRequest baseCategory) { | 
|---|
|  |  |  | public void update(BaseCategoryRequest baseCategory) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Objects.nonNull(baseCategory.getId())){ | 
|---|
|  |  |  | if (Objects.isNull(baseCategory.getId())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"品类主键缺失"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | .set(BaseCategory::getName,baseCategory.getName()) | 
|---|
|  |  |  | .set(BaseCategory::getImgurl,baseCategory.getImgurl()) | 
|---|
|  |  |  | .set(BaseCategory::getSortnum,baseCategory.getSortnum()); | 
|---|
|  |  |  | baseCategoryMapper.update(null,wrapper); | 
|---|
|  |  |  | baseCategoryMapper.update(null,updateWrapper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | long count = baseCategory.getBaseCategoryRequestParamList().stream().map(s -> s.getName().trim()).distinct().count(); | 
|---|
|  |  |  | if (baseCategory.getBaseCategoryRequestParamList().size() != count){ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | IPage<BaseCategory> baseCategoryIPage = baseCategoryMapper.selectPage(page, queryWrapper); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(baseCategoryIPage.getRecords())){ | 
|---|
|  |  |  | baseCategoryIPage.getRecords().forEach(s->s.setImgfullurl(getPreUrl()+s.getImgfullurl())); | 
|---|
|  |  |  | baseCategoryIPage.getRecords().forEach(s->s.setImgfullurl(getPreUrl()+s.getImgurl())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return PageData.from(baseCategoryIPage); | 
|---|