zhuyifan

feat(ClientCustomerOrderService): 添加增加 SKU 销售数量的功能

feat(ClientCustomerOrderService): 添加 SKU 菜品库存相关 RPC接口
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 +}
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,14 @@ service ClientCustomerOrderServiceRpc { ...@@ -33,6 +33,14 @@ 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 + rpc AddSkusSellQuantities(AddSkusSellQuantitiesRpcRequest) returns (AddSkusSellQuantitiesRpcResponse) {}
43 +
36 } 44 }
37 45
38 enum OrderStatusEnum { 46 enum OrderStatusEnum {
...@@ -608,3 +616,71 @@ message BatchCreateOrderOperationRecordsResponse { ...@@ -608,3 +616,71 @@ message BatchCreateOrderOperationRecordsResponse {
608 bool isCreated = 1; 616 bool isCreated = 1;
609 repeated int32 ids = 2; 617 repeated int32 ids = 2;
610 } 618 }
619 +
620 +message SingleSkuSellQuantityRpcResponse {
621 + int32 id = 1;
622 + int32 enterpriseId = 2;
623 + int32 stallId = 3;
624 + int32 skuId = 4;
625 + int32 maxSellQuantity = 5;
626 + int32 todaySellQuantity = 6;
627 + int32 createdBy = 7;
628 + int64 createdAt = 8;
629 + int32 creationSource = 9;
630 + int32 updatedBy = 10;
631 + int64 updatedAt = 11;
632 + int32 updateSource = 12;
633 + bool isDeleted = 13;
634 +}
635 +
636 +message QuerySkuSellQuantitiesByStallRpcRequest {
637 + int32 enterpriseId = 1;
638 + int32 stallId = 2;
639 +}
640 +
641 +message QuerySkuSellQuantitiesByStallRpcResponse {
642 + repeated SingleSkuSellQuantityRpcResponse responses = 1;
643 +}
644 +
645 +message QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest {
646 + int32 enterpriseId = 1;
647 + int32 stallId = 2;
648 + repeated int32 skuIds = 3;
649 +}
650 +
651 +message QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse {
652 + repeated SingleSkuSellQuantityRpcResponse responses = 1;
653 +}
654 +
655 +message BatchSaveSkuSellQuantitiesRpcRequest {
656 + repeated SkuSellQuantityModification skuSellQuantityModifications = 1;
657 + int32 enterpriseId = 2;
658 + int32 updatedBy = 3;
659 + int32 updateSource = 4;
660 +}
661 +
662 +message SkuSellQuantityModification {
663 + int32 id = 1;
664 + int32 stallId = 2;
665 + int32 skuId = 3;
666 + int32 maxSellQuantity = 4;
667 +}
668 +
669 +message BatchSaveSkuSellQuantitiesRpcResponse {
670 + bool isSaved = 1;
671 +}
672 +
673 +message AddSkusSellQuantitiesRpcRequest {
674 + int32 enterpriseId = 1;
675 + int32 stallId = 2;
676 + repeated SkuSellQuantity skuSellQuantities = 3;
677 +}
678 +
679 +message SkuSellQuantity {
680 + int32 skuId = 1;
681 + int32 quantity = 2;
682 +}
683 +
684 +message AddSkusSellQuantitiesRpcResponse {
685 + bool isAdded = 1;
686 +}
......
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>