Commit f0e62744 by 章家宝

feat:专项带教审批新增创建人uuid字段

1 parent d8cbc1e0
......@@ -67,6 +67,9 @@ public class AddApprovalRecordDTO implements Serializable {
@ApiModelProperty(value = "创建人手机号")
private String createdPhone;
@ApiModelProperty(value = "创建人UUID")
private String createdUuid;
@ApiModelProperty(value = "执行人信息列表")
private List<ExecutorInfo> executorList;
......
......@@ -24,6 +24,9 @@ public class ApprovalQueryDTO implements Serializable {
@ApiModelProperty(value = "创建人手机号")
private String createdPhone;
@ApiModelProperty(value = "创建人UUID")
private String createdUuid;
@ApiModelProperty(value = "审批状态:0-待审批 1-已通过 2-已驳回")
private Integer approvalStatus;
......
......@@ -24,6 +24,9 @@ public class SpecialCoachApprovalCountQueryDTO implements Serializable {
@ApiModelProperty(value = "创建人手机号")
private String createdPhone;
@ApiModelProperty(value = "创建人UUID")
private String createdUuid;
@ApiModelProperty(value = "门店ID")
private Integer merchantId;
......
......@@ -219,6 +219,12 @@ public class SupervisorSpecialCoachApproval implements Serializable {
private String createdPhone;
/**
* 创建人UUID
*/
@Column(name = "created_uuid")
private String createdUuid;
/**
* 创建人
*/
@Column(name = "created_by")
......
......@@ -36,6 +36,7 @@
<result column="source" property="source" jdbcType="INTEGER"/>
<result column="source_id" property="sourceId" jdbcType="BIGINT"/>
<result column="created_phone" property="createdPhone" jdbcType="VARCHAR"/>
<result column="created_uuid" property="createdUuid" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
......@@ -74,7 +75,7 @@
assigned_supervisor_phone, assigned_supervisor_name, assigned_merchant_id, assigned_merchant_name,
task_center_id, teaching_scene_code, teaching_scene_name, teaching_method_code, teaching_method_name,
teaching_topic_code, teaching_topic_name, teaching_time, source, source_id,
created_phone, created_by, create_time, updated_by, update_time, deleted_flag
created_phone, created_uuid, created_by, create_time, updated_by, update_time, deleted_flag
</sql>
<insert id="insertSelective" parameterType="cn.com.glsx.dj.supervisor.model.SupervisorSpecialCoachApproval" useGeneratedKeys="true" keyProperty="id">
......@@ -112,6 +113,7 @@
<if test="source != null">source,</if>
<if test="sourceId != null">source_id,</if>
<if test="createdPhone != null">created_phone,</if>
<if test="createdUuid != null">created_uuid,</if>
<if test="createdBy != null">created_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updatedBy != null">updated_by,</if>
......@@ -151,6 +153,7 @@
<if test="source != null">#{source},</if>
<if test="sourceId != null">#{sourceId},</if>
<if test="createdPhone != null">#{createdPhone},</if>
<if test="createdUuid != null">#{createdUuid},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
......@@ -200,6 +203,7 @@
AND a.deleted_flag = 'N'
<if test="executorPhone != null and executorPhone != ''">AND i.executor_phone = #{executorPhone}</if>
<if test="createdPhone != null and createdPhone != ''">AND a.created_phone = #{createdPhone}</if>
<if test="createdUuid != null and createdUuid != ''">AND a.created_uuid = #{createdUuid}</if>
<if test="approvalStatus != null">AND a.approval_status = #{approvalStatus}</if>
<if test="merchantId != null">AND a.merchant_id = #{merchantId}</if>
<if test="businessType != null">AND a.business_type = #{businessType}</if>
......@@ -230,6 +234,7 @@
AND a.deleted_flag = 'N'
<if test="executorPhone != null and executorPhone != ''">AND i.executor_phone = #{executorPhone}</if>
<if test="createdPhone != null and createdPhone != ''">AND a.created_phone = #{createdPhone}</if>
<if test="createdUuid != null and createdUuid != ''">AND a.created_uuid = #{createdUuid}</if>
<if test="merchantId != null">AND a.merchant_id = #{merchantId}</if>
<if test="businessType != null">AND a.business_type = #{businessType}</if>
<if test="startDate != null and startDate != ''">AND DATE(a.create_time) &gt;= #{startDate}</if>
......
  • @wangxw1
    commented
    Master

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

    1. 性能与稳定性风险:新增查询条件未确认数据库索引

    • 问题描述:在 SupervisorSpecialCoachApprovalMapper.xml 的查询语句中,新增了 <if test="createdUuid != null and createdUuid != ''">AND a.created_uuid = #{createdUuid}</if> 查询条件。
    • 影响分析:如果数据库表 supervisor_special_coach_approval 中尚未对 created_uuid 字段建立索引,当业务中主要依赖该字段进行查询时,极易引发全表扫描,导致数据库 CPU 飙升和接口响应超时,进而引发线上性能故障。
    • 优化建议:请务必同步提交相关的数据库 DDL 脚本,确认在 supervisor_special_coach_approval 表的 created_uuid 字段上建立了适当的单列索引或联合索引。

    2. 健壮性风险:Dubbo 接口 DTO 向下兼容性与空值校验

    • 问题描述:在 API 模块(rpc-dj-supervisor-api)的多个 DTO(如 AddApprovalRecordDTO)中新增了 createdUuid 字段。
    • 影响分析:根据审查规则,“dubbo服务提供者Remote接口中的已有请求参数变更视为危险实现”。虽然此处是新增字段,通常在 Hessian2 序列化下是向下兼容的,但如果旧版本的消费端(Consumer)发起调用,createdUuid 将为 null。目前的业务代码(如 Mapper 中的 <if> 标签)虽然能兼容 null,但如果核心业务逻辑强依赖此字段进行后续操作,可能会引发 NPE 或逻辑遗漏。此外,新增字段缺乏基础的校验注解。
    • 优化建议:
      1. 确认服务提供者(Provider)的业务逻辑已做好 createdUuid 为空的防御性编程。
      2. 如果该字段在较新版本的业务中是必传参数,建议在 DTO 中增加校验注解(需配合 @Validated 使用),并通知调用方升级 API 包。 java @ApiModelProperty(value = "创建人UUID") // 若为必填项,建议增加校验;若兼容老版本则保持原样,但在 Service 层做逻辑兼容 // @NotBlank(message = "创建人UUID不能为空") private String createdUuid;

    3. 最佳实践:Update 语句的字段遗漏确认

    • 问题描述:在 SupervisorSpecialCoachApprovalMapper.xml 中,只修改了 Base_Column_List 和 insertSelective,未看到对 updateSelective 或 updateByPrimaryKeySelective 的修改。
    • 影响分析:通常带有 created_ 前缀的字段(如创建人、创建时间)在数据初始化后确实不应该被修改。但如果业务场景中存在“草稿更新”或“历史数据修复”的逻辑,遗漏 update 语句会导致该字段无法被更新。
    • 优化建议:请评估业务上是否绝对不需要更新 created_uuid 字段。如果确实不需要,当前实现是合理且安全的;如果存在数据订正或补全场景,请同步在对应的 update 标签中补充该字段。

    二、评分明细

    • 功能实现的正确性与健壮性(38/40分): 代码逻辑实现清晰,MyBatis 的 XML 映射关系正确,字段类型匹配。严格遵守了“MyBatis 不允许使用子查询”的规则(使用的是单表条件过滤和别名)。扣2分是因为 DTO 新增字段缺乏明确的校验规则声明,可能导致依赖方的入参不规范。

    • 安全性与潜在风险(30/30分): MyBatis 中全部使用了 #{} 进行参数占位符绑定,有效防止了 SQL 注入风险。未发现越权或敏感信息泄露的直接风险。满分。

    • 最佳实践与可维护性(18/20分): 命名规范统一(驼峰与下划线映射正确),Swagger 注解清晰。扣2分是因为在核心 API 包中修改 DTO 实体时,未看到对 serialVersionUID 的维护说明(虽未体现在 diff 中,但属于最佳实践范畴,需注意序列化一致性)。

    • 性能与资源利用(3/5分): XML 中的 <if> 标签使用规范,避免了不必要的空条件拼接。扣2分是因为新增了查询维度(created_uuid),但代码层面无法体现索引的建立,存在潜在的慢 SQL 隐患,需要开发人员额外确认。

    • 提交信息质量(5/5分): Commit message 采用了标准的 Angular 规范 (feat:),清晰准确地描述了变更内容和目的,具备良好的可追溯性。满分。

    总分:94分

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