Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
bs-cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d49946d0
authored
Aug 06, 2026
by
周立明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
升级商品表
1 parent
a14be69a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
506 additions
and
17 deletions
bs-order/src/main/java/com/bs/order/entity/UpgradeGoods.java
bs-order/src/main/java/com/bs/order/mapper/UpgradeGoodsMapper.java
bs-order/src/main/java/com/bs/order/service/UpgradeGoodsService.java
bs-order/src/main/java/com/bs/order/service/impl/ProductTemplateServiceImpl.java
bs-order/src/main/java/com/bs/order/service/impl/UpgradeGoodsServiceImpl.java
bs-order/src/main/resources/mapper/UpgradeGoodsMapper.xml
bs-order/src/main/java/com/bs/order/entity/UpgradeGoods.java
0 → 100644
View file @
d49946d
package
com
.
bs
.
order
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.ToString
;
import
lombok.experimental.SuperBuilder
;
/**
* 升级商品
* @TableName bo_upgrade_goods
*/
@TableName
(
value
=
"bo_upgrade_goods"
)
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@ToString
public
class
UpgradeGoods
implements
Serializable
{
/**
* 主键ID
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 商品id编码
*/
@TableField
(
value
=
"commodity_code"
)
private
String
commodityCode
;
/**
* 产品清单id
*/
@TableField
(
value
=
"product_template_id"
)
private
Integer
productTemplateId
;
/**
* 基础商品ID
*/
@TableField
(
value
=
"base_goods_id"
)
private
Integer
baseGoodsId
;
/**
* 商品编号
*/
@TableField
(
value
=
"goods_code"
)
private
String
goodsCode
;
/**
* 升级商品名称
*/
@TableField
(
value
=
"upgrade_goods_name"
)
private
String
upgradeGoodsName
;
/**
* 规格名序列(;~;分隔)
*/
@TableField
(
value
=
"specification_name_sequence"
)
private
String
specificationNameSequence
;
/**
* 规格类型序列(;~;分隔)
*/
@TableField
(
value
=
"specification_type_sequence"
)
private
String
specificationTypeSequence
;
/**
* 规格值序列((;~;分隔)
*/
@TableField
(
value
=
"specification_data"
)
private
String
specificationData
;
/**
* 规格数据MD5 KEY
*/
@TableField
(
value
=
"specification_key"
)
private
String
specificationKey
;
/**
* scrm延保类配置ID
*/
@TableField
(
value
=
"scrm_config_id"
)
private
Integer
scrmConfigId
;
/**
* 库存
*/
@TableField
(
value
=
"stock"
)
private
Integer
stock
;
/**
* 到店价
*/
@TableField
(
value
=
"shop_price"
)
private
BigDecimal
shopPrice
;
/**
* 最大升级折扣
*/
@TableField
(
value
=
"max_upgrade_discount"
)
private
BigDecimal
maxUpgradeDiscount
;
/**
* 升级价/参考售价
*/
@TableField
(
value
=
"upgrade_price"
)
private
BigDecimal
upgradePrice
;
/**
* 零售价
*/
@TableField
(
value
=
"retail_price"
)
private
BigDecimal
retailPrice
;
/**
* 额外成本
*/
@TableField
(
value
=
"extra_cost"
)
private
Long
extraCost
;
/**
* 阳光激励费结算类型(1:比例;2:金额)
*/
@TableField
(
value
=
"incentive_type"
)
private
Integer
incentiveType
;
/**
* 阳光激励费
*/
@TableField
(
value
=
"incentive_cost"
)
private
BigDecimal
incentiveCost
;
/**
* 4S店分润方式(1:毛利,2:收入)
*/
@TableField
(
value
=
"profit_type"
)
private
Integer
profitType
;
/**
* 4S店分润比例
*/
@TableField
(
value
=
"profit_value"
)
private
BigDecimal
profitValue
;
/**
* 合伙人分润比例
*/
@TableField
(
value
=
"partner_profit_per"
)
private
BigDecimal
partnerProfitPer
;
/**
* 商品最低价
*/
@TableField
(
value
=
"shop_min_price"
)
private
BigDecimal
shopMinPrice
;
/**
* 质保时间/年
*/
@TableField
(
value
=
"warranty_period"
)
private
BigDecimal
warrantyPeriod
;
/**
* 上架状态(0:待上架,1:在售)
*/
@TableField
(
value
=
"status"
)
private
Integer
status
;
/**
* 审核状态(0:审核中,1:审核通过,2:驳回)
*/
@TableField
(
value
=
"review_status"
)
private
Integer
reviewStatus
;
/**
* 服务年限
*/
@TableField
(
value
=
"service_years"
)
private
Integer
serviceYears
;
/**
* 库存预警值下限
*/
@TableField
(
value
=
"warning_value"
)
private
BigDecimal
warningValue
;
/**
* 库存预警值上限
*/
@TableField
(
value
=
"warning_value_max"
)
private
BigDecimal
warningValueMax
;
/**
* 第三方编码
*/
@TableField
(
value
=
"third_party_code"
)
private
String
thirdPartyCode
;
/**
* 是否实体卡标识(Y:是;N:否)
*/
@TableField
(
value
=
"entity_card_flag"
)
private
String
entityCardFlag
;
/**
* 采购价
*/
@TableField
(
value
=
"purchase_price"
)
private
BigDecimal
purchasePrice
;
/**
* 型号/已改为编码
*/
@TableField
(
value
=
"type"
)
private
String
type
;
/**
* 部位,多个部位用逗号分隔
*/
@TableField
(
value
=
"position"
)
private
String
position
;
/**
* 适用车价最小值(万)
*/
@TableField
(
value
=
"min_suit_car_price"
)
private
BigDecimal
minSuitCarPrice
;
/**
* 适用车价最大值(万)
*/
@TableField
(
value
=
"max_suit_car_price"
)
private
BigDecimal
maxSuitCarPrice
;
/**
* 万公里数
*/
@TableField
(
value
=
"kilometers"
)
private
Integer
kilometers
;
/**
* 嘀加成本
*/
@TableField
(
value
=
"dj_cost"
)
private
BigDecimal
djCost
;
/**
* 产品可用状态(0-不可上架为商品 1-可上架为商品)
*/
@TableField
(
value
=
"on_shelf_status"
)
private
Integer
onShelfStatus
;
/**
* 创建人
*/
@TableField
(
value
=
"created_by"
)
private
String
createdBy
;
/**
* 创建时间
*/
@TableField
(
value
=
"created_date"
)
private
Date
createdDate
;
/**
* 修改人
*/
@TableField
(
value
=
"updated_by"
)
private
String
updatedBy
;
/**
* 修改时间
*/
@TableField
(
value
=
"updated_date"
)
private
Date
updatedDate
;
/**
* 删除标识(D:已删除;N:未删除)
*/
@TableField
(
value
=
"deleted_flag"
)
private
String
deletedFlag
;
/**
* 第三方名称
*/
@TableField
(
value
=
"third_party_name"
)
private
String
thirdPartyName
;
/**
* 计价单位类型 1-把、2-本、3-对、4-个、5-根、6-盒、7-件、8-卷、9-块、10-辆、11-米、12-克、13-升、14-双、15-台、16-套、17-条、18-桶、19-位、20-页、21-张
*/
@TableField
(
value
=
"price_unit_type"
)
private
Integer
priceUnitType
;
/**
* 计价单位名称
*/
@TableField
(
value
=
"price_unit_name"
)
private
String
priceUnitName
;
/**
* 采购成本/元
*/
@TableField
(
value
=
"purchase_cost"
)
private
BigDecimal
purchaseCost
;
/**
* 运营系数
*/
@TableField
(
value
=
"operation_coefficient"
)
private
BigDecimal
operationCoefficient
;
/**
* 运营成本
*/
@TableField
(
value
=
"operation_cost"
)
private
BigDecimal
operationCost
;
/**
* 适用区域(26年5月已废弃)改为适用dj_car_life_upgrade_goods_area表
*/
@TableField
(
value
=
"applicable_area"
)
private
String
applicableArea
;
/**
* 客户标签
*/
@TableField
(
value
=
"customer_label"
)
private
String
customerLabel
;
/**
* 供应来源(1-原厂、2-集采、3-店采)
*/
@TableField
(
value
=
"supply_source"
)
private
String
supplySource
;
/**
* 备注
*/
@TableField
(
value
=
"remark"
)
private
String
remark
;
@TableField
(
exist
=
false
)
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
bs-order/src/main/java/com/bs/order/mapper/UpgradeGoodsMapper.java
0 → 100644
View file @
d49946d
package
com
.
bs
.
order
.
mapper
;
import
com.bs.order.entity.UpgradeGoods
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* @author 66
* @description 针对表【bo_upgrade_goods(升级商品)】的数据库操作Mapper
* @createDate 2026-08-06 16:15:04
* @Entity com.bs.order.entity.UpgradeGoods
*/
public
interface
UpgradeGoodsMapper
extends
BaseMapper
<
UpgradeGoods
>
{
}
bs-order/src/main/java/com/bs/order/service/UpgradeGoodsService.java
0 → 100644
View file @
d49946d
package
com
.
bs
.
order
.
service
;
import
com.bs.order.entity.UpgradeGoods
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* @author 66
* @description 针对表【bo_upgrade_goods(升级商品)】的数据库操作Service
* @createDate 2026-08-06 16:15:04
*/
public
interface
UpgradeGoodsService
extends
IService
<
UpgradeGoods
>
{
}
bs-order/src/main/java/com/bs/order/service/impl/ProductTemplateServiceImpl.java
View file @
d49946d
...
...
@@ -2,6 +2,7 @@ package com.bs.order.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -12,13 +13,16 @@ import com.bs.common.exception.BaseException;
import
com.bs.common.utils.BsAssert
;
import
com.bs.order.dto.ProductTemplateDTO
;
import
com.bs.order.entity.ProductTemplate
;
import
com.bs.order.entity.UpgradeGoods
;
import
com.bs.order.model.ProductTemplateQuery
;
import
com.bs.order.service.ProductTemplateService
;
import
com.bs.order.mapper.ProductTemplateMapper
;
import
com.bs.order.service.UpgradeGoodsService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -35,7 +39,8 @@ import java.util.stream.Collectors;
@Service
public
class
ProductTemplateServiceImpl
extends
ServiceImpl
<
ProductTemplateMapper
,
ProductTemplate
>
implements
ProductTemplateService
{
@Autowired
private
UpgradeGoodsService
upgradeGoodsService
;
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
BaseException
.
class
)
public
Boolean
delete
(
ProductTemplateDTO
record
)
{
...
...
@@ -147,13 +152,13 @@ public class ProductTemplateServiceImpl extends ServiceImpl<ProductTemplateMappe
this
.
updateById
(
updateRecord
);
// 同步更新关联的 UpgradeGoods
// UpgradeGoods upgradeGoods = new UpgradeGoods();
// upgradeGoods.setProductTemplateId(record.getId());
// upgradeGoods.setUpgradeGoodsName(record.getProductName());
// upgradeGoods.setType(record.getProductCode());
// upgradeGoods.setUpdatedBy(record.getUpdatedBy());
// upgradeGoodsMapper.updateByProductTemplateId(upgradeGoods);
upgradeGoodsService
.
update
(
new
LambdaUpdateWrapper
<
UpgradeGoods
>()
.
set
(
UpgradeGoods:
:
getUpgradeGoodsName
,
record
.
getProductName
())
.
set
(
UpgradeGoods:
:
getType
,
record
.
getProductCode
())
.
set
(
UpgradeGoods:
:
getUpdatedBy
,
record
.
getUpdatedBy
())
.
set
(
UpgradeGoods:
:
getUpdatedDate
,
new
Date
())
.
eq
(
UpgradeGoods:
:
getDeletedFlag
,
DeletedFlagEnum
.
N
.
name
())
.
eq
(
UpgradeGoods:
:
getProductTemplateId
,
record
.
getId
()));
// 级联更新关联表的产品名称
syncProductNameToRelatedTables
(
record
.
getId
(),
record
.
getProductName
(),
record
.
getUpdatedBy
());
}
...
...
@@ -179,15 +184,13 @@ public class ProductTemplateServiceImpl extends ServiceImpl<ProductTemplateMappe
*/
private
void
syncProductNameToRelatedTables
(
Integer
productTemplateId
,
String
productName
,
String
updatedBy
)
{
// 查询所有关联的 UpgradeGoods
// Example ugExample = new Example(UpgradeGoods.class);
// ugExample.createCriteria()
// .andEqualTo("productTemplateId", productTemplateId)
// .andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
// List<UpgradeGoods> affectedList = upgradeGoodsMapper.selectByExample(ugExample);
// if (CollectionUtils.isEmpty(affectedList)) {
// return;
// }
//
List
<
UpgradeGoods
>
affectedList
=
upgradeGoodsService
.
list
(
new
LambdaQueryWrapper
<
UpgradeGoods
>()
.
eq
(
UpgradeGoods:
:
getProductTemplateId
,
productTemplateId
)
.
eq
(
UpgradeGoods:
:
getDeletedFlag
,
DeletedFlagEnum
.
N
.
name
()));
if
(
CollectionUtils
.
isEmpty
(
affectedList
))
{
return
;
}
// for (UpgradeGoods ug : affectedList) {
// BaseGoodsDTO baseGoods = baseGoodsMapper.selectById(ug.getBaseGoodsId());
// if (baseGoods == null) {
...
...
bs-order/src/main/java/com/bs/order/service/impl/UpgradeGoodsServiceImpl.java
0 → 100644
View file @
d49946d
package
com
.
bs
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.bs.order.entity.UpgradeGoods
;
import
com.bs.order.service.UpgradeGoodsService
;
import
com.bs.order.mapper.UpgradeGoodsMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* @author 66
* @description 针对表【bo_upgrade_goods(升级商品)】的数据库操作Service实现
* @createDate 2026-08-06 16:15:04
*/
@Slf4j
@Service
public
class
UpgradeGoodsServiceImpl
extends
ServiceImpl
<
UpgradeGoodsMapper
,
UpgradeGoods
>
implements
UpgradeGoodsService
{
}
bs-order/src/main/resources/mapper/UpgradeGoodsMapper.xml
0 → 100644
View file @
d49946d
<?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.bs.order.mapper.UpgradeGoodsMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.bs.order.entity.UpgradeGoods"
>
<id
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"commodityCode"
column=
"commodity_code"
jdbcType=
"VARCHAR"
/>
<result
property=
"productTemplateId"
column=
"product_template_id"
jdbcType=
"INTEGER"
/>
<result
property=
"baseGoodsId"
column=
"base_goods_id"
jdbcType=
"INTEGER"
/>
<result
property=
"goodsCode"
column=
"goods_code"
jdbcType=
"VARCHAR"
/>
<result
property=
"upgradeGoodsName"
column=
"upgrade_goods_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"specificationNameSequence"
column=
"specification_name_sequence"
jdbcType=
"VARCHAR"
/>
<result
property=
"specificationTypeSequence"
column=
"specification_type_sequence"
jdbcType=
"VARCHAR"
/>
<result
property=
"specificationData"
column=
"specification_data"
jdbcType=
"VARCHAR"
/>
<result
property=
"specificationKey"
column=
"specification_key"
jdbcType=
"VARCHAR"
/>
<result
property=
"scrmConfigId"
column=
"scrm_config_id"
jdbcType=
"INTEGER"
/>
<result
property=
"stock"
column=
"stock"
jdbcType=
"INTEGER"
/>
<result
property=
"shopPrice"
column=
"shop_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"maxUpgradeDiscount"
column=
"max_upgrade_discount"
jdbcType=
"DECIMAL"
/>
<result
property=
"upgradePrice"
column=
"upgrade_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"retailPrice"
column=
"retail_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"extraCost"
column=
"extra_cost"
jdbcType=
"DECIMAL"
/>
<result
property=
"incentiveType"
column=
"incentive_type"
jdbcType=
"TINYINT"
/>
<result
property=
"incentiveCost"
column=
"incentive_cost"
jdbcType=
"DECIMAL"
/>
<result
property=
"profitType"
column=
"profit_type"
jdbcType=
"TINYINT"
/>
<result
property=
"profitValue"
column=
"profit_value"
jdbcType=
"DECIMAL"
/>
<result
property=
"partnerProfitPer"
column=
"partner_profit_per"
jdbcType=
"DECIMAL"
/>
<result
property=
"shopMinPrice"
column=
"shop_min_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"warrantyPeriod"
column=
"warranty_period"
jdbcType=
"DECIMAL"
/>
<result
property=
"status"
column=
"status"
jdbcType=
"TINYINT"
/>
<result
property=
"reviewStatus"
column=
"review_status"
jdbcType=
"TINYINT"
/>
<result
property=
"serviceYears"
column=
"service_years"
jdbcType=
"TINYINT"
/>
<result
property=
"warningValue"
column=
"warning_value"
jdbcType=
"DECIMAL"
/>
<result
property=
"warningValueMax"
column=
"warning_value_max"
jdbcType=
"DECIMAL"
/>
<result
property=
"thirdPartyCode"
column=
"third_party_code"
jdbcType=
"VARCHAR"
/>
<result
property=
"entityCardFlag"
column=
"entity_card_flag"
jdbcType=
"CHAR"
/>
<result
property=
"purchasePrice"
column=
"purchase_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"type"
column=
"type"
jdbcType=
"VARCHAR"
/>
<result
property=
"position"
column=
"position"
jdbcType=
"VARCHAR"
/>
<result
property=
"minSuitCarPrice"
column=
"min_suit_car_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"maxSuitCarPrice"
column=
"max_suit_car_price"
jdbcType=
"DECIMAL"
/>
<result
property=
"kilometers"
column=
"kilometers"
jdbcType=
"INTEGER"
/>
<result
property=
"djCost"
column=
"dj_cost"
jdbcType=
"DECIMAL"
/>
<result
property=
"onShelfStatus"
column=
"on_shelf_status"
jdbcType=
"INTEGER"
/>
<result
property=
"createdBy"
column=
"created_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"createdDate"
column=
"created_date"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updatedBy"
column=
"updated_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"updatedDate"
column=
"updated_date"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"deletedFlag"
column=
"deleted_flag"
jdbcType=
"CHAR"
/>
<result
property=
"thirdPartyName"
column=
"third_party_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"priceUnitType"
column=
"price_unit_type"
jdbcType=
"TINYINT"
/>
<result
property=
"priceUnitName"
column=
"price_unit_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"purchaseCost"
column=
"purchase_cost"
jdbcType=
"DECIMAL"
/>
<result
property=
"operationCoefficient"
column=
"operation_coefficient"
jdbcType=
"DECIMAL"
/>
<result
property=
"operationCost"
column=
"operation_cost"
jdbcType=
"DECIMAL"
/>
<result
property=
"applicableArea"
column=
"applicable_area"
jdbcType=
"VARCHAR"
/>
<result
property=
"customerLabel"
column=
"customer_label"
jdbcType=
"VARCHAR"
/>
<result
property=
"supplySource"
column=
"supply_source"
jdbcType=
"VARCHAR"
/>
<result
property=
"remark"
column=
"remark"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,commodity_code,product_template_id,base_goods_id,goods_code,upgrade_goods_name,
specification_name_sequence,specification_type_sequence,specification_data,specification_key,scrm_config_id,
stock,shop_price,max_upgrade_discount,upgrade_price,retail_price,
extra_cost,incentive_type,incentive_cost,profit_type,profit_value,
partner_profit_per,shop_min_price,warranty_period,status,review_status,
service_years,warning_value,warning_value_max,third_party_code,entity_card_flag,
purchase_price,type,position,min_suit_car_price,max_suit_car_price,
kilometers,dj_cost,on_shelf_status,created_by,created_date,
updated_by,updated_date,deleted_flag,third_party_name,price_unit_type,
price_unit_name,purchase_cost,operation_coefficient,operation_cost,applicable_area,
customer_label,supply_source,remark
</sql>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment