Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternateNames别名解析失效问题 #4496

Open
zsh2722 opened this issue Apr 9, 2024 · 0 comments
Open

alternateNames别名解析失效问题 #4496

zsh2722 opened this issue Apr 9, 2024 · 0 comments

Comments

@zsh2722
Copy link

zsh2722 commented Apr 9, 2024

json数据:{
"name": "我为你牺牲",
"name_py": "wwnxs",
"poster": "我为你牺牲.png",
"poster_m": "474fa7396030024028c27feab459e2c9.png",
"filename": "我为你牺牲.ts",
"filename_m": "474fa7396030024028c27feab459e2c9.ts",
"desc": "影片《挚爱无悔》根据三个武警部队真实人物故事改编:战斗在缉毒一线的王强“卧底”制毒工厂,凭借过硬的军事技能和强大的心理素质,排爆,制服毒枭,铲除制毒窝点;军属庄小红默默支持丈夫多年驻守高原山口,而探亲过程中她却遭遇车祸截肢,为确保能生下健康的军人后代,忍痛不打麻药进行手术。术后依然自强自立;援疆战士王报国身患癌症,多次申请援疆执行任务,最后重症不治牺牲,留下“来生再报国”的遗愿,用生命诠释“为你牺牲”这一主题。通过三个平行的篇章,《挚爱无悔》全景展现了武警部队官兵以小家保祖国大家的奉献故事。"
},
{
"name": "打过长江去",
"name_py": "dgzjq",
"poster": "打过长江去.png",
"poster_m": "1a17d6986b0456df117f9a216485a2b8.png",
"filename": "打过长江去.ts",
"filename_m": "1a17d6986b0456df117f9a216485a2b8.ts",
"desc": "《打过长江去》以渡江战役为背景,再现了新中国成立前的关键时刻,人民解放军一支先遣分队潜入江南,打进虎穴斗智斗勇,命悬一线却与各种敌人殊死斗争,为祖国统一而舍生取义、无私拼搏,最终配合百万大军过长江,将红旗插遍中国。"
}

java bean:package com.thunder.base.framework.model;

import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.thunder.base.framework.db.converter.MediaItemConverter;

import java.io.Serializable;
import java.util.List;

