refactor(项目设置): 自定义字段新增和修改接口添加参数

This commit is contained in:
AgAngle 2023-10-25 16:41:44 +08:00 committed by jianxing
parent 6aef0347ae
commit f494bcf001
4 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,9 @@ public class CustomFieldUpdateRequest {
@Size(min = 1, max = 50, message = "{custom_field.scope_id.length_range}", groups = {Created.class})
private String scopeId;
@Schema(description = "是否需要手动输入选项key")
private Boolean enableOptionKey;
@Valid
@Schema(title = "自定义字段选项")
private List<CustomFieldOptionRequest> options;

View File

@ -87,6 +87,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("1111");
customFieldOptionRequest.setText("test");
request.setEnableOptionKey(true);
List<CustomFieldOptionRequest> optionRequests = Arrays.asList(customFieldOptionRequest);
request.setOptions(optionRequests);
@ -149,6 +150,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
request.setType(CustomFieldType.SELECT.name());
request.setRemark("AAA1");
request.setScopeId("1111");
request.setEnableOptionKey(false);
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("11112");
customFieldOptionRequest.setText("test1");

View File

@ -127,6 +127,7 @@ public class BaseCustomFieldService {
customField.setId(IDGenerator.nextStr());
customField.setCreateTime(System.currentTimeMillis());
customField.setUpdateTime(System.currentTimeMillis());
customField.setEnableOptionKey(BooleanUtils.isTrue(customField.getEnableOptionKey()));
customFieldMapper.insert(customField);
baseCustomFieldOptionService.addByFieldId(customField.getId(), options);
return customField;

View File

@ -90,6 +90,7 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
request.setType(CustomFieldType.SELECT.name());
request.setRemark("AAA");
request.setScopeId(DEFAULT_ORGANIZATION_ID);
request.setEnableOptionKey(true);
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("1111");
customFieldOptionRequest.setText("test");
@ -156,6 +157,7 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
request.setType(CustomFieldType.SELECT.name());
request.setRemark("AAA1");
request.setScopeId("1111");
request.setEnableOptionKey(false);
CustomFieldOptionRequest customFieldOptionRequest = new CustomFieldOptionRequest();
customFieldOptionRequest.setValue("11112");
customFieldOptionRequest.setText("test1");