Merge branch 'feature' of https://gitee.com/liuyingfang/cashier-admin into feature

This commit is contained in:
liuyingfang
2024-03-05 15:36:54 +08:00
8 changed files with 50 additions and 13 deletions

View File

@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.util.CollectionUtils;
import java.time.Instant;
import java.util.List;
@@ -77,16 +78,9 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
@Override
public List<TbProduct> findByIdProduct(Integer productGroup) {
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(productGroup).orElseGet(TbProductGroup::new);
if (tbProductGroup.getProductIds() != null){
List<String> list = ListUtil.stringChangeStringList(tbProductGroup.getProductIds());
List<Integer> intList = new ArrayList<>();
for (String str : list) {
intList.add(Integer.parseInt(str));
}
System.out.println(intList);
return tbProductRepository.findByIds(ListUtil.stringChangeIntegerList(list));
TbProductGroupDto dto = tbProductGroupMapper.toDto(tbProductGroup);
if (!CollectionUtils.isEmpty(dto.getProductIds())){
return tbProductRepository.findByIds(ListUtil.stringChangeIntegerList(dto.getProductIds()));
}
return new ArrayList<>();
}