package com.bohuikeji.frame.module.admin.entity.sys;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author ：mmzs
 * @date ：Created in 2021/3/11 9:18
 * @description：App分发实体类
 * @modified By：
 * @version: 1$
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_app")
public class SysApp extends EntityBase<SysApp> implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableShowField("更新名称")
    private String name;

    @TableShowField("更新key")
    private String appKey;

    @TableShowField("操作系统")
    private String system;

    @TableShowField("更新方式")
    private String type;

    @TableShowField("版本")
    private String version;

    @TableShowField("大版本号")
    private String versionCode;

    private String text;

    private String url;

    private String logo;

    private String code;

    private String clicks;

    private LocalDateTime gmtCreate;
    @TableShowField("更新时间")
    private LocalDateTime gmtModified;

    /**
     * 该方法已经弃用，现更新
     * @return
     */
    @Deprecated
    public JSONObject toUploadJson(){
        JSONObject res=new JSONObject();
        res.put("url",this.getUrl());
        res.put("wgtUrl",this.getUrl());
        res.put("newVersion",this.getVersion());
        res.put("desc",this.getText().replaceAll("。","\r\n"));
        res.put("state",true);
        return res;
    }


}
