|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; |
|
|
|
|
import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; |
|
|
|
|
import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService; |
|
|
|
|
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; |
|
|
|
|
import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; |
|
|
|
|
import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
@ -12,6 +13,7 @@ import lombok.Getter;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import oracle.jdbc.proxy.annotation.Post; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
@ -42,6 +44,7 @@ public class ContentDefinitionClient implements IContentDefinitionClient {
|
|
|
|
|
@PostMapping(SAVE_BATCH) |
|
|
|
|
public R<Boolean> saveBatch(@RequestBody List<ContentDefinitionDTO> request) { |
|
|
|
|
List<ContentDefinitionEntity> list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class); |
|
|
|
|
list.stream().forEach(definition -> definition.setCode(CodeUtils.randomCode())); |
|
|
|
|
return R.data(contentDefinitionService.saveBatch(list)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -55,6 +58,7 @@ public class ContentDefinitionClient implements IContentDefinitionClient {
|
|
|
|
|
@PostMapping(SAVE_OR_UPDATE_BATCH) |
|
|
|
|
public R<Boolean> saveOrUpdateBatch(@RequestBody List<ContentDefinitionDTO> request) { |
|
|
|
|
List<ContentDefinitionEntity> list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class); |
|
|
|
|
list.stream().filter(definition -> Func.isNotEmpty(definition.getId())).forEach(definition -> definition.setCode(CodeUtils.randomCode())); |
|
|
|
|
return R.data(contentDefinitionService.saveOrUpdateBatch(list)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|