postman 输出 没内容

输入:
{
"head": {

"deviceId":"deviceId",
"os":1,
"token":"",

},

"body":{

  "rows": "10",
  "page":"10",
  "type":"1",
}

}
输出
{

"obj": {
    "code": 200,
    "msg": "success"
},
"attributes": {
    "coupons": []
},
"msg": "操作成功",
"success": true

}
后台接口程序
public Map<String, Object> getMyRolls(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(true){        
        UserCache user=(UserCache)object;
        String userId="4028668150c2acb40150c2c69a03000d";
        HhUserEntity hhUserEntity=super.getEntity(HhUserEntity.class, userId);
        if(hhUserEntity!=null){
            
            String nowTime=DateUtils.formatTime();

//%h:%i:%s

            String queryString=" SELECT c.couponname,c.couponfee,"
    • "c.pic1_path,c.pic2_path,date_format(c.endtime,'%Y-%c-%d') as endTime "

    • "FROM couponpool s,couponpublish c "

    • " WHERE s.pubid = c.pubid AND s.owner='"+userId+"'";

                
                String whereString="";
                //优惠卷类别  1.可用;2.历史
                if(type==1){
                    whereString=whereString+" and ( '"+nowTime+"' between c.starttime and c.endtime ) and  s.status=3 ";
                }else{
                    whereString=whereString+" and (( '"+nowTime+"' > c.endtime ) or s.status=7  )";
                }
      
               String orderString=" order by c.updatetime ";
            
    1. 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{
    2. new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));

           }
           
       }else{
    1. new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));

        }
        
    1. attributes;

      }

      输出怎么没有list查的数据??

    阅读 2.9k
    1 个回答

    debug后台打印输出list,首先确保list有值

    撰写回答
    你尚未登录,登录后可以
    • 和开发者交流问题的细节
    • 关注并接收问题和回答的更新提醒
    • 参与内容的编辑和改进,让解决方法与时俱进
    推荐问题