package com.yc.app.v2.service.impl; import com.yc.app.v2.entity.FormVOEntity; import com.yc.app.v2.entity.GFieldEntity; import com.yc.app.v2.entity.GformEntity; import com.yc.app.v2.entity.MetaDataEntity; import com.yc.app.v2.service.T_5_Service; import com.yc.app.v2.utils.Page; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 5类型加载内容,主从表 */ @Service public class T_5_ServiceImpl extends DanJunFormServiceImpl implements T_5_Service { @Override public Page getData(FormVOEntity formVOEntity, Map env, MetaDataEntity metaDataEntity) { //----取主表数据 Page master= super.getData(formVOEntity, env, metaDataEntity); Map map=new HashMap<>(); Map otherInfo=new HashMap(); Map otherMap=new HashMap(); Map otherMap2=new HashMap(); otherMap.put("isView",formVOEntity.getIsView()); otherMap.put("primaryKey",formVOEntity.getPrimaryKey()); otherMap.put("tableName",formVOEntity.getTableName()); otherInfo.put("master",otherMap); //-----取从表数据 metaDataEntity.getGformEntity().setGetHeadTabe(false); //---把主表的数据放到env,因为参数替换有可能是取主表数据 if(master.getData()!=null&&((List) master.getData()).size()>0) { env.putAll((Map) ((List) master.getData()).get(0)); } Page slave= super.getData(formVOEntity, env, metaDataEntity); otherMap2.put("isView",formVOEntity.getIsView()); otherMap2.put("primaryKey",formVOEntity.getPrimaryKey()); otherMap2.put("tableName",formVOEntity.getTableName()); otherInfo.put("slave",otherMap2); master.setOtherInfo(otherInfo); map.put("master",master.getData()); map.put("slave",slave.getData()); master.setData(map); return master; } @Override public Integer getGridControlType(GFieldEntity gFieldEntity, GformEntity gformEntity) { if(gformEntity.isGetHeadTabe()){ return super.getGridControlType(gFieldEntity,gformEntity); }else{ return gFieldEntity.getGridcontroltype(); } } }