| | |
| | | * @description 动态字段value保存 |
| | | * @time 2025/3/18 15:00 |
| | | */ |
| | | public static void saveFields(Map<String, String> template, String uuid) { |
| | | public static void saveFields(Map<String, ?> template, String uuid) { |
| | | List<Fields> fields = getFieldsSta(); |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | if (fields.isEmpty()) { |
| | | throw new CoolException("扩展字段不存在!!"); |
| | | } |
| | | List<FieldsItem> fieldsItems = new ArrayList<>(); |
| | | fields.forEach(fields1 -> { |
| | | if (!Objects.isNull(template.get(fields1.getFields()))) { |
| | | for (Fields field : fields) { |
| | | if (!Objects.isNull(template.get(field.getFields()))) { |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setFieldsId(fields1.getId()) |
| | | item.setFieldsId(field.getId()) |
| | | .setUuid(uuid) |
| | | .setValue(template.get(fields1.getFields())); |
| | | .setValue(template.get(field.getFields()).toString()); |
| | | fieldsItems.add(item); |
| | | } |
| | | }); |
| | | } |
| | | if (!fieldsItemService.saveBatch(fieldsItems)) { |
| | | throw new CoolException("动态字段值保存失败!!"); |
| | | } |