1. mapper.xml设置resultType
resultType="com.alibaba.fastjson.JSONObject"
2. Mapper.java使用JSONObject接收
// 查询isvalid=1的数据
JSONObject selectValidBom(String parentsCode);
3. 测试
// 测试查询BOM的sql语句
@Test()
public void testSelectValidBom() {
JSONObject validBom = ebomService.getValidBom("YZCL-80051-0010");
System.out.println("结果:" + validBom);
System.out.println("主键:" + validBom.getString("AutoID"));
System.out.println("版本号:" + validBom.getIntValue("bbh"));
}