Commit 80fa0f5a by guojuxing

自定义字段属性值去掉code的校验

parent 3f9fa913
......@@ -17,6 +17,7 @@ import com.gic.store.service.StoreFieldSelectService;
import com.gic.store.service.StoreFieldService;
import com.gic.store.utils.valid.ValidUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -45,9 +46,12 @@ public class StoreFieldSelectApiServiceImpl implements StoreFieldSelectApiServic
return paramValid;
}
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(), null,
storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
boolean isCodeNotNull = StringUtils.isBlank(storeFieldSelectDTO.getStoreFieldSelectCode());
if (isCodeNotNull) {
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(), null,
storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
}
}
if (storeFieldSelectService.isRepeatName(storeFieldSelectDTO.getStoreFieldId(), null,
......@@ -135,9 +139,12 @@ public class StoreFieldSelectApiServiceImpl implements StoreFieldSelectApiServic
return paramValid;
}
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(),
storeFieldSelectDTO.getStoreFieldSelectId(), storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
boolean isCodeNotNull = StringUtils.isBlank(storeFieldSelectDTO.getStoreFieldSelectCode());
if (isCodeNotNull) {
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(),
storeFieldSelectDTO.getStoreFieldSelectId(), storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
}
}
if (storeFieldSelectService.isRepeatName(storeFieldSelectDTO.getStoreFieldId(),
......
......@@ -54,7 +54,6 @@ public class StoreFieldSelectQO implements Serializable{
/**
* 属性code
*/
@NotBlank(message = "属性值code不能为空", groups = {SaveValidView.class, EditValidView.class})
private String storeFieldSelectCode;
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment