package com.sa.ibiz.demo.mob.controller.demo.vo;

import java.sql.Timestamp;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import com.sa.ibiz.demo.demo.domain.XM;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class XM_MOBMDCTRL_Mob{
    private String qdsj;
    private String xmje;
    private String type;
    private String xmmc;
    private String srfkey;
    private String srfmajortext;
    private String fzbmid;
    private String fzrid;
    private String zxrid;

     public  void fromXM(XM sourceEntity)  {
	    this.setQdsj(String.format("%s",sourceEntity.getQdsj()));
	    this.setXmje(String.format("%s",sourceEntity.getXmje()));
	    this.setType(String.format("%s",sourceEntity.getBz()));
	    this.setXmmc(String.format("%s",sourceEntity.getXmname()));
	    this.setSrfkey(String.format("%s",sourceEntity.getXmid()));
	    this.setSrfmajortext(String.format("%s",sourceEntity.getXmname()));
	    this.setFzbmid(String.format("%s",sourceEntity.getFzbmid()));
	    this.setFzrid(String.format("%s",sourceEntity.getFzrid()));
	    this.setZxrid(String.format("%s",sourceEntity.getZxrid()));
	}

	public static Page<XM_MOBMDCTRL_Mob> fromXM(Page<XM> sourcePage)   {
        if(sourcePage==null)
            return null;
        Page<XM_MOBMDCTRL_Mob> targetpage=new Page<XM_MOBMDCTRL_Mob>(sourcePage.getCurrent(),sourcePage.getSize(),sourcePage.getTotal(),sourcePage.isSearchCount());
        List<XM_MOBMDCTRL_Mob> records=new ArrayList<XM_MOBMDCTRL_Mob>();
        for(XM source:sourcePage.getRecords()) {
    XM_MOBMDCTRL_Mob target=new XM_MOBMDCTRL_Mob();
            target.fromXM(source);
            records.add(target);
        }
        targetpage.setAsc(sourcePage.ascs());
        targetpage.setDesc(sourcePage.descs());
        targetpage.setOptimizeCountSql(sourcePage.optimizeCountSql());
        targetpage.setRecords(records);
        return targetpage;
    }

}