基于javaweb+jsp的饮食营养健康管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
//查询列和关键字
String searchColumn = Util.decode(request, "searchColumn");
String keyword = Util.decode(request, "keyword");
Map params = new HashMap();//用来保存控制层传进来的参数(查询条件)
params.put("searchColumn", searchColumn);//要查询的列
params.put("keyword", keyword);//查询的关键字
response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(noticeService.list(params).get("list")));
}
}
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.ShiliaoService;
import com.demo.vo.Shiliao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
field: 'userSex',
title: '性别',
templet: vo => vo.userSex ? vo.userSex : "",
},
{
field: 'userPhone',
title: '手机',
},
{
field: 'userText',
title: '备注',
},
{
field: 'userType',
title: '类型',
templet: vo => vo.userType ? vo.userType : "",
},
{
align: 'center',
fixed: 'right',
title: '操作',
width: 130,
templet: vo => {
let flag1 = ${loginUser.id} == vo.id;
1=1
ORDER BY id ASC
LIMIT #{startIndex},#{pageSize};
});
//监听工具条
table.on('tool(myTable)', function (obj) { //注:tool 是工具条事件名,myTable 是 table 原始容器的属性 lay-filter="对应的值"
let data = obj.data; //获得当前行数据
let layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
if (layEvent === 'del') { //删除
// layer.confirm('删除' + data.realName + "?", function (index) {
$.ajax({
type: "GET",
dataType: "text",
url: "userDelete?id=" + data.id,
success: function () {
console.log("已删除!");
}
});
obj.del(); //删除对应行(tr)的DOM结构,并更新缓存
//parent.location.reload();//刷新父级页面
`shiliao_text` #{id}, #{shiliaoName}, #{shiliaoFangan}, #{shiliaoText} DELETE FROM `t_shiliao` WHERe `id` IN #{id}
let $ = layui.$, active = {
reload: function () {
let url = 'noticeList?keyword=' + $('#search_keyword').val() + '&searchColumn=' + $('#searchColumn').val();
//执行重载
table.reload('myTable', {
url: url,
page: {
curr: 1 //重新从第 1 页开始
}
});
}
};
$('.searchTable .layui-btn').on('click', function () {
let type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
title: '操作',
width: 130,
templet: vo => {
let flag = ${loginUser.userType == '管理员'};
return flag ? '编辑删除' : '';
}
}
]
],
});
//监听工具条
table.on('tool(myTable)', function (obj) { //注:tool 是工具条事件名,myTable 是 table 原始容器的属性 lay-filter="对应的值"
let data = obj.data; //获得当前行数据
let layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
if (layEvent === 'del') { //删除
// layer.confirm('删除' + data.shiliaoName + "?", function (index) {
$.ajax({
last: false, //不显示尾页
},
toolbar: '#myToolbar', //开启头部工具栏,并为其绑定左侧模板
defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
title: '提示',
layEvent: 'LAYTABLE_TIPS',
icon: 'layui-icon-tips'
}],
title: '食材信息列表',
cols: [
[
{
field: 'foodName',
title: '名称',
templet: vo => (vo = vo.foodName) ? '' + vo + '' : '',
//@Override
public boolean update(Notice vo) {
return this.noticeMapper.doUpdate(vo) == 1;
}
//@Override
public Notice get(Serializable id) {
return this.noticeMapper.findById(id);
}
//@Override
public Map list(Map params) {
Map resultMap = new HashMap();
resultMap.put("totalCount", this.noticeMapper.getAllCount(params));
resultMap.put("list", this.noticeMapper.findAllSplit(params));
return resultMap;
}
}
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
title: '姓名',
templet: vo => (vo = vo.realName) ? '' + vo + '' : '',
event: 'info',
},
{
field: 'userSex',
title: '性别',
templet: vo => vo.userSex ? vo.userSex : "",
},
{
field: 'userPhone',
title: '手机',
},
{
field: 'userText',
title: '备注',
},
{
field: 'userType',
title: '类型',
templet: vo => vo.userType ? vo.userType : "",
},
{
align: 'center',
fixed: 'right',
title: '操作',
width: 130,
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、食材信息模块、食疗处方模块的增删改查管理



