这是个后台接口
public Map getUserCouponsList(JSONObject head,JSONObject body) throws Exception {
// 业务信息
Map<String, Object> attributes=new HashMap<String, Object>();
//cityCode
String cityCode=head.optString("cityCode");
cityCode=GetCItyCode.getCityCode(cityCode);
String page=body.optString("page");
String rows=body.optString("rows");
int type=body.optInt("type");
String token=head.optString("token");
Object object=UserCacheManage.getAppUser(token);
if(object!=null){
UserCache user=(UserCache)object;
String userId=user.getUserId();
HhUserEntity hhUserEntity=super.getEntity(HhUserEntity.class, userId);
if(hhUserEntity!=null){
String nowTime=DateUtils.formatTime();
//%h:%i:%s
String queryString=" SELECT c.id,c.coupons_name as couponsName,c.coupons_cost as couponsCost,c.coupons_type as couponsType"
+ ",coupons_type_desc as couponsTypeDesc,c.pic_brand as picBrand,uc.is_use as isUse,date_format(c.start_time,'%Y-%c-%d') as startTime,date_format(c.end_time,'%Y-%c-%d') as endTime "
+ ",c.coupons_fullcut_desc as couponsFullcutDesc,c.coupons_discount_desc as couponsDiscountDesc,c.validity_period_desc as validityPeriodDesc "
+ " FROM hh_merchant_shop s,hh_coupons c,hh_coupons_shop cs,hh_user_coupons uc "
+ " WHERE cs.coupons_id = c.id AND cs.shop_id = s.id and uc.coupons_id=c.id and s.city_code='"+cityCode+"' and uc.user_id='"+userId+"'";
String whereString="";
//优惠卷类别 1.可用;2.历史
if(type==1){
whereString=whereString+" and ( '"+nowTime+"' between c.start_time and c.end_time ) and uc.is_use=0 ";
}else{
whereString=whereString+" and (( '"+nowTime+"' > c.end_time ) or uc.is_use=1 )";
}
String orderString=" group by uc.id order by uc.is_use desc,c.update_time desc,c.coupons_name asc ";
int offset=PagerUtil.getOffset(Integer.valueOf(page),Integer.valueOf(rows));
List<Map> list=super.findListbySqlReturnMapByPage(queryString+whereString+orderString, offset, Integer.valueOf(rows));
attributes.put("coupons", list);
}else{
throw new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));
}
}else{
throw new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));
}
return attributes;
}
debug发现查到的数据没有存到list里,咋回事??