/**

  • Created by zhangsonghe on 2024/1/27

  • @author THUNDER

  • @Date 2024/1/27

  • @desc
    */
    @entity(tableName = "mix_media")
    public class MediaEntity implements Serializable {
    @PrimaryKey
    @nonnull
    private String name = "";
    @JSONField(name = "name_py")
    private String firstLetter;
    @JSONField(name = "poster_m",alternateNames = {"poster"})
    private String poster;
    private String performer;
    @JSONField(name = "filename_m",alternateNames = {"filename"})
    private String filename;
    private String desc;
    @TypeConverters(MediaItemConverter.class)
    @JSONField(name = "sub_list")
    private List itemList;

    @JsonIgnore
    private String catalog;
    @JsonIgnore
    private String dir;
    @ignore
    private int playIndex;
    @ignore
    private int playPosition;
    @ignore
    private int playDuration;
    @JsonIgnore
    @ignore
    private int playState;
    @ignore
    private String projectionType;
    @JsonIgnore
    @ignore
    private String localFile;

    @JsonIgnore
    private int collectState;
    // 下载状态
    @JsonIgnore
    private int downloadState;

    // 下载进度(0-100)
    @JsonIgnore
    private int downloadProgress;

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getFirstLetter() {
    return firstLetter;
    }

    public void setFirstLetter(String firstLetter) {
    this.firstLetter = firstLetter;
    }

    public String getPoster() {
    return poster;
    }

    public void setPoster(String poster) {
    this.poster = poster;
    }

    public String getPerformer() {
    return performer;
    }

    public void setPerformer(String performer) {
    this.performer = performer;
    }

    public String getFilename() {
    return filename;
    }

    public void setFilename(String filename) {
    this.filename = filename;
    }

    public String getDesc() {
    return desc;
    }

    public void setDesc(String desc) {
    this.desc = desc;
    }

    public List getItemList() {
    return itemList;
    }

    public void setItemList(List itemList) {
    this.itemList = itemList;
    }

    public int getPlayIndex() {
    return playIndex;
    }

    public void setPlayIndex(int playIndex) {
    this.playIndex = playIndex;
    }

    public int getPlayPosition() {
    return playPosition;
    }

    public void setPlayPosition(int playPosition) {
    this.playPosition = playPosition;
    }

    public int getPlayDuration() {
    return playDuration;
    }

    public void setPlayDuration(int playDuration) {
    this.playDuration = playDuration;
    }

    public int getPlayState() {
    return playState;
    }

    public void setPlayState(int playState) {
    this.playState = playState;
    }

    public String getProjectionType() {
    return projectionType;
    }

    public void setProjectionType(String projectionType) {
    this.projectionType = projectionType;
    }

    public String getLocalFile() {
    return localFile;
    }

    public void setLocalFile(String localFile) {
    this.localFile = localFile;
    }

    public String getCatalog() {
    return catalog;
    }

    public void setCatalog(String catalog) {
    this.catalog = catalog;
    }

    public String getDir() {
    return dir;
    }

    public void setDir(String dir) {
    this.dir = dir;
    }

    public int getCollectState() {
    return collectState;
    }

    public void setCollectState(int collectState) {
    this.collectState = collectState;
    }

    public int getDownloadState() {
    return downloadState;
    }

    public void setDownloadState(int downloadState) {
    this.downloadState = downloadState;
    }

    public int getDownloadProgress() {
    return downloadProgress;
    }

    public void setDownloadProgress(int downloadProgress) {
    this.downloadProgress = downloadProgress;
    }

    @OverRide
    public String toString() {
    return "MediaEntity{" + "name='" + name + ''' + ", firstLetter='" + firstLetter + ''' + ", poster='" + poster + ''' + ", performer='" + performer + ''' + ", filename='" + filename + ''' + ", desc='" + desc + ''' + ", playIndex=" + playIndex + ", playPosition=" + playPosition + ", playDuration=" + playDuration + ", playState=" + playState + ", projectionType='" + projectionType + ''' + ", localFile='" + localFile + ''' + ", itemList=" + itemList + '}';
    }
    }
    json解析后打印:MediaEntity{name='我为你牺牲', firstLetter='wwnxs', poster='http://192.168.1.1/mnt/sda1//movie_tv/movie/474fa7396030024028c27feab459e2c9.png', performer='null', filename='http://192.168.1.1/mnt/sda1//movie_tv/movie/我为你牺牲.ts', desc='影片《挚爱无悔》根据三个武警部队真实人物故事改编:战斗在缉毒一线的王强“卧底”制毒工厂,凭借过硬的军事技能和强大的心理素质,排爆,制服毒枭,铲除制毒窝点;军属庄小红默默支持丈夫多年驻守高原山口,而探亲过程中她却遭遇车祸截肢,为确保能生下健康的军人后代,忍痛不打麻药进行手术。术后依然自强自立;援疆战士王报国身患癌症,多次申请援疆执行任务,最后重症不治牺牲,留下“来生再报国”的遗愿,用生命诠释“为你牺牲”这一主题。通过三个平行的篇章,《挚爱无悔》全景展现了武警部队官兵以小家保祖国大家的奉献故事。', playIndex=0, playPosition=0, playDuration=0, playState=0, projectionType='null', localFile='null', itemList=null}

问题:json中定了两个字段,分别是poster/poster_m,filename/filename_m,java实体类中定义了poster并通过name匹配json中的poster,配置了别名为poster_m作为备选字段,filename同理,但是实际运行中poster能获取到正确的值(poster_m),filename却不能,不知道是用法不对还是哪里出的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant