From 5054ccea61fa8742ac325d7b81cad39049d155d9 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 6 Nov 2024 17:55:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E9=80=9A=E7=9F=A5=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=80=9A=E7=9F=A5=E5=8F=96=E5=80=BC=E6=9C=89?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047046 --user=宋昌昌 【消息通知】缺陷管理的消息通知中自定义字段获取不到实际值 https://www.tapd.cn/55049933/s/1606574 --- .../bug/domain/BugCustomField.java | 6 +- .../bug/domain/BugCustomFieldExample.java | 70 ------------- .../bug/mapper/BugCustomFieldMapper.java | 10 +- .../bug/mapper/BugCustomFieldMapper.xml | 97 +++++++++++++----- .../migration/3.5.0/ddl/V3.5.0_2__ga_ddl.sql | 2 + .../bug/mapper/ExtBugCustomFieldMapper.xml | 2 +- .../bug/service/BugNoticeService.java | 98 +++++++------------ .../metersphere/bug/service/BugService.java | 44 ++++++--- 8 files changed, 152 insertions(+), 177 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomField.java b/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomField.java index 19adc8398b..90d47097f0 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomField.java +++ b/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomField.java @@ -26,12 +26,16 @@ public class BugCustomField implements Serializable { @Schema(description = "字段值") private String value; + @Schema(description = "字段文本") + private String content; + private static final long serialVersionUID = 1L; public enum Column { bugId("bug_id", "bugId", "VARCHAR", false), fieldId("field_id", "fieldId", "VARCHAR", false), - value("value", "value", "VARCHAR", true); + value("value", "value", "LONGVARCHAR", true), + content("content", "content", "LONGVARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomFieldExample.java b/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomFieldExample.java index 4d56bdcb2e..3916f67579 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomFieldExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/bug/domain/BugCustomFieldExample.java @@ -243,76 +243,6 @@ public class BugCustomFieldExample { addCriterion("field_id not between", value1, value2, "fieldId"); return (Criteria) this; } - - public Criteria andValueIsNull() { - addCriterion("`value` is null"); - return (Criteria) this; - } - - public Criteria andValueIsNotNull() { - addCriterion("`value` is not null"); - return (Criteria) this; - } - - public Criteria andValueEqualTo(String value) { - addCriterion("`value` =", value, "value"); - return (Criteria) this; - } - - public Criteria andValueNotEqualTo(String value) { - addCriterion("`value` <>", value, "value"); - return (Criteria) this; - } - - public Criteria andValueGreaterThan(String value) { - addCriterion("`value` >", value, "value"); - return (Criteria) this; - } - - public Criteria andValueGreaterThanOrEqualTo(String value) { - addCriterion("`value` >=", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLessThan(String value) { - addCriterion("`value` <", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLessThanOrEqualTo(String value) { - addCriterion("`value` <=", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLike(String value) { - addCriterion("`value` like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueNotLike(String value) { - addCriterion("`value` not like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueIn(List values) { - addCriterion("`value` in", values, "value"); - return (Criteria) this; - } - - public Criteria andValueNotIn(List values) { - addCriterion("`value` not in", values, "value"); - return (Criteria) this; - } - - public Criteria andValueBetween(String value1, String value2) { - addCriterion("`value` between", value1, value2, "value"); - return (Criteria) this; - } - - public Criteria andValueNotBetween(String value1, String value2) { - addCriterion("`value` not between", value1, value2, "value"); - return (Criteria) this; - } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.java b/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.java index 20f2758296..4ad6bf2a2b 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.java +++ b/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.java @@ -11,23 +11,27 @@ public interface BugCustomFieldMapper { int deleteByExample(BugCustomFieldExample example); - int deleteByPrimaryKey(String bugId); + int deleteByPrimaryKey(@Param("bugId") String bugId, @Param("fieldId") String fieldId); int insert(BugCustomField record); int insertSelective(BugCustomField record); + List selectByExampleWithBLOBs(BugCustomFieldExample example); + List selectByExample(BugCustomFieldExample example); - BugCustomField selectByPrimaryKey(String bugId); + BugCustomField selectByPrimaryKey(@Param("bugId") String bugId, @Param("fieldId") String fieldId); int updateByExampleSelective(@Param("record") BugCustomField record, @Param("example") BugCustomFieldExample example); + int updateByExampleWithBLOBs(@Param("record") BugCustomField record, @Param("example") BugCustomFieldExample example); + int updateByExample(@Param("record") BugCustomField record, @Param("example") BugCustomFieldExample example); int updateByPrimaryKeySelective(BugCustomField record); - int updateByPrimaryKey(BugCustomField record); + int updateByPrimaryKeyWithBLOBs(BugCustomField record); int batchInsert(@Param("list") List list); diff --git a/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.xml index b59acfe154..346898dfa3 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/bug/mapper/BugCustomFieldMapper.xml @@ -3,8 +3,11 @@ - - + + + + + @@ -65,8 +68,27 @@ - bug_id, field_id, `value` + bug_id, field_id + + `value`, content + + - select + , + from bug_custom_field where bug_id = #{bugId,jdbcType=VARCHAR} + and field_id = #{fieldId,jdbcType=VARCHAR} - + delete from bug_custom_field where bug_id = #{bugId,jdbcType=VARCHAR} + and field_id = #{fieldId,jdbcType=VARCHAR} delete from bug_custom_field @@ -98,10 +124,10 @@ - insert into bug_custom_field (bug_id, field_id, `value` - ) - values (#{bugId,jdbcType=VARCHAR}, #{fieldId,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR} - ) + insert into bug_custom_field (bug_id, field_id, `value`, + content) + values (#{bugId,jdbcType=VARCHAR}, #{fieldId,jdbcType=VARCHAR}, #{value,jdbcType=LONGVARCHAR}, + #{content,jdbcType=LONGVARCHAR}) insert into bug_custom_field @@ -115,6 +141,9 @@ `value`, + + content, + @@ -124,7 +153,10 @@ #{fieldId,jdbcType=VARCHAR}, - #{value,jdbcType=VARCHAR}, + #{value,jdbcType=LONGVARCHAR}, + + + #{content,jdbcType=LONGVARCHAR}, @@ -144,18 +176,30 @@ field_id = #{record.fieldId,jdbcType=VARCHAR}, - `value` = #{record.value,jdbcType=VARCHAR}, + `value` = #{record.value,jdbcType=LONGVARCHAR}, + + + content = #{record.content,jdbcType=LONGVARCHAR}, + + update bug_custom_field + set bug_id = #{record.bugId,jdbcType=VARCHAR}, + field_id = #{record.fieldId,jdbcType=VARCHAR}, + `value` = #{record.value,jdbcType=LONGVARCHAR}, + content = #{record.content,jdbcType=LONGVARCHAR} + + + + update bug_custom_field set bug_id = #{record.bugId,jdbcType=VARCHAR}, - field_id = #{record.fieldId,jdbcType=VARCHAR}, - `value` = #{record.value,jdbcType=VARCHAR} + field_id = #{record.fieldId,jdbcType=VARCHAR} @@ -163,28 +207,30 @@ update bug_custom_field - - field_id = #{fieldId,jdbcType=VARCHAR}, - - `value` = #{value,jdbcType=VARCHAR}, + `value` = #{value,jdbcType=LONGVARCHAR}, + + + content = #{content,jdbcType=LONGVARCHAR}, where bug_id = #{bugId,jdbcType=VARCHAR} + and field_id = #{fieldId,jdbcType=VARCHAR} - + update bug_custom_field - set field_id = #{fieldId,jdbcType=VARCHAR}, - `value` = #{value,jdbcType=VARCHAR} + set `value` = #{value,jdbcType=LONGVARCHAR}, + content = #{content,jdbcType=LONGVARCHAR} where bug_id = #{bugId,jdbcType=VARCHAR} + and field_id = #{fieldId,jdbcType=VARCHAR} insert into bug_custom_field - (bug_id, field_id, `value`) + (bug_id, field_id, `value`, content) values - (#{item.bugId,jdbcType=VARCHAR}, #{item.fieldId,jdbcType=VARCHAR}, #{item.value,jdbcType=VARCHAR} - ) + (#{item.bugId,jdbcType=VARCHAR}, #{item.fieldId,jdbcType=VARCHAR}, #{item.value,jdbcType=LONGVARCHAR}, + #{item.content,jdbcType=LONGVARCHAR}) @@ -204,7 +250,10 @@ #{item.fieldId,jdbcType=VARCHAR} - #{item.value,jdbcType=VARCHAR} + #{item.value,jdbcType=LONGVARCHAR} + + + #{item.content,jdbcType=LONGVARCHAR} ) diff --git a/backend/framework/domain/src/main/resources/migration/3.5.0/ddl/V3.5.0_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.5.0/ddl/V3.5.0_2__ga_ddl.sql index 4054ca7199..c59e709bc9 100644 --- a/backend/framework/domain/src/main/resources/migration/3.5.0/ddl/V3.5.0_2__ga_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.5.0/ddl/V3.5.0_2__ga_ddl.sql @@ -1,6 +1,8 @@ -- set innodb lock wait timeout SET SESSION innodb_lock_wait_timeout = 7200; +-- 缺陷自定义字段增加文本字段 +ALTER TABLE bug_custom_field ADD COLUMN `content` VARCHAR(1000) COMMENT '字段文本'; -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugCustomFieldMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugCustomFieldMapper.xml index f47fb0af45..69e923ae7b 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugCustomFieldMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugCustomFieldMapper.xml @@ -11,7 +11,7 @@