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.KQ;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class KQ_MOBMDCTRL_Mob{
    private String xbsj;
    private String sbsj;
    private String kqrq;
    private String srfkey;
    private String srfmajortext;

     public  void fromKQ(KQ sourceEntity)  {
	    this.setXbsj(String.format("%s",sourceEntity.getXbsj()));
	    this.setSbsj(String.format("%s",sourceEntity.getSbsj()));
	    this.setKqrq(String.format("%s",sourceEntity.getKqrq()));
	    this.setSrfkey(String.format("%s",sourceEntity.getKqid()));
	    this.setSrfmajortext(String.format("%s",sourceEntity.getKqname()));
	}

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

}