feat(web): 补充ware tags的存储
This commit is contained in:
@@ -14,6 +14,7 @@ import java.time.LocalDateTime;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -54,6 +55,7 @@ public class WareController extends CheckingController<Ware, WareController.Save
|
|||||||
ware.setDescription(saveItem.getDescription());
|
ware.setDescription(saveItem.getDescription());
|
||||||
ware.setIcon(dataFileService.detailOrThrow(saveItem.getIconId()));
|
ware.setIcon(dataFileService.detailOrThrow(saveItem.getIconId()));
|
||||||
ware.setContent(saveItem.getContent());
|
ware.setContent(saveItem.getContent());
|
||||||
|
ware.setTags(saveItem.getTags().toList());
|
||||||
return ware;
|
return ware;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +83,7 @@ public class WareController extends CheckingController<Ware, WareController.Save
|
|||||||
item.setDescription(entity.getDescription());
|
item.setDescription(entity.getDescription());
|
||||||
item.setIconId(entity.getIcon().getId());
|
item.setIconId(entity.getIcon().getId());
|
||||||
item.setContent(entity.getContent());
|
item.setContent(entity.getContent());
|
||||||
|
item.setTags(Lists.immutable.ofAll(entity.getTags()));
|
||||||
item.setIcon(StrUtil.format("{}/upload/download/{}", hostConfiguration.getPrefix(), entity.getIcon().getId()));
|
item.setIcon(StrUtil.format("{}/upload/download/{}", hostConfiguration.getPrefix(), entity.getIcon().getId()));
|
||||||
item.setCreatedTime(entity.getCreatedTime());
|
item.setCreatedTime(entity.getCreatedTime());
|
||||||
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
||||||
@@ -97,6 +100,7 @@ public class WareController extends CheckingController<Ware, WareController.Save
|
|||||||
private String description;
|
private String description;
|
||||||
private Long iconId;
|
private Long iconId;
|
||||||
private String content;
|
private String content;
|
||||||
|
private ImmutableList<String> tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.eshore.gringotts.web.domain.entity;
|
|||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
|
import java.util.List;
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityListeners;
|
import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
@@ -66,4 +69,7 @@ public class Ware extends CheckingNeededEntity {
|
|||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String content;
|
private String content;
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(name = Constants.TABLE_PREFIX + "ware_tag", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
private List<String> tags;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user