首页>代码>基于Spring+Spring MVC+Mybatis开发ssm网站后台管理系统,MyBatis Generator支持简单代码生成>/ssm/src/main/java/com/xiaoshu/controller/AttachmentController.java
package com.xiaoshu.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.xiaoshu.config.util.ConfigUtil;
import com.xiaoshu.entity.Attachment;
import com.xiaoshu.service.AttachmentService;
import com.xiaoshu.util.StringUtil;
import com.xiaoshu.util.WriterUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
@Controller
@RequestMapping("attachment")
public class AttachmentController {
@Autowired
private AttachmentService attachmentService;
@RequestMapping("attachmentIndex")
public String index(HttpServletRequest request,HttpServletResponse response){
return "attachment";
}
@RequestMapping("attachmentList")
public void list(HttpServletRequest request,HttpServletResponse response,String offset,String limit){
try {
Integer pageSize = StringUtil.isEmpty(limit)?ConfigUtil.getPageSize():Integer.parseInt(limit);
Integer pageNum = (Integer.parseInt(offset)/pageSize)+1;
PageInfo<Attachment> pageInfo = attachmentService.findAttachment(pageNum,pageSize);
JSONObject jsonObj = new JSONObject();
jsonObj.put("total",pageInfo.getTotal());
jsonObj.put("rows", pageInfo.getList());
WriterUtil.write(response,jsonObj.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
最近下载更多
yinfei305 LV2
2024年6月19日
yyhrhv LV8
2024年5月23日
逝水莲花 LV7
2023年12月1日
13188866605 LV12
2023年10月22日
38735466 LV11
2023年7月4日
小龙快飞 LV5
2022年12月29日
renyuan LV9
2022年12月7日
微信网友_6108289352863744 LV4
2022年9月16日
chenhan413 LV10
2022年5月30日
y1214435276 LV9
2022年5月6日
最近浏览更多
奋斗的小蚂蚁 LV16
10月28日
chengguo123
4月2日
暂无贡献等级
三秋桂子 LV1
2024年12月22日
ma406805131 LV19
2024年12月18日
微信网友_7051335135711232
2024年6月24日
暂无贡献等级
lun123456
2024年6月22日
暂无贡献等级
yinfei305 LV2
2024年6月19日
木XX木大xqvq LV1
2024年6月2日
yyhrhv LV8
2024年5月23日
李俊雄 LV3
2024年5月8日

