refactor(项目管理): 优化缺陷模板类型命名
This commit is contained in:
parent
18a16517d9
commit
391d38d183
|
@ -184,12 +184,12 @@ VALUES(
|
|||
|
||||
-- 初始化组织缺陷模板
|
||||
INSERT INTO template (id,name,remark,internal,update_time,create_time,create_user,scope_type,scope_id,enable_third_part,enable_default,scene)
|
||||
VALUES (UUID_SHORT(), 'issue_default', '', 1, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'ORGANIZATION', '100001', 0, 1, 'ISSUE');
|
||||
VALUES (UUID_SHORT(), 'bug_default', '', 1, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'ORGANIZATION', '100001', 0, 1, 'BUG');
|
||||
|
||||
-- 初始化项目缺陷模板
|
||||
INSERT INTO template (id,name,remark,internal,update_time,create_time,create_user,scope_type,scope_id,enable_third_part, enable_default, scene, ref_id)
|
||||
VALUES (UUID_SHORT(), 'issue_default', '', 1, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'PROJECT', '100001100001', 0, 1, 'ISSUE',
|
||||
(SELECT id FROM (SELECT * FROM template) t where name = 'issue_default'));
|
||||
VALUES (UUID_SHORT(), 'bug_default', '', 1, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'PROJECT', '100001100001', 0, 1, 'BUG',
|
||||
(SELECT id FROM (SELECT * FROM template) t where name = 'bug_default'));
|
||||
|
||||
-- 初始化组织接口模板
|
||||
INSERT INTO template (id,name,remark,internal,update_time,create_time,create_user,scope_type,scope_id,enable_third_part,enable_default,scene)
|
||||
|
|
|
@ -2,7 +2,8 @@ package io.metersphere.sdk.constants;
|
|||
|
||||
public class OrganizationParameterConstants {
|
||||
public static final String ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY = "organization.functional.template.enable";
|
||||
public static final String ORGANIZATION_ISSUE_TEMPLATE_ENABLE_KEY = "organization.issue.template.enable";
|
||||
public static final String ORGANIZATION_BUG_TEMPLATE_ENABLE_KEY = "organization.bug.template.enable";
|
||||
public static final String ORGANIZATION_API_TEMPLATE_ENABLE_KEY = "organization.api.template.enable";
|
||||
public static final String ORGANIZATION_UI_TEMPLATE_ENABLE_KEY = "organization.ui.template.enable";
|
||||
public static final String ORGANIZATION_TEST_PLAN_TEMPLATE_ENABLE_KEY = "organization.test_plan.template.enable";
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.metersphere.sdk.constants;
|
|||
|
||||
public enum TemplateScene {
|
||||
FUNCTIONAL,
|
||||
ISSUE,
|
||||
BUG,
|
||||
API,
|
||||
UI,
|
||||
TEST_PLAN
|
||||
|
|
|
@ -39,7 +39,7 @@ public class OrganizationCustomFieldController {
|
|||
@RequiresPermissions(PermissionConstants.ORGANIZATION_CUSTOM_FIELD_READ)
|
||||
public List<CustomField> list(@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@PathVariable String organizationId,
|
||||
@Schema(description = "模板的使用场景(FUNCTIONAL,ISSUE,API,UI)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "模板的使用场景(FUNCTIONAL,BUG,API,UI)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@PathVariable String scene) {
|
||||
return organizationCustomFieldService.list(organizationId, scene);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class OrganizationTemplateController {
|
|||
@RequiresPermissions(PermissionConstants.ORGANIZATION_TEMPLATE_READ)
|
||||
public List<Template> list(@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@PathVariable String organizationId,
|
||||
@Schema(description = "模板的使用场景(FUNCTIONAL,ISSUE,API,UI)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "模板的使用场景(FUNCTIONAL,BUG,API,UI)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@PathVariable String scene) {
|
||||
return organizationTemplateservice.list(organizationId, scene);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,10 @@ public class BaseOrganizationParameterService {
|
|||
public String getOrgTemplateEnableKeyByScene(String scene) {
|
||||
Map<String, String> sceneMap = new HashMap<>();
|
||||
sceneMap.put(TemplateScene.FUNCTIONAL.name(), ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY);
|
||||
sceneMap.put(TemplateScene.ISSUE.name(), ORGANIZATION_ISSUE_TEMPLATE_ENABLE_KEY);
|
||||
sceneMap.put(TemplateScene.BUG.name(), ORGANIZATION_BUG_TEMPLATE_ENABLE_KEY);
|
||||
sceneMap.put(TemplateScene.API.name(), ORGANIZATION_API_TEMPLATE_ENABLE_KEY);
|
||||
sceneMap.put(TemplateScene.UI.name(), ORGANIZATION_UI_TEMPLATE_ENABLE_KEY);
|
||||
sceneMap.put(TemplateScene.TEST_PLAN.name(), ORGANIZATION_TEST_PLAN_TEMPLATE_ENABLE_KEY);
|
||||
return sceneMap.get(scene);
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ public class BaseTemplateService {
|
|||
* @param scopeType
|
||||
*/
|
||||
public void initIssueDefaultTemplate(String scopeId, TemplateScopeType scopeType) {
|
||||
this.initDefaultTemplate(scopeId, "issue_default", scopeType, TemplateScene.ISSUE);
|
||||
this.initDefaultTemplate(scopeId, "bug_default", scopeType, TemplateScene.BUG);
|
||||
}
|
||||
public void initApiDefaultTemplate(String scopeId, TemplateScopeType scopeType) {
|
||||
this.initDefaultTemplate(scopeId, "api_default", scopeType, TemplateScene.API);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CreateTemplateResourceService implements CreateProjectResourceServi
|
|||
case FUNCTIONAL:
|
||||
baseTemplateService.initFunctionalDefaultTemplate(projectId, TemplateScopeType.PROJECT);
|
||||
break;
|
||||
case ISSUE:
|
||||
case BUG:
|
||||
baseTemplateService.initIssueDefaultTemplate(projectId, TemplateScopeType.PROJECT);
|
||||
break;
|
||||
case API:
|
||||
|
|
|
@ -362,15 +362,22 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
}
|
||||
|
||||
private void changeOrgTemplateEnable(boolean enable) {
|
||||
changeOrgTemplateEnable(enable, OrganizationParameterConstants.ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY);
|
||||
changeOrgTemplateEnable(enable, OrganizationParameterConstants.ORGANIZATION_BUG_TEMPLATE_ENABLE_KEY);
|
||||
changeOrgTemplateEnable(enable, OrganizationParameterConstants.ORGANIZATION_API_TEMPLATE_ENABLE_KEY);
|
||||
changeOrgTemplateEnable(enable, OrganizationParameterConstants.ORGANIZATION_UI_TEMPLATE_ENABLE_KEY);
|
||||
changeOrgTemplateEnable(enable, OrganizationParameterConstants.ORGANIZATION_TEST_PLAN_TEMPLATE_ENABLE_KEY);
|
||||
}
|
||||
|
||||
private void changeOrgTemplateEnable(boolean enable, String organizationTemplateEnableKey) {
|
||||
if (enable) {
|
||||
organizationParameterMapper.deleteByPrimaryKey(DEFAULT_ORGANIZATION_ID, OrganizationParameterConstants.ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY);
|
||||
organizationParameterMapper.deleteByPrimaryKey(DEFAULT_ORGANIZATION_ID, organizationTemplateEnableKey);
|
||||
} else {
|
||||
OrganizationParameter organizationParameter = new OrganizationParameter();
|
||||
organizationParameter.setOrganizationId(DEFAULT_ORGANIZATION_ID);
|
||||
organizationParameter.setParamKey(OrganizationParameterConstants.ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY);
|
||||
organizationParameter.setParamKey(organizationTemplateEnableKey);
|
||||
organizationParameter.setParamValue(BooleanUtils.toStringTrueFalse(false));
|
||||
if (organizationParameterMapper.selectByPrimaryKey(DEFAULT_ORGANIZATION_ID,
|
||||
OrganizationParameterConstants.ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY) == null) {
|
||||
if (organizationParameterMapper.selectByPrimaryKey(DEFAULT_ORGANIZATION_ID, organizationTemplateEnableKey) == null) {
|
||||
organizationParameterMapper.insert(organizationParameter);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue