zhuyifan

feat(ClientCustomerOrderService): 添加 SKU 菜品库存相关 RPC接口

package com.tianting.infoloop.mapper;
import com.tianting.infoloop.inject.MyBaseMapper;
import com.tianting.infoloop.model.db.SkuSellQuantity;
/**
* @author zhuyf
* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Mapper
* @createDate 2025-02-28 14:03:59
* @Entity com.tianting.infoloop.model.db.SkuSellQuantity
*/
public interface SkuSellQuantityMapper extends MyBaseMapper<SkuSellQuantity> {
}
package com.tianting.infoloop.model.db;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* sku售卖量
* @TableName sku_sell_quantities
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@TableName(value ="sku_sell_quantities")
public class SkuSellQuantity extends Model<OrderDetailDb> implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;
/**
*
*/
private Integer enterpriseId;
/**
*
*/
private Integer stallId;
/**
* 商品ID
*/
private Integer skuId;
/**
* 最大可售量
*/
private Integer maxSellQuantity;
/**
* 今日已售量
*/
private Integer todaySellQuantity;
/**
*
*/
private Integer createdBy;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createdAt;
/**
*
*/
private Integer creationSource;
/**
*
*/
private Integer updatedBy;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updatedAt;
/**
*
*/
private Integer updateSource;
@TableLogic
private Integer isDeleted;
}
\ No newline at end of file
package com.tianting.infoloop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tianting.infoloop.model.db.SkuSellQuantity;
/**
* @author zhuyf
* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Service
* @createDate 2025-02-28 14:03:59
*/
public interface SkuSellQuantityService extends IService<SkuSellQuantity> {
}
package com.tianting.infoloop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tianting.infoloop.mapper.SkuSellQuantityMapper;
import com.tianting.infoloop.model.db.SkuSellQuantity;
import com.tianting.infoloop.service.SkuSellQuantityService;
import org.springframework.stereotype.Service;
/**
* @author zhuyf
* @description 针对表【sku_sell_quantities(sku售卖量)】的数据库操作Service实现
* @createDate 2025-02-28 14:03:59
*/
@Service
public class SkuSellQuantityServiceImpl extends ServiceImpl<SkuSellQuantityMapper, SkuSellQuantity> implements SkuSellQuantityService {
}
......@@ -33,6 +33,13 @@ service ClientCustomerOrderServiceRpc {
// 操作记录
rpc GetOrderOperationRecordsByOrderId (GetOrderOperationRecordsByOrderIdRequest) returns (GetOrderOperationRecordsByOrderIdResponse) {}
rpc BatchCreateOrderOperationRecords (BatchCreateOrderOperationRecordsRequest) returns (BatchCreateOrderOperationRecordsResponse) {}
// sku菜品库存
rpc QuerySkuSellQuantitiesByStall(QuerySkuSellQuantitiesByStallRpcRequest) returns (QuerySkuSellQuantitiesByStallRpcResponse) {}
rpc QuerySkuSellQuantitiesByStallAndSkuIds(QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest) returns (QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse) {}
rpc BatchSaveSkuSellQuantities(BatchSaveSkuSellQuantitiesRpcRequest) returns (BatchSaveSkuSellQuantitiesRpcResponse) {}
}
enum OrderStatusEnum {
......@@ -608,3 +615,56 @@ message BatchCreateOrderOperationRecordsResponse {
bool isCreated = 1;
repeated int32 ids = 2;
}
message SingleSkuSellQuantityRpcResponse {
int32 id = 1;
int32 enterpriseId = 2;
int32 stallId = 3;
int32 skuId = 4;
int32 maxSellQuantity = 5;
int32 todaySellQuantity = 6;
int32 createdBy = 7;
int64 createdAt = 8;
int32 creationSource = 9;
int32 updatedBy = 10;
int64 updatedAt = 11;
int32 updateSource = 12;
bool isDeleted = 13;
}
message QuerySkuSellQuantitiesByStallRpcRequest {
int32 enterpriseId = 1;
int32 stallId = 2;
}
message QuerySkuSellQuantitiesByStallRpcResponse {
repeated SingleSkuSellQuantityRpcResponse responses = 1;
}
message QuerySkuSellQuantitiesByStallAndSkuIdsRpcRequest {
int32 enterpriseId = 1;
int32 stallId = 2;
repeated int32 skuIds = 3;
}
message QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse {
repeated SingleSkuSellQuantityRpcResponse responses = 1;
}
message BatchSaveSkuSellQuantitiesRpcRequest {
repeated SkuSellQuantityModification skuSellQuantityModifications = 1;
int32 enterpriseId = 2;
int32 updatedBy = 3;
int32 updateSource = 4;
}
message SkuSellQuantityModification {
int32 id = 1;
int32 stallId = 2;
int32 skuId = 3;
int32 maxSellQuantity = 4;
}
message BatchSaveSkuSellQuantitiesRpcResponse {
bool isSaved = 1;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tianting.infoloop.mapper.SkuSellQuantityMapper">
<resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.SkuSellQuantity">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
<result property="stallId" column="stallId" jdbcType="INTEGER"/>
<result property="skuId" column="skuId" jdbcType="INTEGER"/>
<result property="maxSellQuantity" column="maxSellQuantity" jdbcType="INTEGER"/>
<result property="todaySellQuantity" column="todaySellQuantity" jdbcType="INTEGER"/>
<result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
<result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
<result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
<result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
<result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
<result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
<result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id,enterpriseId,stallId,
skuId,maxSellQuantity,todaySellQuantity,
createdBy,createdAt,creationSource,
updatedBy,updatedAt,updateSource,
isDeleted
</sql>
</mapper>