feat: 1.去除product无用字段

This commit is contained in:
张松
2024-11-25 17:11:19 +08:00
parent b8b3de5226
commit c6aff238c1
4 changed files with 28 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import org.springframework.data.annotation.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class TbProduct implements Serializable { public class TbProduct implements Serializable {
@@ -76,5 +77,16 @@ public class TbProduct implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String images;
private String groupSnap;
@TableField(exist = false)
private List<TbProductSku> skuList;
@TableField(exist = false)
private Object groundingSpecInfo;
private String specInfo;
private String selectSpec;
} }

View File

@@ -604,7 +604,7 @@ public class OrderService {
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap()); cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
} }
TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
if (Objects.nonNull(tbProduct)) { if (Objects.nonNull(tbProduct)) {
// cashierCart.setSelectSpec(tbProduct.getSelectSpec()); // cashierCart.setSelectSpec(tbProduct.getSelectSpec());
if (tbProduct.getSpecId() != null) { if (tbProduct.getSpecId() != null) {
@@ -648,7 +648,7 @@ public class OrderService {
} }
if (cashierCart.getIsTemporary() == null || cashierCart.getIsTemporary() == 0) { if (cashierCart.getIsTemporary() == null || cashierCart.getIsTemporary() == 0) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
if (ObjectUtil.isEmpty(product)) { if (ObjectUtil.isEmpty(product)) {
return Result.fail(CodeEnum.PRODUCTINFOERROR); return Result.fail(CodeEnum.PRODUCTINFOERROR);
} }
@@ -903,7 +903,7 @@ public class OrderService {
orderDetail.setPlaceNum(currentPlaceNum); orderDetail.setPlaceNum(currentPlaceNum);
} }
TbProductSkuWithBLOBs tbProduct = null; TbProductSkuWithBLOBs tbProduct = null;
TbProductWithBLOBs product = null; TbProduct product = null;
if (cashierCart.getIsTemporary() == 0) { if (cashierCart.getIsTemporary() == 0) {
product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) { if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) {
@@ -954,7 +954,7 @@ public class OrderService {
if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) { if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) {
// todo 修改为bigdecimal // todo 修改为bigdecimal
TbProductSkuWithBLOBs finalTbProduct = tbProduct; TbProductSkuWithBLOBs finalTbProduct = tbProduct;
TbProductWithBLOBs finalProduct = product; TbProduct finalProduct = product;
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(finalTbProduct, finalProduct, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber().intValue())); CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(finalTbProduct, finalProduct, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber().intValue()));
} }
} }
@@ -1279,7 +1279,7 @@ public class OrderService {
} }
List<TbCashierCart> list = cashierCartMapper.selectAllByMarketId(day, String.valueOf(cartVo.getShopId()), cartVo.getMasterId()); List<TbCashierCart> list = cashierCartMapper.selectAllByMarketId(day, String.valueOf(cartVo.getShopId()), cartVo.getMasterId());
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
if ("true".equals(cartVo.getStatus())) { if ("true".equals(cartVo.getStatus())) {
cashierCart.setTotalAmount(cashierCart.getTotalNumber().multiply(cashierCart.getSalePrice().add(product.getPackFee()))); cashierCart.setTotalAmount(cashierCart.getTotalNumber().multiply(cashierCart.getSalePrice().add(product.getPackFee())));
cashierCart.setPackFee(cashierCart.getTotalNumber().multiply(product.getPackFee())); cashierCart.setPackFee(cashierCart.getTotalNumber().multiply(product.getPackFee()));

View File

@@ -72,7 +72,7 @@ public class ProductService {
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){ public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){
List<TbProductWithBLOBs> tbProductWithBLOBs=null; List<TbProduct> tbProductWithBLOBs=null;
if(ObjectUtil.isEmpty(categoryId)){ if(ObjectUtil.isEmpty(categoryId)){
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName); tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
}else { }else {
@@ -112,7 +112,7 @@ public class ProductService {
} }
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) { public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) {
List<TbProductWithBLOBs> tbProductWithBLOBs=null; List<TbProduct> tbProductWithBLOBs=null;
PageHelperUtil.startPage(page,pageSize); PageHelperUtil.startPage(page,pageSize);
if(ObjectUtil.isEmpty(categoryId)){ if(ObjectUtil.isEmpty(categoryId)){
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName); tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
@@ -153,7 +153,7 @@ public class ProductService {
} }
public void decrStock(String productId, String skuId, BigDecimal decrNum) { public void decrStock(String productId, String skuId, BigDecimal decrNum) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId)); TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
if (product.getIsStock() == 1) { if (product.getIsStock() == 1) {
if (tbProductMapper.decrStock(productId, decrNum) < 1) { if (tbProductMapper.decrStock(productId, decrNum) < 1) {
throw new MsgException("库存不足,下单失败"); throw new MsgException("库存不足,下单失败");

View File

@@ -28,7 +28,7 @@
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" /> <result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
<result column="warn_line" jdbcType="INTEGER" property="warnLine" /> <result column="warn_line" jdbcType="INTEGER" property="warnLine" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProduct">
<result column="images" jdbcType="LONGVARCHAR" property="images" /> <result column="images" jdbcType="LONGVARCHAR" property="images" />
<result column="group_snap" jdbcType="LONGVARCHAR" property="groupSnap" /> <result column="group_snap" jdbcType="LONGVARCHAR" property="groupSnap" />
<result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" /> <result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" />
@@ -58,7 +58,7 @@
delete from tb_product delete from tb_product
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
insert into tb_product (id, category_id, spec_id, insert into tb_product (id, category_id, spec_id,
shop_id, name, short_title, shop_id, name, short_title,
type, pack_fee, low_price, type, pack_fee, low_price,
@@ -72,7 +72,7 @@
real_sales_number, real_sales_number,
spec_table_headers, spec_table_headers,
images, images,
group_snap, spec_info, select_spec, stock_number,warn_line group_snap, spec_info, select_spec, stock_number
) )
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
#{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR},
@@ -90,10 +90,10 @@
#{specTableHeaders,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
#{images,jdbcType=LONGVARCHAR}, #{images,jdbcType=LONGVARCHAR},
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR}, #{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR},
#{stockNumber,jdbcType=INTEGER},#{warnLine,jdbcType=INTEGER} #{stockNumber,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
insert into tb_product insert into tb_product
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@@ -309,7 +309,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
update tb_product update tb_product
<set> <set>
<if test="categoryId != null"> <if test="categoryId != null">
@@ -411,7 +411,7 @@
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
update tb_product update tb_product
set category_id = #{categoryId,jdbcType=VARCHAR}, set category_id = #{categoryId,jdbcType=VARCHAR},
spec_id = #{specId,jdbcType=INTEGER}, spec_id = #{specId,jdbcType=INTEGER},
@@ -439,8 +439,7 @@
group_snap = #{groupSnap,jdbcType=LONGVARCHAR}, group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
spec_info = #{specInfo,jdbcType=LONGVARCHAR}, spec_info = #{specInfo,jdbcType=LONGVARCHAR},
select_spec = #{selectSpec,jdbcType=LONGVARCHAR}, select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
stock_number = #{stockNumber,jdbcType=INTEGER}, stock_number = #{stockNumber,jdbcType=INTEGER}
warn_line = #{warnLine,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct"> <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
@@ -558,7 +557,6 @@
i.id as con_id, i.id as con_id,
i.con_code, i.con_code,
i.con_name, i.con_name,
i.surplus_stock,
i.stock_number, i.stock_number,
p.id as product_id, p.id as product_id,
p.`name` as product_name, p.`name` as product_name,