Java Code Examples for org.jeecgframework.poi.excel.entity.params.ExcelCollectionParams#setExcelName()

The following examples show how to use org.jeecgframework.poi.excel.entity.params.ExcelCollectionParams#setExcelName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportBaseService.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取需要导出的全部字段
 * 
 * 
 * @param exclusions
 * @param targetId
 *            目标ID
 * @param fields
 * @param excelCollection
 * @throws Exception
 */
public void getAllExcelField(String targetId, Field[] fields, Map<String, ExcelImportEntity> excelParams, List<ExcelCollectionParams> excelCollection, Class<?> pojoClass, List<Method> getMethods) throws Exception {
	ExcelImportEntity excelEntity = null;
	for (int i = 0; i < fields.length; i++) {
		Field field = fields[i];
		if (PoiPublicUtil.isNotUserExcelUserThis(null, field, targetId)) {
			continue;
		}
		if (PoiPublicUtil.isCollection(field.getType())) {
			// 集合对象设置属性
			ExcelCollectionParams collection = new ExcelCollectionParams();
			collection.setName(field.getName());
			Map<String, ExcelImportEntity> temp = new HashMap<String, ExcelImportEntity>();
			ParameterizedType pt = (ParameterizedType) field.getGenericType();
			Class<?> clz = (Class<?>) pt.getActualTypeArguments()[0];
			collection.setType(clz);
			getExcelFieldList(targetId, PoiPublicUtil.getClassFields(clz), clz, temp, null);
			collection.setExcelParams(temp);
			collection.setExcelName(field.getAnnotation(ExcelCollection.class).name());
			additionalCollectionName(collection);
			excelCollection.add(collection);
		} else if (PoiPublicUtil.isJavaClass(field)) {
			addEntityToMap(targetId, field, excelEntity, pojoClass, getMethods, excelParams);
		} else {
			List<Method> newMethods = new ArrayList<Method>();
			if (getMethods != null) {
				newMethods.addAll(getMethods);
			}
			newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass));
			getAllExcelField(targetId, PoiPublicUtil.getClassFields(field.getType()), excelParams, excelCollection, field.getType(), newMethods);
		}
	}
}
 
Example 2
Source File: ImportBaseService.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取需要导出的全部字段
 * 
 * 
 * @param exclusions
 * @param targetId
 *            目标ID
 * @param fields
 * @param excelCollection
 * @throws Exception
 */
public void getAllExcelField(String targetId, Field[] fields, Map<String, ExcelImportEntity> excelParams, List<ExcelCollectionParams> excelCollection, Class<?> pojoClass, List<Method> getMethods) throws Exception {
	ExcelImportEntity excelEntity = null;
	for (int i = 0; i < fields.length; i++) {
		Field field = fields[i];
		if (PoiPublicUtil.isNotUserExcelUserThis(null, field, targetId)) {
			continue;
		}
		if (PoiPublicUtil.isCollection(field.getType())) {
			// 集合对象设置属性
			ExcelCollectionParams collection = new ExcelCollectionParams();
			collection.setName(field.getName());
			Map<String, ExcelImportEntity> temp = new HashMap<String, ExcelImportEntity>();
			ParameterizedType pt = (ParameterizedType) field.getGenericType();
			Class<?> clz = (Class<?>) pt.getActualTypeArguments()[0];
			collection.setType(clz);
			getExcelFieldList(targetId, PoiPublicUtil.getClassFields(clz), clz, temp, null);
			collection.setExcelParams(temp);
			collection.setExcelName(field.getAnnotation(ExcelCollection.class).name());
			additionalCollectionName(collection);
			excelCollection.add(collection);
		} else if (PoiPublicUtil.isJavaClass(field)) {
			addEntityToMap(targetId, field, excelEntity, pojoClass, getMethods, excelParams);
		} else {
			List<Method> newMethods = new ArrayList<Method>();
			if (getMethods != null) {
				newMethods.addAll(getMethods);
			}
			newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass));
			getAllExcelField(targetId, PoiPublicUtil.getClassFields(field.getType()), excelParams, excelCollection, field.getType(), newMethods);
		}
	}
}
 
Example 3
Source File: ImportBaseService.java    From easypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取需要导出的全部字段
 * 
 * 
 * @param exclusions
 * @param targetId
 *            目标ID
 * @param fields
 * @param excelCollection
 * @throws Exception
 */
public void getAllExcelField(String targetId, Field[] fields,
                             Map<String, ExcelImportEntity> excelParams,
                             List<ExcelCollectionParams> excelCollection, Class<?> pojoClass,
                             List<Method> getMethods) throws Exception {
    ExcelImportEntity excelEntity = null;
    for (int i = 0; i < fields.length; i++) {
        Field field = fields[i];
        if (PoiPublicUtil.isNotUserExcelUserThis(null, field, targetId)) {
            continue;
        }
        if (PoiPublicUtil.isCollection(field.getType())) {
            // 集合对象设置属性
            ExcelCollectionParams collection = new ExcelCollectionParams();
            collection.setName(field.getName());
            Map<String, ExcelImportEntity> temp = new HashMap<String, ExcelImportEntity>();
            ParameterizedType pt = (ParameterizedType) field.getGenericType();
            Class<?> clz = (Class<?>) pt.getActualTypeArguments()[0];
            collection.setType(clz);
            getExcelFieldList(targetId, PoiPublicUtil.getClassFields(clz), clz, temp, null);
            collection.setExcelParams(temp);
            collection.setExcelName(field.getAnnotation(ExcelCollection.class).name());
            additionalCollectionName(collection);
            excelCollection.add(collection);
        } else if (PoiPublicUtil.isJavaClass(field)) {
            addEntityToMap(targetId, field, excelEntity, pojoClass, getMethods, excelParams);
        } else {
            List<Method> newMethods = new ArrayList<Method>();
            if (getMethods != null) {
                newMethods.addAll(getMethods);
            }
            newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass));
            getAllExcelField(targetId, PoiPublicUtil.getClassFields(field.getType()),
                excelParams, excelCollection, field.getType(), newMethods);
        }
    }
}