Commit 63dd1df2 by 崔彦峰

feat(model): 添加对账品类分组关联分账品类分组ID字段

- 在GoodsListingGoodsTypeGroup实体类中新增relationDivId属性
- 为新字段添加注释说明其用途
- 在ORM映射文件中配置relation_div_id字段映射关系
- 更新基础查询SQL包含新的relation_div_id字段
- 更新详情查询SQL以返回关联的分账品类分组ID信息
1 parent 3aa68176
...@@ -62,6 +62,13 @@ public class GoodsListingGoodsTypeGroup implements Serializable { ...@@ -62,6 +62,13 @@ public class GoodsListingGoodsTypeGroup implements Serializable {
private Byte categoryType; private Byte categoryType;
/** /**
* 对账品类分组关联的分账品类分组id
*/
@ApiModelProperty(name = "relationDivId", notes = "对账品类分组关联的分账品类分组id")
@Column(name = "relation_div_id")
private Integer relationDivId;
/**
* 创建人 * 创建人
*/ */
@ApiModelProperty(name = "createdBy", notes = "创建人") @ApiModelProperty(name = "createdBy", notes = "创建人")
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="group_type" property="groupType" jdbcType="TINYINT" /> <result column="group_type" property="groupType" jdbcType="TINYINT" />
<result column="rule_type" property="ruleType" jdbcType="TINYINT" /> <result column="rule_type" property="ruleType" jdbcType="TINYINT" />
<result column="category_type" property="categoryType" jdbcType="TINYINT" /> <result column="category_type" property="categoryType" jdbcType="TINYINT" />
<result column="relation_div_id" property="relationDivId" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" /> <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<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" />
...@@ -39,12 +40,12 @@ ...@@ -39,12 +40,12 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, business_code, group_type, rule_type, category_type, created_by, created_date, id, business_code, group_type, rule_type, category_type, relation_div_id, created_by, created_date,
updated_by, updated_date, deleted_flag updated_by, updated_date, deleted_flag
</sql> </sql>
<select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingGoodsTypeGroupDTO" resultMap="DTOResultMap"> <select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingGoodsTypeGroupDTO" resultMap="DTOResultMap">
select id, business_code, group_type, category_type from dj_car_life_goods_listing_goods_type_group select id, business_code, group_type, category_type, relation_div_id from dj_car_life_goods_listing_goods_type_group
<where> <where>
deleted_flag = 'N' deleted_flag = 'N'
<if test="businessCode != null and businessCode !=''"> <if test="businessCode != null and businessCode !=''">
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
<select id="getDetailById" resultMap="DTOResultMap"> <select id="getDetailById" resultMap="DTOResultMap">
SELECT SELECT
glgtg.id, glgtg.business_code, glgtg.group_type, glgtg.rule_type, glgtg.category_type, glgtg.id, glgtg.business_code, glgtg.group_type, glgtg.rule_type, glgtg.category_type, glgtg.relation_div_id,
glgtgr.upgrade_goods_id,glgtgr.merchant_goods_code, glgtgr.upgrade_commodity_code, glgtgr.upgrade_goods_name, glgtgr.upgrade_goods_id,glgtgr.merchant_goods_code, glgtgr.upgrade_commodity_code, glgtgr.upgrade_goods_name,
glgtgr.goods_type, glgtgr.goods_type_name, glgtgr.package_code, glgtgr.package_name, glgtgr.goods_type, glgtgr.goods_type_name, glgtgr.package_code, glgtgr.package_name,
......
  • @wangxw1
    commented
    Master

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

    1. 手动修改 MyBatis Generator (MBG) 自动生成的代码块存在被覆盖风险

    • 问题描述:在 GoodsListingGoodsTypeGroupMapper.xml 文件中,开发者手动在 <sql id="Base_Column_List"> 中添加了 relation_div_id 字段。但该代码块上方带有 <!-- WARNING - @mbg.generated --> 注释,表明这是由 MyBatis Generator 自动生成的代码。
    • 影响分析:违反了代码生成工具的使用规范。未来如果数据库表结构发生变化并再次运行 MyBatis Generator,该 Base_Column_List 会被重新生成,导致手动添加的 relation_div_id 字段丢失,进而引发线上运行时的 SQL 映射异常。
    • 优化建议: 建议通过更新数据库表结构并重新运行 MyBatis Generator 来生成基础的 Mapper XML 代码,而不是手动修改带有 @mbg.generated 警告的区域。如果项目已经废弃了 MBG 自动生成流程,建议将该警告注释删除以免引起误解;如果仍在使用,请务必遵循生成器规范。

    (注:本次提交代码逻辑清晰,未发现 MyBatis 子查询及 Dubbo 接口参数变更等违规情况,仅存在上述 1 个工程实践类问题。)


    二、评分明细

    • 1. 功能实现的正确性与健壮性(40 / 40分) 理由:Java 实体类与 XML 映射文件同步更新,字段类型(Integer 对应 jdbcType="INTEGER")匹配正确。严格遵守了“MyBatis 不允许使用子查询”和“Dubbo 服务提供者 Remote 接口参数不可变更”的重要规则,功能逻辑正确。

    • 2. 安全性与潜在风险(30 / 30分) 理由:本次变更为纯粹的模型与基础查询字段扩展,未引入动态 SQL 拼接漏洞,无 SQL 注入风险,不存在越权或敏感信息泄露的安全隐患。

    • 3. 最佳实践与可维护性(17 / 20分) 理由:Swagger 注解(@ApiModelProperty)和 JPA/MyBatis 注解(@Column)使用规范,代码可读性良好。扣除 3 分是因为直接修改了带有 @mbg.generated 警告的自动生成代码块,存在后期维护时代码被覆盖的风险。

    • 4. 性能与资源利用(5 / 5分) 理由:仅在查询列表中增加了一个整形字段的返回,对数据库 I/O 和内存开销的影响微乎其微,无性能瓶颈。

    • 5. 提交信息质量(5 / 5分) 理由:Commit message 采用了标准的 Conventional Commits 格式(feat(model): ...),且在正文中分点详细描述了实体类、XML、SQL 的具体变更点,清晰、准确、可追溯,质量极高。

    总分:97分

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