- import org.json.JSONArray;
import org.json.JSONObject;
- 将字符串转化为JSONArray JSONArray jsonArray = new JSONArray(deviceInfo); //注意字符串的格式
- 将JSONArray转化为JSONObject类型 JSONObject jsonObject = jsonArray.getJSONObject(0);
- 将值存入Map Map<String,String> map = HashMap(); map.put("a",jsonObject.getString("a"));
- Mybatis传入Map类型的参数
![](https://images2017.cnblogs.com/blog/1177029/201708/1177029-20170809134151417-1336301612.png)
- <insert id="saveNewDeviceInfo" parameterType="java.util.Map">
insert into device (NAME,IP,MAC,Vendor,HardwareVersion,FirmwareVersion,Description) value ( #{NewName},#{NewIP},#{NewMac},#{Vendor},#{HardwareVersion},
#{FirmwareVersion},#{Description})
</insert>
posted @
2017-08-09 13:42
起床oO
阅读(
6053)
评论()
编辑
收藏
举报