Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json4excel 按照Sheet加载的数据没有判断sheetName #105

Open
Rekoe opened this issue Jun 5, 2018 · 1 comment
Open

json4excel 按照Sheet加载的数据没有判断sheetName #105

Rekoe opened this issue Jun 5, 2018 · 1 comment

Comments

@Rekoe
Copy link
Member

Rekoe commented Jun 5, 2018

RT

2018-06-05_15_43_05_fordeal.xlsx

@J4EName("多属性值替换表")
@Table("attribute_value_filter")
public class AttributeValueFilter extends DataBaseEntity implements Serializable {

	private static final long serialVersionUID = 560490839392236372L;

	@Name
	@J4EName("有效词")
	private String name;

	@Column
	@J4EName("英文")
	private String en;

	@Column
	@J4EName("阿语")
	private String ar;

	public AttributeValueFilter() {
		super();
	}

	public AttributeValueFilter(String name, String en, String ar) {
		super();
		this.name = name;
		this.en = en;
		this.ar = ar;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEn() {
		return en;
	}

	public void setEn(String en) {
		this.en = en;
	}

	public String getAr() {
		return ar;
	}

	public void setAr(String ar) {
		this.ar = ar;
	}

}

code

public static void main(String[] args) {
		Workbook wb = J4E.loadExcel(Streams.fileIn("2018-06-05_15_43_05_fordeal.xls"));
		J4EConf j4eConf = J4EConf.from(AttributeValueFilter.class);
		System.out.println(j4eConf.getSheetName());
		Sheet sheet = J4E.getSheet(wb, AttributeValueFilter.class, j4eConf);
		List<AttributeValueFilter> listJ4EConfAttributeValueFilter = J4E.fromSheet(sheet, AttributeValueFilter.class, j4eConf, false);
		System.out.println(sheet.getSheetName());
		System.out.println(listJ4EConfAttributeValueFilter);
	}

print


[{
   "en": "",
   "ar": ""
}, {
   "en": "80cm",
   "ar": "80cm"
}, {
   "en": "90cm",
   "ar": "90cm"
}, {
   "en": "100cm",
   "ar": "100cm"
}, {
   "en": "110cm",
   "ar": "110cm"
}, {
   "en": "120cm",
   "ar": "120cm"
}, {
   "en": "130cm",
   "ar": "130cm"
}, {
   "en": "140cm",
   "ar": "140cm"
}, {
   "en": "Pink",
   "ar": "رمادي"
}, {
   "en": "Green",
   "ar": "أخضر"
}, {
   "en": "Light Blue",
   "ar": "أزرق فاتح"
}, {
   "en": "80cm",
   "ar": "80cm"
}, {
   "en": "85cm",
   "ar": "85cm"
}, {
   "en": "90cm",
   "ar": "90cm"
}, {
   "en": "100cm",
   "ar": "100cm"
}, {
   "en": "S",
   "ar": "S"
}, {
   "en": "M",
   "ar": "M"
}, {
   "en": "L",
   "ar": "L"
}, {
   "en": "XL",
   "ar": "XL"
}]

因为加载的sheet不是这个pojo 加载的数据应该为empty,看了下代码 没有验证pojo的表名和sheet中的sheetname 的判断

@pangwu86

@pangwu86
Copy link
Member

刚看到,这周找时间fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants