导出excel(springmvc)

Controller

@Controller
public class FineController extends ExportController{
	@Resource
	private FineExportService fineExportService ;
   
   @RequestMapping(value="/fineExportExcel.do",method=RequestMethod.GET,produces="text/html;charset=UTF-8")
   @ResponseBody
   @ArchivesLog(operationType="数据导出",operationName="导出文件")
   public void execute(HttpServletRequest request, HttpServletResponse response)throws Exception{
          try{
				//导出excel
				long statrTime=System.currentTimeMillis();
				exportExcel(request,response);
				long endTime=System.currentTimeMillis();
				logger.debug("导出excel成功,耗时:"+(endTime-statrTime)+"ms");
          }catch(Exception e){
			    logger.error("导出excel出错,"+e.getMessage(),e);
          }
   }
   protected void exportExcel(HttpServletRequest request, HttpServletResponse response)throws Exception{
            fineExportService.getExcel(request,response); 
    }

}

ServiceImpl

public class fineExportServiceImpl implements FineExportService{
		@Autowired
		private FineExportMapper fineExportMapper;
       FineExportUtil fineExportUtil=new FineExportUtil ();
       
       @Override
       public List> queryDatas(Map map){
           List> dataList=new ArrayList>();
           dataList=fineExportMapper.queryDatas(map);
           return dataList;
       }
       
       @Override
       public void getExcel(HttpServletRequest request, HttpServletResponse response)throws Exception{
			
		}

}

你可能感兴趣的:(导出excel(springmvc))