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

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BGYP_MOBMDCTRL_Mob{
    private String sl;
    private String tp;
    private String gg;
    private String srfmajortext;
    private String srfkey;

     public  void fromBGYP(BGYP sourceEntity)  {
	    this.setSl(String.format("%s",sourceEntity.getSl()));
	    this.setTp(String.format("%s",sourceEntity.getTp()));
	    this.setGg(String.format("%s",sourceEntity.getGg()));
	    this.setSrfmajortext(String.format("%s",sourceEntity.getBgypname()));
	    this.setSrfkey(String.format("%s",sourceEntity.getBgypid()));
	}

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

}