public Map<String, Object> delete(JSONObject head, JSONObject body)
throws Exception {
Map<String, Object> attributes=new HashMap<String, Object>();
JSONArray couponJson=body.optJSONArray("couponId");
String token=head.optString("token");
Object object=UserCacheManage.getAppUser(token);
//if(object!=null){
//UserCache user=(UserCache)object;
String userId="4028668150c6aedb0150c6ddde750005";
HhUserEntity hhUserEntity=super.getEntity(HhUserEntity.class, userId);
if(hhUserEntity!=null){
String ids="";
Object [] couponIds=(Object[])couponJson.toArray();
if(couponIds!=null&&couponIds.length>0){
for(int i=0;i<couponIds.length;i++){
if(i==0){
ids=ids+"'"+couponIds[i]+"'";
}else{
ids=ids+",'"+couponIds[i]+"'";
}
}
}
String hql="from CouponPublishEntity e CouponPoolEntity d where d.owner='"+userId+"' and e.pubid in ("+ids+") ";
List<HhCouponsEntity> list = super.findByQueryString(hql);
if(list!=null&&list.size()>0){
super.deleteAllEntitie(list);
}
我要取到couponId然后批量删除实体,但是body.optJSONArray("couponId")得到的是object类型不是jsonarry类型,这怎么办- -