Commit b95cb645 by 崔彦峰

modify:考试列表新增 是否只查询未关联培训计划的考试筛选字段。

1 parent 609dbaed
......@@ -74,4 +74,10 @@ public class LevelExamPageListRequestDTO implements Serializable {
*/
private List<Integer> departmentIds;
/**
* 是否只查询未关联培训计划的考试
*/
@ApiModelProperty(notes = "是否只查询未关联培训计划的考试: true-是, false-否,不传默认查全部")
private Boolean notRelatedPlan;
}
......@@ -46,31 +46,40 @@
<select id="levelExamListPage" resultMap="DTOBaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM dj_car_life_learning_center_level_exam
WHERE deleted_flag = 'N'
FROM dj_car_life_learning_center_level_exam exam
WHERE exam.deleted_flag = 'N'
<if test="notRelatedPlan != null and notRelatedPlan">
AND NOT EXISTS (
SELECT 1
FROM dj_car_life_learning_center_training_plan plan
WHERE plan.exam_id = exam.id
AND plan.deleted_flag = 'N'
AND plan.scene_type = 1
)
</if>
<if test="beisenExamName != null and beisenExamName != ''">
AND beisen_exam_name LIKE CONCAT('%', #{beisenExamName}, '%')
AND exam.beisen_exam_name LIKE CONCAT('%', #{beisenExamName}, '%')
</if>
<if test="positionCode != null and positionCode != ''">
AND position_code = #{positionCode}
AND exam.position_code = #{positionCode}
</if>
<if test="status != null">
AND status = #{status}
AND exam.status = #{status}
</if>
<if test="creator != null and creator != ''">
AND creator LIKE CONCAT('%', #{creator}, '%')
AND exam.creator LIKE CONCAT('%', #{creator}, '%')
</if>
<if test="createdStartDate != null and createdEndDate != null">
AND created_date BETWEEN #{createdStartDate} AND #{createdEndDate}
AND exam.created_date BETWEEN #{createdStartDate} AND #{createdEndDate}
</if>
<if test="createdStartDate != null and createdEndDate == null">
AND created_date &gt;= #{createdStartDate}
AND exam.created_date &gt;= #{createdStartDate}
</if>
<if test="createdStartDate == null and createdEndDate != null">
AND created_date &lt;= #{createdEndDate}
AND exam.created_date &lt;= #{createdEndDate}
</if>
<if test="departmentIds != null and departmentIds.size() > 0">
and department_id in
AND exam.department_id in
<foreach item="item" collection="departmentIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
......@@ -78,25 +87,25 @@
ORDER BY
<choose>
<when test="orderByType != null and orderByType == 0">
created_date ASC
exam.created_date ASC
</when>
<when test="orderByType != null and orderByType == 1">
created_date DESC
exam.created_date DESC
</when>
<when test="orderByType != null and orderByType == 2">
submitted_count ASC
exam.submitted_count ASC
</when>
<when test="orderByType != null and orderByType == 3">
submitted_count DESC
exam.submitted_count DESC
</when>
<when test="orderByType != null and orderByType == 4">
effective_time ASC
exam.effective_time ASC
</when>
<when test="orderByType != null and orderByType == 5">
effective_time DESC
exam.effective_time DESC
</when>
<otherwise>
id DESC
exam.id DESC
</otherwise>
</choose>
</select>
......
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    1. 功能实现的正确性与健壮性

    问题描述: 新增字段 notRelatedPlan 的默认值未明确指定。如果客户端没有传递该参数,notRelatedPlan 将为 null,这可能导致业务逻辑中的空指针异常或其他未定义行为。

    优化建议: 明确设置默认值。可以在类的构造函数中初始化,或者使用 @Builder 注解的 @Builder.Default 来设置默认值。

    @Builder
    public class LevelExamPageListRequestDTO implements Serializable {
        // 其他字段...
    
        /**
         * 是否只查询未关联培训计划的考试
         */
        @ApiModelProperty(notes = "是否只查询未关联培训计划的考试: true-是, false-否,不传默认查全部")
        @Builder.Default
        private Boolean notRelatedPlan = false;
    }
    

    2. 安全性与潜在风险

    问题描述: 无明显安全漏洞,但新增字段需要在业务逻辑中进行适当的验证和处理,以防止潜在的安全问题。

    优化建议: 在业务逻辑层添加对 notRelatedPlan 字段的验证和处理,确保其值的有效性和安全性。

    3. 是否符合最佳实践

    问题描述: 新增字段的注释和文档字符串已经很清晰,但缺少对字段的 getter 和 setter 方法的生成,这可能会影响到代码的可维护性和可读性。

    优化建议: 使用 Lombok 注解自动生成 getter 和 setter 方法,或者手动编写这些方法。

    @Getter
    @Setter
    @Builder
    public class LevelExamPageListRequestDTO implements Serializable {
        // 字段定义...
    }
    

    4. 性能与资源利用效率

    问题描述: 新增字段不会对性能产生直接影响,但如果在大规模数据处理场景下使用不当,可能会导致性能问题。

    优化建议: 确保在业务逻辑中合理使用该字段,避免不必要的计算和资源消耗。

    5. Commits信息的清晰性与准确性

    问题描述: 提交信息简洁明了,但可以进一步细化,明确指出修改的具体内容和影响范围。

    优化建议: 增加更多细节,例如修改的具体原因和预期效果。

    modify: 考试列表新增是否只查询未关联培训计划的考试筛选字段,以支持更灵活的查询需求。
    

    评分明细

    1. 功能实现的正确性与健壮性: 35/40 分(默认值未明确指定)
    2. 安全性与潜在风险: 28/30 分(无明显安全漏洞,但需要进一步验证)
    3. 是否符合最佳实践: 16/20 分(缺少 getter 和 setter 方法)
    4. 性能与资源利用效率: 5/5 分(无明显性能问题)
    5. Commits信息的清晰性与准确性: 4/5 分(信息较为清晰,但可以进一步细化)

    总分: 88分


    以上是针对代码变更内容的详细审查报告。希望这些建议能帮助改进代码的质量和稳定性。

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