请教一下,谢谢!

package com.t200.book.controller;


import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.HashMap;

import java.util.List;

import java.util.Map;


import javax.servlet.http.HttpServletRequest;


import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;


import com.t200.book.service.DetailService;


/**

 * 收入状况相关功能

 * @author 马凯   2016-10-14

 */


@Controller

@RequestMapping("/detail")

public class DetailController {


@Autowired

private DetailService detailService;

@RequestMapping("/day")

public @ResponseBody Object day(HttpServletRequest request){

//

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");

//Map<String, Object> params - com.t200.book.controller.DetailController.day(HttpServletRequest)


Map<String, Object> params = new HashMap<String, Object>();


//获取日期及作者id

String date = request.getParameter("date");

String authorid = request.getParameter("authorid");

//为空或为null

if(date==null||"".equals(date)){

date = sdf.format(new Date());

}

//赋值   date  

params.put("date", date);

params.put("authorid", authorid);

//调用service

List<Map<String, Object>> list = detailService.dayDetail(params);

// 清除

params.clear();

//

params.put("rows", list);    //请解释一下这段代码

//{rows:[{},{},{}]}   json

return params;  //请解释一下这段代码

}

}


朴实
浏览 1244回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java