Showing
7 changed files
with
308 additions
and
5 deletions
| 1 | +package com.tianting.infoloop.mapper; | ||
| 2 | + | ||
| 3 | +import com.tianting.infoloop.inject.MyBaseMapper; | ||
| 4 | +import com.tianting.infoloop.model.db.SkuSellQuantity; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | +* @author zhuyf | ||
| 8 | +* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Mapper | ||
| 9 | +* @createDate 2025-02-28 14:03:59 | ||
| 10 | +* @Entity com.tianting.infoloop.model.db.SkuSellQuantity | ||
| 11 | +*/ | ||
| 12 | +public interface SkuSellQuantityMapper extends MyBaseMapper<SkuSellQuantity> { | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +} |
| 1 | +package com.tianting.infoloop.model.db; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableLogic; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 9 | +import com.baomidou.mybatisplus.extension.activerecord.Model; | ||
| 10 | +import lombok.Data; | ||
| 11 | +import lombok.EqualsAndHashCode; | ||
| 12 | +import lombok.experimental.Accessors; | ||
| 13 | + | ||
| 14 | +import java.io.Serializable; | ||
| 15 | +import java.time.LocalDateTime; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * sku售卖量 | ||
| 19 | + * @TableName sku_sell_quantities | ||
| 20 | + */ | ||
| 21 | +@EqualsAndHashCode(callSuper = true) | ||
| 22 | +@Data | ||
| 23 | +@Accessors(chain = true) | ||
| 24 | +@TableName(value ="sku_sell_quantities") | ||
| 25 | +public class SkuSellQuantity extends Model<OrderDetailDb> implements Serializable { | ||
| 26 | + | ||
| 27 | + @TableId(type = IdType.AUTO) | ||
| 28 | + private Integer id; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * | ||
| 32 | + */ | ||
| 33 | + private Integer enterpriseId; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + private Integer stallId; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 商品ID | ||
| 42 | + */ | ||
| 43 | + private Integer skuId; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 最大可售量 | ||
| 47 | + */ | ||
| 48 | + private Integer maxSellQuantity; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 今日已售量 | ||
| 52 | + */ | ||
| 53 | + private Integer todaySellQuantity; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * | ||
| 57 | + */ | ||
| 58 | + private Integer createdBy; | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + @TableField(fill = FieldFill.INSERT) | ||
| 62 | + private LocalDateTime createdAt; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * | ||
| 66 | + */ | ||
| 67 | + private Integer creationSource; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * | ||
| 71 | + */ | ||
| 72 | + private Integer updatedBy; | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 76 | + private LocalDateTime updatedAt; | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * | ||
| 80 | + */ | ||
| 81 | + private Integer updateSource; | ||
| 82 | + | ||
| 83 | + @TableLogic | ||
| 84 | + private Integer isDeleted; | ||
| 85 | + | ||
| 86 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.tianting.infoloop.service; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 4 | +import com.tianting.infoloop.model.db.SkuSellQuantity; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | +* @author zhuyf | ||
| 8 | +* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Service | ||
| 9 | +* @createDate 2025-02-28 14:03:59 | ||
| 10 | +*/ | ||
| 11 | +public interface SkuSellQuantityService extends IService<SkuSellQuantity> { | ||
| 12 | + | ||
| 13 | +} |
| ... | @@ -13,6 +13,8 @@ import com.infoloop.tianting.clientcustomerorderservice.BatchCreateClientCustome | ... | @@ -13,6 +13,8 @@ import com.infoloop.tianting.clientcustomerorderservice.BatchCreateClientCustome |
| 13 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateClientCustomerOrdersRpcResponse; | 13 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateClientCustomerOrdersRpcResponse; |
| 14 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateOrderOperationRecordsRequest; | 14 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateOrderOperationRecordsRequest; |
| 15 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateOrderOperationRecordsResponse; | 15 | import com.infoloop.tianting.clientcustomerorderservice.BatchCreateOrderOperationRecordsResponse; |
| 16 | +import com.infoloop.tianting.clientcustomerorderservice.BatchSaveSkuSellQuantitiesRpcRequest; | ||
| 17 | +import com.infoloop.tianting.clientcustomerorderservice.BatchSaveSkuSellQuantitiesRpcResponse; | ||
| 16 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrderDetailsRpcRequest; | 18 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrderDetailsRpcRequest; |
| 17 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrderDetailsRpcResponse; | 19 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrderDetailsRpcResponse; |
| 18 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrdersRpcRequest; | 20 | import com.infoloop.tianting.clientcustomerorderservice.BatchUpdateClientCustomerOrdersRpcRequest; |
| ... | @@ -42,13 +44,18 @@ import com.infoloop.tianting.clientcustomerorderservice.GetOrderOperationRecords | ... | @@ -42,13 +44,18 @@ import com.infoloop.tianting.clientcustomerorderservice.GetOrderOperationRecords |
| 42 | import com.infoloop.tianting.clientcustomerorderservice.GetOrderOperationRecordsByOrderIdResponse; | 44 | import com.infoloop.tianting.clientcustomerorderservice.GetOrderOperationRecordsByOrderIdResponse; |
| 43 | import com.infoloop.tianting.clientcustomerorderservice.OrderCountByStatus; | 45 | import com.infoloop.tianting.clientcustomerorderservice.OrderCountByStatus; |
| 44 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationRecord; | 46 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationRecord; |
| 47 | +import com.infoloop.tianting.clientcustomerorderservice.OrderSourceEnum; | ||
| 45 | import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; | 48 | import com.infoloop.tianting.clientcustomerorderservice.OrderStatusEnum; |
| 46 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByConditionRpcRequest; | 49 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByConditionRpcRequest; |
| 47 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByConditionRpcResponse; | 50 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByConditionRpcResponse; |
| 48 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcRequest; | 51 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcRequest; |
| 49 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcResponse; | 52 | import com.infoloop.tianting.clientcustomerorderservice.QueryClientCustomerOrdersByPaginationRpcResponse; |
| 50 | -import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderDetailRpcResponse; | 53 | +import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest; |
| 51 | -import com.infoloop.tianting.clientcustomerorderservice.SingleClientCustomerOrderRpcResponse; | 54 | +import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse; |
| 55 | +import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallRpcRequest; | ||
| 56 | +import com.infoloop.tianting.clientcustomerorderservice.QuerySkuSellQuantitiesByStallRpcResponse; | ||
| 57 | +import com.infoloop.tianting.clientcustomerorderservice.SingleSkuSellQuantityRpcResponse; | ||
| 58 | +import com.infoloop.tianting.clientcustomerorderservice.SkuSellQuantityModification; | ||
| 52 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderDetailRpcRequest; | 59 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderDetailRpcRequest; |
| 53 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderDetailRpcResponse; | 60 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderDetailRpcResponse; |
| 54 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderRpcRequest; | 61 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderRpcRequest; |
| ... | @@ -56,9 +63,11 @@ import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrde | ... | @@ -56,9 +63,11 @@ import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrde |
| 56 | import com.tianting.infoloop.model.db.OrderDb; | 63 | import com.tianting.infoloop.model.db.OrderDb; |
| 57 | import com.tianting.infoloop.model.db.OrderDetailDb; | 64 | import com.tianting.infoloop.model.db.OrderDetailDb; |
| 58 | import com.tianting.infoloop.model.db.OrderOperationRecordDb; | 65 | import com.tianting.infoloop.model.db.OrderOperationRecordDb; |
| 66 | +import com.tianting.infoloop.model.db.SkuSellQuantity; | ||
| 59 | import com.tianting.infoloop.service.OrderDbService; | 67 | import com.tianting.infoloop.service.OrderDbService; |
| 60 | import com.tianting.infoloop.service.OrderDetailDbService; | 68 | import com.tianting.infoloop.service.OrderDetailDbService; |
| 61 | import com.tianting.infoloop.service.OrderOperationRecordDbService; | 69 | import com.tianting.infoloop.service.OrderOperationRecordDbService; |
| 70 | +import com.tianting.infoloop.service.SkuSellQuantityService; | ||
| 62 | import com.tianting.infoloop.utils.DbToProtoUtil; | 71 | import com.tianting.infoloop.utils.DbToProtoUtil; |
| 63 | import com.tianting.infoloop.utils.ProtoBeanUtil; | 72 | import com.tianting.infoloop.utils.ProtoBeanUtil; |
| 64 | import io.grpc.Status; | 73 | import io.grpc.Status; |
| ... | @@ -68,9 +77,12 @@ import lombok.extern.slf4j.Slf4j; | ... | @@ -68,9 +77,12 @@ import lombok.extern.slf4j.Slf4j; |
| 68 | import org.springframework.beans.factory.annotation.Autowired; | 77 | import org.springframework.beans.factory.annotation.Autowired; |
| 69 | import org.springframework.stereotype.Service; | 78 | import org.springframework.stereotype.Service; |
| 70 | 79 | ||
| 80 | +import java.util.ArrayList; | ||
| 81 | +import java.util.List; | ||
| 71 | import java.util.stream.Collectors; | 82 | import java.util.stream.Collectors; |
| 72 | 83 | ||
| 73 | import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER; | 84 | import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER; |
| 85 | +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_SLAVE; | ||
| 74 | 86 | ||
| 75 | @Slf4j | 87 | @Slf4j |
| 76 | @Service | 88 | @Service |
| ... | @@ -79,6 +91,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -79,6 +91,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 79 | private final OrderDbService orderDbService; | 91 | private final OrderDbService orderDbService; |
| 80 | private final OrderDetailDbService orderDetailDbService; | 92 | private final OrderDetailDbService orderDetailDbService; |
| 81 | private final OrderOperationRecordDbService orderOperationRecordDbService; | 93 | private final OrderOperationRecordDbService orderOperationRecordDbService; |
| 94 | + private final SkuSellQuantityService skuSellQuantityService; | ||
| 82 | 95 | ||
| 83 | @Override | 96 | @Override |
| 84 | @DS(DATA_SOURCE_MASTER) | 97 | @DS(DATA_SOURCE_MASTER) |
| ... | @@ -203,7 +216,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -203,7 +216,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 203 | int preparingCount = 0; | 216 | int preparingCount = 0; |
| 204 | int allServedCount = 0; | 217 | int allServedCount = 0; |
| 205 | int canceledCount = 0; | 218 | int canceledCount = 0; |
| 206 | - for(OrderStatusEnum status: OrderStatusEnum.values()) { | 219 | + for (OrderStatusEnum status : OrderStatusEnum.values()) { |
| 207 | LambdaQueryWrapper<OrderDb> queryCountWrapper = Wrappers.lambdaQuery(); | 220 | LambdaQueryWrapper<OrderDb> queryCountWrapper = Wrappers.lambdaQuery(); |
| 208 | if (!request.getKeyword().isEmpty()) { | 221 | if (!request.getKeyword().isEmpty()) { |
| 209 | queryCountWrapper.like(OrderDb::getMealTime, request.getKeyword()); | 222 | queryCountWrapper.like(OrderDb::getMealTime, request.getKeyword()); |
| ... | @@ -627,8 +640,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -627,8 +640,7 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 627 | @DS(DATA_SOURCE_MASTER) | 640 | @DS(DATA_SOURCE_MASTER) |
| 628 | public void batchCreateOrderOperationRecords( | 641 | public void batchCreateOrderOperationRecords( |
| 629 | final BatchCreateOrderOperationRecordsRequest request, | 642 | final BatchCreateOrderOperationRecordsRequest request, |
| 630 | - final StreamObserver<BatchCreateOrderOperationRecordsResponse> responseStreamObserver | 643 | + final StreamObserver<BatchCreateOrderOperationRecordsResponse> responseStreamObserver) { |
| 631 | - ) { | ||
| 632 | final var builder = BatchCreateOrderOperationRecordsResponse.newBuilder(); | 644 | final var builder = BatchCreateOrderOperationRecordsResponse.newBuilder(); |
| 633 | try { | 645 | try { |
| 634 | final var data = orderOperationRecordDbService.batchCreateOrderOperationRecords(request); | 646 | final var data = orderOperationRecordDbService.batchCreateOrderOperationRecords(request); |
| ... | @@ -641,4 +653,74 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -641,4 +653,74 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 641 | responseStreamObserver.onNext(builder.build()); | 653 | responseStreamObserver.onNext(builder.build()); |
| 642 | responseStreamObserver.onCompleted(); | 654 | responseStreamObserver.onCompleted(); |
| 643 | } | 655 | } |
| 656 | + | ||
| 657 | + @Override | ||
| 658 | + @DS(DATA_SOURCE_SLAVE) | ||
| 659 | + public void querySkuSellQuantitiesByStall(final QuerySkuSellQuantitiesByStallRpcRequest request, | ||
| 660 | + final StreamObserver<QuerySkuSellQuantitiesByStallRpcResponse> responseStreamObserver) { | ||
| 661 | + final var builder = QuerySkuSellQuantitiesByStallRpcResponse.newBuilder(); | ||
| 662 | + try { | ||
| 663 | + LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 664 | + queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); | ||
| 665 | + queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); | ||
| 666 | + final var list = skuSellQuantityService.list(queryWrapper); | ||
| 667 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | ||
| 668 | + } catch (final Exception e) { | ||
| 669 | + log.error("querySkuSellQuantitiesByStall error;", e); | ||
| 670 | + responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 671 | + } | ||
| 672 | + responseStreamObserver.onNext(builder.build()); | ||
| 673 | + responseStreamObserver.onCompleted(); | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + @Override | ||
| 677 | + @DS(DATA_SOURCE_SLAVE) | ||
| 678 | + public void querySkuSellQuantitiesByStallAndSkuIds(final QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest request, | ||
| 679 | + final StreamObserver<QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse> responseStreamObserver) { | ||
| 680 | + final var builder = QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse.newBuilder(); | ||
| 681 | + try { | ||
| 682 | + LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 683 | + queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); | ||
| 684 | + queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); | ||
| 685 | + queryWrapper.in(SkuSellQuantity::getSkuId, request.getSkuIdsList()); | ||
| 686 | + final var list = skuSellQuantityService.list(queryWrapper); | ||
| 687 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | ||
| 688 | + } catch (final Exception e) { | ||
| 689 | + log.error("querySkuSellQuantitiesByStallAndSkuIds error;", e); | ||
| 690 | + responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 691 | + } | ||
| 692 | + responseStreamObserver.onNext(builder.build()); | ||
| 693 | + responseStreamObserver.onCompleted(); | ||
| 694 | + } | ||
| 695 | + | ||
| 696 | + @Override | ||
| 697 | + @DS(DATA_SOURCE_MASTER) | ||
| 698 | + public void batchSaveSkuSellQuantities(final BatchSaveSkuSellQuantitiesRpcRequest request, | ||
| 699 | + final StreamObserver<BatchSaveSkuSellQuantitiesRpcResponse> responseStreamObserver) { | ||
| 700 | + final var builder = BatchSaveSkuSellQuantitiesRpcResponse.newBuilder(); | ||
| 701 | + try { | ||
| 702 | + List<SkuSellQuantity> skuSellQuantities = new ArrayList<>(); | ||
| 703 | + for (SkuSellQuantityModification skuSellQuantityModification : request.getSkuSellQuantityModificationsList()) { | ||
| 704 | + SkuSellQuantity skuSellQuantity = new SkuSellQuantity(); | ||
| 705 | + skuSellQuantity.setId(skuSellQuantityModification.getId() == 0 ? null : skuSellQuantityModification.getId()); | ||
| 706 | + skuSellQuantity.setEnterpriseId(request.getEnterpriseId()); | ||
| 707 | + skuSellQuantity.setStallId(skuSellQuantityModification.getStallId()); | ||
| 708 | + skuSellQuantity.setSkuId(skuSellQuantityModification.getSkuId()); | ||
| 709 | + skuSellQuantity.setMaxSellQuantity(skuSellQuantityModification.getMaxSellQuantity()); | ||
| 710 | + skuSellQuantity.setCreatedBy(request.getUpdatedBy()); | ||
| 711 | + skuSellQuantity.setCreationSource(OrderSourceEnum.STALL_VALUE); | ||
| 712 | + skuSellQuantity.setUpdatedBy(request.getUpdatedBy()); | ||
| 713 | + skuSellQuantity.setUpdateSource(OrderSourceEnum.STALL_VALUE); | ||
| 714 | + skuSellQuantities.add(skuSellQuantity); | ||
| 715 | + } | ||
| 716 | + final boolean saveOrUpdateBatch = skuSellQuantityService.saveOrUpdateBatch(skuSellQuantities); | ||
| 717 | + builder.setIsSaved(saveOrUpdateBatch); | ||
| 718 | + } catch (final Exception e) { | ||
| 719 | + log.error("batchSaveSkuSellQuantities error;", e); | ||
| 720 | + responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 721 | + } | ||
| 722 | + responseStreamObserver.onNext(builder.build()); | ||
| 723 | + responseStreamObserver.onCompleted(); | ||
| 724 | + } | ||
| 725 | + | ||
| 644 | } | 726 | } | ... | ... |
| 1 | +package com.tianting.infoloop.service.impl; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 4 | +import com.tianting.infoloop.mapper.SkuSellQuantityMapper; | ||
| 5 | +import com.tianting.infoloop.model.db.SkuSellQuantity; | ||
| 6 | +import com.tianting.infoloop.service.SkuSellQuantityService; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | +* @author zhuyf | ||
| 11 | +* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Service实现 | ||
| 12 | +* @createDate 2025-02-28 14:03:59 | ||
| 13 | +*/ | ||
| 14 | +@Service | ||
| 15 | +public class SkuSellQuantityServiceImpl extends ServiceImpl<SkuSellQuantityMapper, SkuSellQuantity> implements SkuSellQuantityService { | ||
| 16 | + | ||
| 17 | +} |
| ... | @@ -33,6 +33,13 @@ service ClientCustomerOrderServiceRpc { | ... | @@ -33,6 +33,13 @@ service ClientCustomerOrderServiceRpc { |
| 33 | // 操作记录 | 33 | // 操作记录 |
| 34 | rpc GetOrderOperationRecordsByOrderId (GetOrderOperationRecordsByOrderIdRequest) returns (GetOrderOperationRecordsByOrderIdResponse) {} | 34 | rpc GetOrderOperationRecordsByOrderId (GetOrderOperationRecordsByOrderIdRequest) returns (GetOrderOperationRecordsByOrderIdResponse) {} |
| 35 | rpc BatchCreateOrderOperationRecords (BatchCreateOrderOperationRecordsRequest) returns (BatchCreateOrderOperationRecordsResponse) {} | 35 | rpc BatchCreateOrderOperationRecords (BatchCreateOrderOperationRecordsRequest) returns (BatchCreateOrderOperationRecordsResponse) {} |
| 36 | + | ||
| 37 | + | ||
| 38 | + // sku菜品库存 | ||
| 39 | + rpc QuerySkuSellQuantitiesByStall(QuerySkuSellQuantitiesByStallRpcRequest) returns (QuerySkuSellQuantitiesByStallRpcResponse) {} | ||
| 40 | + rpc QuerySkuSellQuantitiesByStallAndSkuIds(QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest) returns (QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse) {} | ||
| 41 | + rpc BatchSaveSkuSellQuantities(BatchSaveSkuSellQuantitiesRpcRequest) returns (BatchSaveSkuSellQuantitiesRpcResponse) {} | ||
| 42 | + | ||
| 36 | } | 43 | } |
| 37 | 44 | ||
| 38 | enum OrderStatusEnum { | 45 | enum OrderStatusEnum { |
| ... | @@ -608,3 +615,56 @@ message BatchCreateOrderOperationRecordsResponse { | ... | @@ -608,3 +615,56 @@ message BatchCreateOrderOperationRecordsResponse { |
| 608 | bool isCreated = 1; | 615 | bool isCreated = 1; |
| 609 | repeated int32 ids = 2; | 616 | repeated int32 ids = 2; |
| 610 | } | 617 | } |
| 618 | + | ||
| 619 | +message SingleSkuSellQuantityRpcResponse { | ||
| 620 | + int32 id = 1; | ||
| 621 | + int32 enterpriseId = 2; | ||
| 622 | + int32 stallId = 3; | ||
| 623 | + int32 skuId = 4; | ||
| 624 | + int32 maxSellQuantity = 5; | ||
| 625 | + int32 todaySellQuantity = 6; | ||
| 626 | + int32 createdBy = 7; | ||
| 627 | + int64 createdAt = 8; | ||
| 628 | + int32 creationSource = 9; | ||
| 629 | + int32 updatedBy = 10; | ||
| 630 | + int64 updatedAt = 11; | ||
| 631 | + int32 updateSource = 12; | ||
| 632 | + bool isDeleted = 13; | ||
| 633 | +} | ||
| 634 | + | ||
| 635 | +message QuerySkuSellQuantitiesByStallRpcRequest { | ||
| 636 | + int32 enterpriseId = 1; | ||
| 637 | + int32 stallId = 2; | ||
| 638 | +} | ||
| 639 | + | ||
| 640 | +message QuerySkuSellQuantitiesByStallRpcResponse { | ||
| 641 | + repeated SingleSkuSellQuantityRpcResponse responses = 1; | ||
| 642 | +} | ||
| 643 | + | ||
| 644 | +message QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest { | ||
| 645 | + int32 enterpriseId = 1; | ||
| 646 | + int32 stallId = 2; | ||
| 647 | + repeated int32 skuIds = 3; | ||
| 648 | +} | ||
| 649 | + | ||
| 650 | +message QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse { | ||
| 651 | + repeated SingleSkuSellQuantityRpcResponse responses = 1; | ||
| 652 | +} | ||
| 653 | + | ||
| 654 | +message BatchSaveSkuSellQuantitiesRpcRequest { | ||
| 655 | + repeated SkuSellQuantityModification skuSellQuantityModifications = 1; | ||
| 656 | + int32 enterpriseId = 2; | ||
| 657 | + int32 updatedBy = 3; | ||
| 658 | + int32 updateSource = 4; | ||
| 659 | +} | ||
| 660 | + | ||
| 661 | +message SkuSellQuantityModification { | ||
| 662 | + int32 id = 1; | ||
| 663 | + int32 stallId = 2; | ||
| 664 | + int32 skuId = 3; | ||
| 665 | + int32 maxSellQuantity = 4; | ||
| 666 | +} | ||
| 667 | + | ||
| 668 | +message BatchSaveSkuSellQuantitiesRpcResponse { | ||
| 669 | + bool isSaved = 1; | ||
| 670 | +} | ... | ... |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper | ||
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | +<mapper namespace="com.tianting.infoloop.mapper.SkuSellQuantityMapper"> | ||
| 6 | + | ||
| 7 | + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.SkuSellQuantity"> | ||
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | ||
| 9 | + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/> | ||
| 10 | + <result property="stallId" column="stallId" jdbcType="INTEGER"/> | ||
| 11 | + <result property="skuId" column="skuId" jdbcType="INTEGER"/> | ||
| 12 | + <result property="maxSellQuantity" column="maxSellQuantity" jdbcType="INTEGER"/> | ||
| 13 | + <result property="todaySellQuantity" column="todaySellQuantity" jdbcType="INTEGER"/> | ||
| 14 | + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/> | ||
| 15 | + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/> | ||
| 16 | + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/> | ||
| 17 | + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/> | ||
| 18 | + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/> | ||
| 19 | + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/> | ||
| 20 | + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/> | ||
| 21 | + </resultMap> | ||
| 22 | + | ||
| 23 | + <sql id="Base_Column_List"> | ||
| 24 | + id,enterpriseId,stallId, | ||
| 25 | + skuId,maxSellQuantity,todaySellQuantity, | ||
| 26 | + createdBy,createdAt,creationSource, | ||
| 27 | + updatedBy,updatedAt,updateSource, | ||
| 28 | + isDeleted | ||
| 29 | + </sql> | ||
| 30 | +</mapper> |
-
Please register or login to post a comment