开发工具与关键技术: Visual Studio 2015 mvc
作者:彭水清
撰写时间:2019/6/2
学习MVC,我们都离不开增、删、查、改,那么接下来我们就来说一说怎样现实MVC的联表查询吧。
那么在写联表查询时,我们需要用到layui.js这个插件。
我们需要给它设计数据表头,type类型为'radio'和'numbers',field设定字段名。字段名的设定非常重要,且是表格数据列的唯一标识。Title设定标题名称。
tabSetMealDetail = layuiTable.render({
elem: "#tabSetMealDetail",
url: "",
cols: [[
{ type: 'radio', fixed: 'left',
title: '选择', align: "center"
},//单选框列,fixed:'left' 将列固定在左边
{ type: 'numbers', title: '序号', align: "center" },//序号列,title设定标题名称
{
field: 'SetMealSetID', title: 'SetMealSetID', hide: true,
align: "center" },//hide:true 隐藏列
{
field: 'SetMealDetailID', title: 'SetMealDetailID', hide: true,
align: "center" },//hide:true 隐藏列
{ field: 'WGNumber', title: '编号', align: "center" },
MVC联表查询
最新推荐文章于 2019-07-17 16:47:21 发布
本文介绍了在MVC中如何进行联表查询,详细解释了控制器中的数据库操作,涉及到SetMealDetailVo实体类及其字段。查询过程中,通过SetMealDetail、WGItem、WGSmall和WGBig之间的外键关系实现多表连接。之后,通过where条件筛选获取所有字段,并实现了数据的分页展示。最后展示了联表查询和分页显示的实际效果。
摘要由CSDN通过智能技术生成