作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
管理员角色包含以下功能:
管理员登录,会员信息管理,球馆管理,预订信息管理,公告管理,评论管理,留言板管理等功能。
用户首页包含以下功能:
用户首页,用户登录,预定场地,我的预定,留言板等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
更多项目源码,请到“源码空间站”,地址:http://www.shuyue.fun/
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
技术栈
1. 后端:mysql+Spring+hibernate+spring mcv
2. 前端:HTML+CSS+JavaScript+jsp
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
运行截图
用户角色
管理端界面
相关代码
账户管理控制器
public class AccountAction extends BaseAction {
private static final long serialVersionUID = -4555048552772446336L;
private static final Logger log = Logger.getLogger(AccountAction.class);
private Account account;
private String newPassword;
private String result;
@SuppressWarnings("unchecked")
public String add() {
String str = "add_resp";
if (null == account) {
log.error("account is null.");
return str;
}
log.info("add account start.");
Map<String, Object> resp = null;
try {
resp = new HashMap<String, Object>();
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
if (null == accountService) {
log.error("account service is null.");
return str;
}
Map<String, Object> condition = new HashMap<String, Object>();
condition.put(AppConstants.QUERYTYPE, "queryByName");
condition.put("name", account.getName());
List<Account> list = (List<Account>) accountService.readRecord(Account.class, condition);
if (!list.isEmpty() && list != null) {
resp.put("respCode", "01");
return str;
}
account.setUuid(UUID.randomUUID().toString());
accountService.createRecord(account);
resp.put("respCode", "00");
} finally {
setResult(JsonUtil.Map2Json(resp));
log.info("add account end.");
}
return str;
}
public String update() {
String str = "update_resp";
if (null == account) {
log.error("account is null.");
return str;
}
log.info("update account(" + account.getName() + ") start.");
Map<String, Object> resp = null;
try {
resp = new HashMap<String, Object>();
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
if (null == accountService) {
log.error("account service is null.");
return str;
}
Account temp = (Account) accountService.loadRecord(Account.class, account.getId());
temp.setName(account.getName());
temp.setPassword(account.getPassword());
temp.setRole(account.getRole());
temp.setTel(account.getTel());
temp.setUsername(account.getUsername());
accountService.updateRecord(temp);
resp.put("respCode", "00");
} finally {
setResult(JsonUtil.Map2Json(resp));
log.info("update account(" + account.getName() + ") end.");
}
return str;
}
public String load() {
String str = ERROR;
if (null == account) {
return str;
}
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
if (null == accountService) {
return str;
}
Account temp = (Account) accountService.loadRecord(Account.class, account.getId());
if (null != temp) {
request.put("account", temp);
str = "load_success";
}
return str;
}
public String delete() {
String str = ERROR;
log.info("delete account start.");
if (null == account) {
log.error("account is null.");
return str;
}
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
if (null == accountService) {
log.error("account service is null.");
return str;
}
if (accountService.deleteRecord(Account.class, account.getId())) {
str = "delete_success";
}
log.info("delete account end.");
return str;
}
@SuppressWarnings("unchecked")
public String query() {
String str = "query_resp";
log.info("query(" + account.getName() + ") account start.");
Map<String, Object> resp = null;
try {
resp = new HashMap<String, Object>();
if (null == account) {
log.error("account is null.");
return str;
}
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
if (null == accountService) {
log.error("service is null.");
return str;
}
Map<String, Object> condition = new HashMap<String, Object>();
condition.put(AppConstants.QUERYTYPE, "queryByName");
condition.put("name", account.getName());
List<Account> list = (List<Account>) accountService.readRecord(Account.class, condition);
Account temp = null;
if (!list.isEmpty() && list != null) {
temp = list.get(0);
resp.put("account", temp);
resp.put("respCode", "00");
}
} finally {
setResult(JsonUtil.Map2Json(resp));
log.info("query (" + account.getName() + ") account end.");
}
return str;
}
public String alter() {
String username = ((Account) session.get("account")).getUsername();
String password = account.getPassword();
String role = String.valueOf(((Account) session.get("account")).getRole());
IAccountService accountService = (IAccountService) SpringContextHolder.getBean("accountService");
Account acc = accountService.login(username, password, role);
if (acc != null) {
acc.setPassword(newPassword);
accountService.updateRecord(acc);
return "alter_success";
}
return ERROR;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
}
如果也想学习本系统,下面领取。关注并回复:097ssh