Dao层代码
public interface AttachmentDao {
List<AttachmentExtends> selectAttachmentList();
}
Service层代码
@Service
public class AttachmentServiceImp implements AttachmentService {
@Autowired
private AttachmentDao attachmentDao;
//查询所有的附件
@Override
public PageInfo queryAttachmentList(int currentPage) throws Exception {
PageHelper.startPage(currentPage,3);
List list = attachmentDao.selectAttachmentList();
PageInfo pageInfo = new PageInfo<>(list,5);
return pageInfo;
}
}
public interface AttachmentService {
PageInfo queryAttachmentList(int currentPage)throws Exception;
}
Controller层代码
@Controller
@RequestMapping("/atta")
public class AttachmentController {
@Autowired
private AttachmentService attachmentService;
//查询后台数据库的所有附件
@RequestMapping("/attachment-show")
public String attachmentShow(Model model,@RequestParam(defaultValue = “1”) int currentPage)throws Exception{
PageInfo pageInfo = attachmentService.queryAttachmentList(currentPage);
model.addAttribute(“pageInfo”,pageInfo);
return “…/project-file.jsp”;
}
}
前端数据的显示及前端分页的代码
<c:forEach items="KaTeX parse error: Expected 'EOF', got '#' at position 75: …nter' bgcolor="#̲FFFFFF" onMou…{xxoo.count}
a
t
t
.
a
t
t
n
a
m
e
<
/
t
d
>
<
t
d
a
l
i
g
n
=
"
c
e
n
t
e
r
"
>
<
a
h
r
e
f
=
′
′
>
<
u
>
{att.attname}</td> <td align="center"><a href=''><u>
att.attname</td><tdalign="center"><ahref=′′><u>{att.projectExtends.pname}
<fmt:formatDate value="<%= new Date() %>" pattern=“yyyy-MM-dd HH:mm:ss”></fmt:formatDate>
<fmt:formatDate value="<%= new Date() %>" pattern=“yyyy-MM-dd HH:mm:ss”></fmt:formatDate>
下载 |删除 |编辑 | 查看详情
</c:forEach>
页码部分
本文介绍了一个基于分层架构的文件管理系统实现,包括Dao层的数据库操作接口、Service层的业务逻辑处理以及Controller层的请求响应处理。系统通过PageHelper进行分页查询,返回PageInfo对象给前端展示。

9012

被折叠的 条评论
为什么被折叠?



