Commit 1bec7ec8 by 崔彦峰

feat(goods): 商品上下架模块新增上架模式和相关字段

- 在 GoodsListingApproval 模型中新增 shelfModel 字段用于区分特殊商品和常规商品上架模式
- 在 GoodsListingBaseRule 模型中新增管理层市场费前置和一线阳光前置两个控制字段
- 在 GoodsListingProductBase 模型中新增 shelfStyle 上架方式字段和 oldMerchantGoodsCode 原上架ID字段
- 更新对应的 Mapper XML 文件中的 ResultMap 和 SQL 查询语句以包含新字段
- 为新字段添加数据库映射配置和查询条件支持
1 parent 52ea284b
...@@ -123,4 +123,11 @@ public class GoodsListingApproval implements Serializable { ...@@ -123,4 +123,11 @@ public class GoodsListingApproval implements Serializable {
@ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)")
@Column(name = "deleted_flag") @Column(name = "deleted_flag")
private String deletedFlag; private String deletedFlag;
/**
* 上架模式 1-特殊商品上架 2-常规商品上架
*/
@ApiModelProperty(name = "shelfModel", notes = "上架模式 1-特殊商品上架 2-常规商品上架")
@Column(name = "shelf_model")
private Byte shelfModel;
} }
\ No newline at end of file \ No newline at end of file
...@@ -160,6 +160,20 @@ public class GoodsListingBaseRule implements Serializable { ...@@ -160,6 +160,20 @@ public class GoodsListingBaseRule implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 管理层市场费是否前置:是-Y 否-N
*/
@ApiModelProperty(name = "managementMarketingFeesPrerequisite", notes = "管理层市场费是否前置:是-Y 否-N")
@Column(name = "management_marketing_fees_prerequisite")
private String managementMarketingFeesPrerequisite;
/**
* 一线阳光是否前置:是-Y 否-N
*/
@ApiModelProperty(name = "firstLineSunshinePrerequisite", notes = "一线阳光是否前置:是-Y 否-N")
@Column(name = "first_line_sunshine_prerequisite")
private String firstLineSunshinePrerequisite;
/**
* 删除标示(D:已删除;N:未删除) * 删除标示(D:已删除;N:未删除)
*/ */
@ApiModelProperty(name = "deletedFlag", notes = "删除标示(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标示(D:已删除;N:未删除)")
......
...@@ -222,6 +222,20 @@ public class GoodsListingProductBase implements Serializable { ...@@ -222,6 +222,20 @@ public class GoodsListingProductBase implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 类型(上架方式):1-新增 2-修改
*/
@ApiModelProperty(name = "shelfStyle", notes = "类型(上架方式):1-新增 2-修改")
@Column(name = "shelf_style")
private Byte shelfStyle;
/**
* 原上架ID(原商户商品编码)
*/
@ApiModelProperty(name = "oldMerchantGoodsCode", notes = "原上架ID(原商户商品编码)")
@Column(name = "old_merchant_goods_code")
private String oldMerchantGoodsCode;
/**
* 删除标识(D:已删除;N:未删除) * 删除标识(D:已删除;N:未删除)
*/ */
@ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)")
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="shelf_model" property="shelfModel" jdbcType="TINYINT" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO" extends="BaseResultMap">
...@@ -35,14 +36,14 @@ ...@@ -35,14 +36,14 @@
--> -->
id, business_code, uuid, shelf_type, system_status, rejected_reason, goods_create_excel, id, business_code, uuid, shelf_type, system_status, rejected_reason, goods_create_excel,
base_scene_code, confirm_step, created_by, created_date, updated_by, updated_date, base_scene_code, confirm_step, created_by, created_date, updated_by, updated_date,
deleted_flag deleted_flag, shelf_model
</sql> </sql>
<select id="list" resultMap="DTOResultMap"> <select id="list" resultMap="DTOResultMap">
select select
gla.id, gla.business_code, gla.uuid, gla.shelf_type, gla.system_status, gla.rejected_reason, gla.id, gla.business_code, gla.uuid, gla.shelf_type, gla.system_status, gla.rejected_reason,
gla.goods_create_excel, gla.base_scene_code, gla.confirm_step, gla.created_by, gla.created_date, gla.goods_create_excel, gla.base_scene_code, gla.confirm_step, gla.created_by, gla.created_date,
gla.updated_by, gla.updated_date gla.updated_by, gla.updated_date, gla.shelf_model
from dj_car_life_goods_listing_approval gla from dj_car_life_goods_listing_approval gla
<include refid="condition"></include> <include refid="condition"></include>
order by gla.id desc order by gla.id desc
...@@ -69,6 +70,9 @@ ...@@ -69,6 +70,9 @@
<if test="baseSceneCode != null and baseSceneCode !=''"> <if test="baseSceneCode != null and baseSceneCode !=''">
and gla.base_scene_code = #{baseSceneCode} and gla.base_scene_code = #{baseSceneCode}
</if> </if>
<if test="shelfModel != null">
and gla.shelf_model = #{shelfModel}
</if>
</where> </where>
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="management_marketing_fees_prerequisite" property="managementMarketingFeesPrerequisite" jdbcType="CHAR" />
<result column="first_line_sunshine_prerequisite" property="firstLineSunshinePrerequisite" jdbcType="CHAR" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -34,6 +36,7 @@ ...@@ -34,6 +36,7 @@
partner_merchant_divide_target, partner_merchant2_auto_divide, partner_merchant2_divide_target, partner_merchant_divide_target, partner_merchant2_auto_divide, partner_merchant2_divide_target,
other_fee_divide_target, first_line_sunshine_online_points_flag, first_line_sunshine2_online_points_flag, other_fee_divide_target, first_line_sunshine_online_points_flag, first_line_sunshine2_online_points_flag,
reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level, reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, management_marketing_fees_prerequisite,
first_line_sunshine_prerequisite, deleted_flag
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="shelf_style" property="shelfStyle" jdbcType="TINYINT" />
<result column="old_merchant_goods_code" property="oldMerchantGoodsCode" jdbcType="VARCHAR" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductBaseDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductBaseDTO" extends="BaseResultMap">
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee, revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee,
manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee, manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee,
resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish, resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, shelf_style, old_merchant_goods_code, deleted_flag
</sql> </sql>
<select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase" resultMap="BaseResultMap"> <select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase" resultMap="BaseResultMap">
...@@ -78,7 +80,7 @@ ...@@ -78,7 +80,7 @@
<select id="getDetailById" resultMap="DTOResultMap"> <select id="getDetailById" resultMap="DTOResultMap">
select select
glpb.id, glpb.business_code, glpb.product_type, glpb.settlement_type, glpb.product_name,glpb.package_code, glpb.id, glpb.business_code, glpb.product_type, glpb.settlement_type, glpb.product_name,glpb.package_code,
glpb.package_alias,glpb.sales_proportion_percent, glpb.package_alias,glpb.sales_proportion_percent, glpb.shelf_style, glpb.old_merchant_goods_code,
glpd.upgrade_goods_id, glpd.upgrade_commodity_code, glpd.upgrade_goods_name, glpd.upgrade_goods_id, glpd.upgrade_commodity_code, glpd.upgrade_goods_name,
glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost, glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost,
glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type,glpd.merchant_goods_code glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type,glpd.merchant_goods_code
...@@ -92,7 +94,8 @@ ...@@ -92,7 +94,8 @@
id, business_code, product_type, settlement_type, product_name,package_code,package_alias, sales_proportion_percent, id, business_code, product_type, settlement_type, product_name,package_code,package_alias, sales_proportion_percent,
revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee, revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee,
manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee, manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee,
resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish,
shelf_style, old_merchant_goods_code
from dj_car_life_goods_listing_product_base glpb from dj_car_life_goods_listing_product_base glpb
<include refid="listCondition"/> <include refid="listCondition"/>
order by glpb.id asc order by glpb.id asc
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(Top 3)

    1. 潜在的 Insert/Update SQL 语句遗漏(功能实现风险)

    • 问题描述:在提交的三个 Mapper XML 文件(GoodsListingApprovalMapper.xml、GoodsListingBaseRuleMapper.xml、GoodsListingProductBaseMapper.xml)中,新增字段已成功添加到 BaseResultMap、Base_Column_List 以及 <select> 查询语句中。但从 Diff 视图来看,未看到对应 <insert> 和 <update> 语句的修改。
    • 影响分析:如果当前项目使用的是原生 MyBatis(非 MyBatis-Plus 等动态 ORM 框架),遗漏 <insert> 和 <update> 标签中的字段映射,将导致新增的字段数据无法落库或无法更新,直接造成功能缺陷。
    • 优化建议:请全局检索并确认这三个 XML 文件中的 <insert>、<insertSelective>、<update> 或 <updateSelective> 语句,确保 shelf_model、management_marketing_fees_prerequisite、shelf_style 等所有新增字段已被正确补充。

    2. 状态标识缺乏枚举或常量定义(最佳实践)

    • 问题描述:实体类中新增的 shelfModel(1-特殊商品上架 2-常规商品上架)和 shelfStyle(1-新增 2-修改)使用了 Byte 类型,且仅在注释中说明了具体含义。
    • 影响分析:在后续的业务逻辑(Service 层)处理中,极易出现直接使用 1、2 等“魔法数字”(Magic Number)进行条件判断的情况。这不仅降低了代码的可读性,后续若状态扩展或变更,重构成本较高且容易引发 Bug。
    • 优化建议:建议为这些状态字段定义对应的枚举类(Enum)或在常量类中定义静态常量。 java // 示例 public enum ShelfModelEnum { SPECIAL((byte)1, "特殊商品上架"), NORMAL((byte)2, "常规商品上架"); // ... 构造及获取方法 }

    3. Swagger 注解 @ApiModelProperty 属性使用不规范(最佳实践)

    • 问题描述:代码中使用了 @ApiModelProperty(name = "shelfModel", notes = "...") 的写法。
    • 影响分析:在 Swagger 规范中,name 属性通常用于重写属性的名称(即改变接口文档中展示的字段名)。如果要为字段提供中文描述,应该使用 value 属性。虽然当前 name 的值与字段名一致未引发错误,但这属于注解的非规范使用。
    • 优化建议:将 name 替换为 value,例如: @ApiModelProperty(value = "上架模式 1-特殊商品上架 2-常规商品上架", notes = "...")

    二、评分明细

    • 功能实现的正确性与健壮性(35/40分)

      • 理由:模型字段扩展逻辑基本合理,XML 查询条件拼接正确(使用了 <if> 标签防止空指针),未发现 MyBatis 子查询,未发现 Dubbo Remote 接口变更。扣分点在于高度疑似遗漏了 insert/update 的 SQL 语句修改,存在数据无法落库的风险。
    • 安全性与潜在风险(30/30分)

      • 理由:SQL 参数绑定严格使用了 #{} 语法,不存在 SQL 注入风险。新增字段均为常规业务字段,不涉及敏感信息越权或泄露风险。
    • 最佳实践与可维护性(16/20分)

      • 理由:代码结构与原有风格保持一致,数据库字段与 Java 驼峰命名映射规范。扣分点在于业务状态标识未使用枚举(魔法数字隐患),以及 Swagger 注解属性使用不够标准。
    • 性能与资源利用(5/5分)

      • 理由:仅为单表增加常规字段映射,查询条件增加了正确的等值匹配,不存在引发慢 SQL 的明显性能瓶颈,资源利用合理。
    • 提交信息质量(5/5分)

      • 理由:Commit message 格式非常标准(符合 Conventional Commits 规范),清晰地说明了 feat(goods) 的业务背景,并通过列表详细列出了各个文件的具体变更内容与作用,可追溯性极强。

    总分:91分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!