赞
踩
首先导入依赖
- <!-- hutool国产工具包 -->
- <dependency>
- <groupId>cn.hutool</groupId>
- <artifactId>hutool-all</artifactId>
- <version>5.7.15</version>
- </dependency>
用法:
- JSONObject jsonObject = new JSONObject();
- jsonObject.set("baseAchieveCount", baseAchieveCount);
- jsonObject.set("baseNeedCount", baseNeedCount);
- jsonObject.set("selectAchieveCount", selectAchieveCount);
- jsonObject.set("selectNeedCount", selectNeedCount);
- jsonObject.set("scoreAchieveCount", scoreAchieveCount);
- jsonObject.set("scoreNeedCount", scoreNeedCount);
- return ResponseResult.success(jsonObject);
可直接new一个json对象,如何对应赋值属性名与属性值
结果:
与对应VO实体类返回是一样的效果
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。