1.change category attribution
This commit is contained in:
2025-11-13 16:22:04 +08:00
parent 547b9dde7c
commit 8bc426303a
3 changed files with 19 additions and 1 deletions

View File

@@ -103,7 +103,7 @@ public class PriceListController extends BladeController {
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入priceList") @Operation(summary = "新增", description = "传入priceList")
public R save(@Valid @RequestBody PriceListEntity priceList) { public R save(@Valid @RequestBody PriceListEntity priceList) {
return R.status(priceListService.save(priceList)); return R.status(priceListService.savePriceList(priceList));
} }
/** /**

View File

@@ -54,4 +54,6 @@ public interface IPriceListService extends BaseService<PriceListEntity> {
IPage<PriceListSummaryVO> selectSummaryListPage(IPage<PriceListSummaryVO> page, Long deptId); IPage<PriceListSummaryVO> selectSummaryListPage(IPage<PriceListSummaryVO> page, Long deptId);
List<PriceListVO> selectDetailList(PriceListVO priceList); List<PriceListVO> selectDetailList(PriceListVO priceList);
boolean savePriceList(PriceListEntity priceList);
} }

View File

@@ -25,6 +25,7 @@
*/ */
package org.springblade.modules.kiosk.service.impl; package org.springblade.modules.kiosk.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@@ -82,4 +83,19 @@ public class PriceListServiceImpl extends BaseServiceImpl<PriceListMapper, Price
return baseMapper.selectPriceList(priceList); return baseMapper.selectPriceList(priceList);
} }
@Override
public boolean savePriceList(PriceListEntity priceList) {
long count = count(Wrappers.<PriceListEntity>lambdaQuery()
.eq(priceList.getCategoryId() != null, PriceListEntity::getCategoryId, priceList.getCategoryId())
.eq(priceList.getShape() != null, PriceListEntity::getShape, priceList.getShape())
.eq(priceList.getSize() != null, PriceListEntity::getSize, priceList.getSize())
.eq(priceList.getMaterial() != null, PriceListEntity::getMaterial, priceList.getMaterial())
.eq(priceList.getStyle() != null, PriceListEntity::getStyle, priceList.getStyle())
);
if (count > 0) {
throw new ServiceException("The price list already exists");
}
return save(priceList);
}
} }