refactor: 缺陷添加创建人字段
This commit is contained in:
parent
ed898fe71e
commit
ae624768b3
|
@ -23,5 +23,7 @@ public class Issues implements Serializable {
|
|||
|
||||
private String projectId;
|
||||
|
||||
private String creator;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -8,4 +8,5 @@ import lombok.Setter;
|
|||
public class IssuesDao extends IssuesWithBLOBs {
|
||||
private String model;
|
||||
private String projectName;
|
||||
private String creatorName;
|
||||
}
|
||||
|
|
|
@ -713,6 +713,76 @@ public class IssuesExample {
|
|||
addCriterion("project_id not between", value1, value2, "projectId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorIsNull() {
|
||||
addCriterion("creator is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorIsNotNull() {
|
||||
addCriterion("creator is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorEqualTo(String value) {
|
||||
addCriterion("creator =", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorNotEqualTo(String value) {
|
||||
addCriterion("creator <>", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorGreaterThan(String value) {
|
||||
addCriterion("creator >", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("creator >=", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorLessThan(String value) {
|
||||
addCriterion("creator <", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorLessThanOrEqualTo(String value) {
|
||||
addCriterion("creator <=", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorLike(String value) {
|
||||
addCriterion("creator like", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorNotLike(String value) {
|
||||
addCriterion("creator not like", value, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorIn(List<String> values) {
|
||||
addCriterion("creator in", values, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorNotIn(List<String> values) {
|
||||
addCriterion("creator not in", values, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorBetween(String value1, String value2) {
|
||||
addCriterion("creator between", value1, value2, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreatorNotBetween(String value1, String value2) {
|
||||
addCriterion("creator not between", value1, value2, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<result column="lastmodify" jdbcType="VARCHAR" property="lastmodify" />
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.IssuesWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -75,7 +76,8 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, title, `status`, create_time, update_time, reporter, lastmodify, platform, project_id
|
||||
id, title, `status`, create_time, update_time, reporter, lastmodify, platform, project_id,
|
||||
creator
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, custom_fields
|
||||
|
@ -132,11 +134,13 @@
|
|||
insert into issues (id, title, `status`,
|
||||
create_time, update_time, reporter,
|
||||
lastmodify, platform, project_id,
|
||||
description, custom_fields)
|
||||
creator, description, custom_fields
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{reporter,jdbcType=VARCHAR},
|
||||
#{lastmodify,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{customFields,jdbcType=LONGVARCHAR})
|
||||
#{creator,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{customFields,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.IssuesWithBLOBs">
|
||||
insert into issues
|
||||
|
@ -168,6 +172,9 @@
|
|||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -203,6 +210,9 @@
|
|||
<if test="projectId != null">
|
||||
#{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -247,6 +257,9 @@
|
|||
<if test="record.projectId != null">
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -269,6 +282,7 @@
|
|||
lastmodify = #{record.lastmodify,jdbcType=VARCHAR},
|
||||
platform = #{record.platform,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
custom_fields = #{record.customFields,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -285,7 +299,8 @@
|
|||
reporter = #{record.reporter,jdbcType=VARCHAR},
|
||||
lastmodify = #{record.lastmodify,jdbcType=VARCHAR},
|
||||
platform = #{record.platform,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR}
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
creator = #{record.creator,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -317,6 +332,9 @@
|
|||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -336,6 +354,7 @@
|
|||
lastmodify = #{lastmodify,jdbcType=VARCHAR},
|
||||
platform = #{platform,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
custom_fields = #{customFields,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -349,7 +368,8 @@
|
|||
reporter = #{reporter,jdbcType=VARCHAR},
|
||||
lastmodify = #{lastmodify,jdbcType=VARCHAR},
|
||||
platform = #{platform,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR}
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
creator = #{creator,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -14,6 +14,7 @@
|
|||
<select id="getIssuesByProjectId" resultType="io.metersphere.base.domain.IssuesDao">
|
||||
select issues.id, ifnull(issues.title, '') as title, issues.project_id, issues.create_time, issues.update_time,
|
||||
ifnull(issues.description, '') as description, issues.status, issues.platform, issues.custom_fields, issues.reporter,
|
||||
issues.creator,
|
||||
issues.lastmodify
|
||||
from issues
|
||||
<include refid="queryWhereCondition"/>
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import io.metersphere.base.domain.User;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.controller.request.BaseQueryRequest;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import io.metersphere.service.UserService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -49,4 +54,13 @@ public class ServiceUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, User> getUserMap(List<String> userIds) {
|
||||
UserService userService = CommonBeanFactory.getBean(UserService.class);
|
||||
if (!CollectionUtils.isEmpty(userIds)) {
|
||||
Map<String, User> userMap = userService.queryNameByIds(userIds);
|
||||
return userMap;
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -293,6 +294,16 @@ public class IssuesService {
|
|||
// list.addAll(issue);
|
||||
// });
|
||||
List<IssuesDao> issues = extIssuesMapper.getIssuesByProjectId(request);
|
||||
List<String> ids = issues.stream()
|
||||
.map(IssuesDao::getCreator)
|
||||
.collect(Collectors.toList());
|
||||
Map<String, User> userMap = ServiceUtils.getUserMap(ids);
|
||||
issues.forEach(item -> {
|
||||
User createUser = userMap.get(item.getCreator());
|
||||
if (createUser != null) {
|
||||
item.setCreatorName(createUser.getName());
|
||||
}
|
||||
});
|
||||
// Map<String, List<IssuesDao>> issueMap = getIssueMap(issues);
|
||||
// Map<String, AbstractIssuePlatform> platformMap = getPlatformMap(request);
|
||||
// issueMap.forEach((platformName, data) -> {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
-- 缺陷添加创建人字段
|
||||
ALTER TABLE issues ADD creator varchar(50) NULL COMMENT 'Creator';
|
||||
|
||||
-- 删除创建人的自定义字段
|
||||
delete cft,cf from custom_field_template cft,custom_field cf
|
||||
where cft.field_id = cf.id and cf.name = '创建人' and cf.scene = 'ISSUE';
|
|
@ -77,10 +77,10 @@
|
|||
<table tableName="test_case_review_scenario"/>
|
||||
<table tableName="test_plan"/>
|
||||
<table tableName="test_case_test"/>-->
|
||||
<table tableName="test_case"></table>
|
||||
<table tableName="issues"></table>
|
||||
<!-- <table tableName="custom_field"></table>-->
|
||||
<!-- <table tableName="test_case"></table>-->
|
||||
<table tableName="test_case"></table>
|
||||
<!-- <table tableName="test_case"></table>-->
|
||||
<!-- <table tableName="custom_field_template"></table>-->
|
||||
|
||||
</context>
|
||||
|
|
|
@ -7,6 +7,17 @@
|
|||
<el-input v-model="form.title" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('custom_field.issue_creator')" prop="title">
|
||||
<el-select filterable v-model="form.creator" :placeholder="$t('custom_field.issue_creator')">
|
||||
<el-option
|
||||
v-for="(item) in memberOptions"
|
||||
:key="item.id"
|
||||
:label="item.id + ' (' + item.name + ')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 自定义字段 -->
|
||||
<el-form v-if="isFormAlive" :model="customFieldForm" :rules="customFieldRules" ref="customFieldForm"
|
||||
class="case-form">
|
||||
|
@ -76,6 +87,7 @@ import {buildCustomFields, getTemplate, parseCustomField} from "@/common/js/cust
|
|||
import CustomFiledComponent from "@/business/components/settings/workspace/template/CustomFiledComponent";
|
||||
import TestCaseIssueList from "@/business/components/track/issue/TestCaseIssueList";
|
||||
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
||||
import {getCurrentUserId, getCurrentWorkspaceId} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "IssueEditDetail",
|
||||
|
@ -111,13 +123,15 @@ export default {
|
|||
url: '',
|
||||
form: {
|
||||
title: '',
|
||||
description: ''
|
||||
description: '',
|
||||
creator: null
|
||||
},
|
||||
tapdUsers: [],
|
||||
zentaoUsers: [],
|
||||
Builds: [],
|
||||
hasTapdId: false,
|
||||
hasZentaoId: false
|
||||
hasZentaoId: false,
|
||||
memberOptions: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -143,6 +157,10 @@ export default {
|
|||
methods: {
|
||||
open(data) {
|
||||
let initAddFuc = this.initEdit;
|
||||
this.getMemberOptions();
|
||||
if (!data.creator) {
|
||||
data.creator = getCurrentUserId();
|
||||
}
|
||||
getTemplate('field/template/issue/get/relate/', this)
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
|
@ -150,6 +168,11 @@ export default {
|
|||
initAddFuc(data);
|
||||
});
|
||||
},
|
||||
getMemberOptions() {
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: getCurrentWorkspaceId()}, response => {
|
||||
this.memberOptions = response.data;
|
||||
});
|
||||
},
|
||||
getThirdPartyInfo() {
|
||||
let platform = this.issueTemplate.platform;
|
||||
if (platform === 'Zentao') {
|
||||
|
|
|
@ -41,6 +41,11 @@
|
|||
prop="platform">
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('custom_field.issue_creator')"
|
||||
prop="creatorName">
|
||||
</ms-table-column>
|
||||
|
||||
<issue-description-table-item/>
|
||||
|
||||
</ms-table>
|
||||
|
|
Loading…
Reference in New Issue