基于javaweb+jsp的敬老院养老院管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
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…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、出入院模块、房间模块、信息模块的增删改查管理
vo.setXinxiText(Util.decode(request, "xinxiText"));
//调用Service层的增加(insert)方法
xinxiService.insert(vo);
this.redirectList(request, response);
}
/**
* 删除信息
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("xinxiDelete")
public void delete(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");
xinxiService.delete(Arrays.asList(id));
this.redirectList(request, response);
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS);
}
/**
* 判断字符串是否是乱码
*
* @param strName
* @return
*/
public static boolean isMessyCode(String strName) {
java.util.regex.Pattern p = java.util.regex.Pattern.compile("\\s*|\t*|\r*|\n*");
java.util.regex.Matcher m = p.matcher(strName);
String after = m.replaceAll("");
String temp = after.replaceAll("\\p{P}", "");
char[] ch = temp.trim().toCharArray();
float chLength = 0;
float count = 0;
for (int i = 0; i < ch.length; i++) {
UPDATE `t_fangjian`
<set>
<if test ='id != null'>`id` = #{id},</if>
<if test ='fangjianLouhao != null'>`fangjian_louhao` = #{fangjianLouhao},</if>
<if test ='fangjianFangjianhao != null'>`fangjian_fangjianhao` = #{fangjianFangjianhao},</if>
<if test ='fangjianLeixin != null'>`fangjian_leixin` = #{fangjianLeixin},</if>
<if test ='fangjianPrice != null'>`fangjian_price` = #{fangjianPrice},</if>
<if test ='fangjianName != null'>`fangjian_name` = #{fangjianName},</if>
<if test ='fangjianText != null'>`fangjian_text` = #{fangjianText}</if>
</set>
WHERE `id` = #{id}
</update>
<!--获取-->
<select id="findById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_fangjian` WHERE `id` = #{id}
</select>
<!--列表-->
<select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_fangjian`
<where>
}
});
//搜索
let $ = layui.$, active = {
reload: function () {
let url = 'xinxiList?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) : '';
});
});
</script>
</body>
</ul>
</c:if>
<c:if test="${loginUser!=null}">
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item"><a>${loginUser.username}</a></li>
<li class="layui-nav-item"><a href="authLogout">退出登录</a></li>
</ul>
</c:if>
</div>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<ul class="layui-nav layui-nav-tree" lay-filter="test">
<!-- 侧边栏 -->
<jsp:include page="menu.jsp">
<jsp:param value="active" name="Notice_active"/>
</jsp:include>
</ul>
</div>
</div>
<div class="layui-body">
<div class="search_style" style="padding-top: 10px;padding-left: 15px;">
<div class="searchTable">
搜索:
<div class="layui-inline">
success: function () {
console.log("已删除!");
}
});
obj.del(); //删除对应行(tr)的DOM结构,并更新缓存
//parent.location.reload();//刷新父级页面
// layer.close(index);
//parent.location.reload();//刷新父级页面
layer.msg(data.xinxiName + ' 删除成功!');
// });
} else if (layEvent === 'edit') { //编辑
layer.open({
type: 2,
area: ['800px', '550px'],
fixed: false, //不固定
maxmin: true,
content: 'xinxiEditPre?id=' + data.id
});
obj.update({});//同步更新缓存对应的值
} else if (layEvent === 'info') { //详情
<c:if test="${loginUser.userType == '管理员'}"><button class='layui-btn layui-btn-sm' lay-event='add'>添加</button></c:if>
</div>
</script>
<script>
function arrayBufferToBase64(buffer) {
let binary = '';
let bytes = new Uint8Array(buffer);
let len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
</sql>
<!--新增-->
<insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.Notice">
INSERT INTO `t_notice`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='id != null'>`id`,</if>
<if test ='noticeName != null'>`notice_name`,</if>
<if test ='noticeText != null'>`notice_text`,</if>
<if test ='noticeType != null'>`notice_type`,</if>
<if test ='createDate != null'>`create_date`</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='noticeName != null'>#{noticeName},</if>
<if test ='noticeText != null'>#{noticeText},</if>
<if test ='noticeType != null'>#{noticeType},</if>
<if test ='createDate != null'>#{createDate}</if>
</trim>
</insert>
<!--批量删除-->
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_notice` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
});
obj.update({});//同步更新缓存对应的值
} else if (layEvent === 'info') { //详情
layer.open({
type: 2,
area: ['800px', '650px'],
fixed: false, //不固定
maxmin: true,
content: 'noticeGet?id=' + data.id
});
obj.update({});//同步更新缓存对应的值
} else if (layEvent === 'LAYTABLE_TIPS') {
layer.alert('Hi,头部工具栏扩展的右侧图标。');
}
});
//头工具栏事件
table.on('toolbar(myTable)', function (obj) {
if ('add' == obj.event) {
layer.msg('添加');
layer.open({
type: 2,
area: ['800px', '550px'],
fixed: false, //不固定
maxmin: true,
content: 'notice_add.jsp'
});
} else {
reload: function () {
let url = 'userList?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) : '';
});
});
</script>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
params.put("keyword", keyword);//查询的关键字
response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(xinxiService.list(params).get("list")));
}
}
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.UserService;
import com.demo.vo.User;
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;
import javax.servlet.http.HttpSession;
import java.io.IOException;
public void setUserText(String userText) {
this.userText = userText;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
}
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>敬老院养老院管理系统</title>
<link rel="stylesheet" href="js/layui/css/layui.css">
<script src="js/jquery.js"></script>
<script src="js/layer.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
},
{
field: 'xinxiBir',
title: '出生日期',
},
{
field: 'xinxiZhuzhi',
title: '家庭住址',
},
{
field: 'xinxiText',
title: '备注',
},
{
align: 'center',
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_notice` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<!--修改-->
<update id="doUpdate" parameterType="com.demo.vo.Notice">
UPDATE `t_notice`
<set>
<if test ='id != null'>`id` = #{id},</if>
<if test ='noticeName != null'>`notice_name` = #{noticeName},</if>
<if test ='noticeText != null'>`notice_text` = #{noticeText},</if>
<if test ='noticeType != null'>`notice_type` = #{noticeType},</if>
<if test ='createDate != null'>`create_date` = #{createDate}</if>
</set>
WHERE `id` = #{id}
</update>