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

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class DF_MOBMDCTRL_Mob{
    private String powerconsumption;
    private String totalprice;
    private String date;
    private String currentnumber;
    private String srfkey;
    private String srfmajortext;

     public  void fromDF(DF sourceEntity)  {
	    this.setPowerconsumption(String.format("%s",sourceEntity.getYdl()));
	    this.setTotalprice(String.format("%s",sourceEntity.getYdfy()));
	    this.setDate(String.format("%s",sourceEntity.getJfrq()));
	    this.setCurrentnumber(String.format("%s",sourceEntity.getBqs()));
	    this.setSrfkey(String.format("%s",sourceEntity.getDfid()));
	    this.setSrfmajortext(String.format("%s",sourceEntity.getDfname()));
	}

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

}