作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
该项目主要包括三个角色:管理员、收银员、用户;
用户角色包含以下功能:
用户登录,修改个人信息,查看我的订单等功能。
管理员角色包含以下功能:
管理员登录,滑雪场管理,订单管理,教练管理,器材管理,会员管理,收银员管理等功能。
收银员角色包含以下功能:
滑雪场管理,订单管理,教练管理,器材管理,会员管理等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
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版本;
6.是否Maven项目:否;
技术栈
1. 后端:mysql+Spring+hibernate+struts2
2. 前端:JSP+CSS+JavaScript+jQuery+layui
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中config/jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
用户账号/密码:user/123456
收银员账号/密码:shouyin/123456
管理员账号/密码:admin/admin
运行截图
管理员角色
用户角色页面
相关代码
场地管理控制
@Controller("areaAction")
@Scope("prototype")
public class AreaAction extends ActionSupport implements ModelDriven<Area>{
private static final long serialVersionUID = 1L;
//==========model==============
private Area area;
@Override
public Area getModel() {
if(area==null) area = new Area();
return area;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private AreaService areaService;
/**
* 列表分页查询
*/
public String area(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Area where 1=1 ");
if(area.getPrice() != null){
sb.append(" and price = :price");
alias.put("price", area.getPrice());
}
if(area.getState() != null&&!"".equals(area.getState())){
sb.append(" and state = :state");
alias.put("state", area.getState());
}
if(area.getType() != null&&!"".equals(area.getType())){
sb.append(" and type = :type");
alias.put("type", area.getType());
}
sb = sb.append(" order by id desc");
Pager<Area> pagers = areaService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", area);
return SUCCESS;
}
public String area1(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Area where 1=1 and state =0 ");
if(area.getPrice() != null){
sb.append(" and price = :price");
alias.put("price", area.getPrice());
}
if(area.getUseState() != null&&!"".equals(area.getUseState())){
sb.append(" and useState = :useState");
alias.put("useState", area.getUseState());
}
if(area.getType() != null&&!"".equals(area.getType())){
sb.append(" and type = :type");
alias.put("type", area.getType());
}
sb = sb.append(" order by id desc");
Pager<Area> pagers = areaService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", area);
return SUCCESS;
}
/**
* 列表分页查询
*/
public String area2(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Area where 1=1 and state =0 ");
if(area.getPrice() != null){
sb.append(" and price = :price");
alias.put("price", area.getPrice());
}
if(area.getUseState() != null&&!"".equals(area.getUseState())){
sb.append(" and useState = :useState");
alias.put("useState", area.getUseState());
}
if(area.getType() != null&&!"".equals(area.getType())){
sb.append(" and type = :type");
alias.put("type", area.getType());
}
sb = sb.append(" order by id desc");
Pager<Area> pagers = areaService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", area);
return SUCCESS;
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}
public String exAdd(){
areaService.save(area);
ActionContext.getContext().put("url", "/area_area.do");
return "redirect";
}
/**
* 跳转修改页面
* @return
*/
public String update(){
Area n = areaService.getById(area.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
public String update1(){
Area n = areaService.getById(area.getId());
if(n.getUseState()==null||n.getUseState()==1||n.getUseState()==0){
n.setUseState(2);
}else{
n.setUseState(0);
}
areaService.save(n);
ActionContext.getContext().put("url", "/area_area1.do");
return "redirect";
}
/**
* 删除
* @return
*/
public String delete(){
areaService.delete(area.getId());
ActionContext.getContext().put("url", "/area_area.do");
return "redirect";
}
public String exUpdate() {
Area n = areaService.getById(area.getId());
n.setPrice(area.getPrice());
n.setType(area.getType());
n.setState(area.getState());
areaService.update(n);
ActionContext.getContext().put("url", "/area_area.do");
return "redirect";
}
}
教练管理控制器
@Controller("coachAction")
@Scope("prototype")
public class CoachAction extends BaseAction implements ModelDriven<Coach>{
private static final long serialVersionUID = 1L;
//==========model==============
private Coach coach;
@Override
public Coach getModel() {
if(coach==null) coach = new Coach();
return coach;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private CoachService coachService;
//依赖注入 end dao/service/===
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
//============文件上传start=======================================================
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=========================================================
public String jsonAction() {
// dataMap中的数据将会被Struts2转换成JSON字符串,所以这里要先清空其中的数据
jsonMap.clear();
jsonMap.put("success", true);
return JSON_TYPE;
}
//-------------------------华丽分割线---------------------------------------------//
//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
*/
public String coach(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Coach where 1=1 ");
if(coach.getLevel() != null&&!"".equals(coach.getLevel())){
sb.append(" and level = :level");
alias.put("level", coach.getLevel());
}
if(coach.getSex() != null&&!"".equals(coach.getSex())){
sb.append(" and sex = :sex");
alias.put("sex", coach.getSex());
}
if(coach!=null && coach.getName() !=null && !"".equals(coach.getName())){
sb.append(" and name like :name ");
alias.put("name", "%" +coach.getName()+ "%" );
}
sb = sb.append(" order by id desc");
Pager<Coach> pagers = coachService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", coach);
return SUCCESS;
}
public String coach1(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Coach where 1=1 ");
if(coach.getLevel() != null&&!"".equals(coach.getLevel())){
sb.append(" and level = :level");
alias.put("level", coach.getLevel());
}
if(coach.getSex() != null&&!"".equals(coach.getSex())){
sb.append(" and sex = :sex");
alias.put("sex", coach.getSex());
}
if(coach.getPrice() != null&&!"".equals(coach.getPrice())){
sb.append(" and price = :price");
alias.put("price", coach.getPrice());
}
if(coach.getAge() != null&&!"".equals(coach.getAge())){
sb.append(" and age = :age");
alias.put("age", coach.getAge());
}
// if(coach!=null && coach.getName() !=null && !"".equals(coach.getName())){
// sb.append(" and name like :name ");
// alias.put("name", "%" +coach.getName()+ "%" );
// }
sb = sb.append(" order by id desc");
Pager<Coach> pagers = coachService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", coach);
return SUCCESS;
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}
/**
* 执行添加
* @return
* @throws UnsupportedEncodingException
*/
public String exAdd() throws UnsupportedEncodingException{
String newName = new String(coach.getName().getBytes("ISO8859-1"),"utf-8");
coach.setName(newName);
coach.setState(0);
coachService.save(coach);
ActionContext.getContext().put("url", "/coach_coach.do");
return "redirect";
}
/**
* 查看详情页面
* @return
*/
public String view(){
Coach n = coachService.getById(coach.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
/**
* 跳转修改页面
* @return
*/
public String update(){
Coach n = coachService.getById(coach.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
public String update1(){
Coach n = coachService.getById(coach.getId());
if(n.getState()==null||n.getState()==1){
n.setState(0);
}else{
n.setState(1);
}
coachService.update(n);
ActionContext.getContext().put("url", "/coach_coach1.do");
return "redirect";
}
/**
* 执行修改
* @return
* @throws UnsupportedEncodingException
*/
public String exUpdate() throws UnsupportedEncodingException{
Coach n = coachService.getById(coach.getId());
String newName = new String(coach.getName().getBytes("ISO8859-1"),"utf-8");
n.setAge(coach.getAge());
n.setName(newName);
n.setLevel(coach.getLevel());
n.setSex(coach.getSex());
n.setPrice(coach.getPrice());
coachService.update(n);
ActionContext.getContext().put("url", "/coach_coach.do");
return "redirect";
}
/**
* 删除
* @return
*/
public String delete(){
coachService.delete(coach.getId());
ActionContext.getContext().put("url", "/coach_coach.do");
return "redirect";
}
//=============公=======共=======方=======法==========区=========end============//
//-------------------------华丽分割线---------------------------------------------//
//=============自=======定=======义=========方=======法==========区=========start============//
//=============自=======定=======义=========方=======法==========区=========end============//
}
器材管理控制器
@Controller("equipAction")
@Scope("prototype")
public class EquipAction extends BaseAction implements ModelDriven<Equip>{
private static final long serialVersionUID = 1L;
//==========model==============
private Equip equip;
@Override
public Equip getModel() {
if(equip==null) equip = new Equip();
return equip;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private EquipService equipService;
//依赖注入 end dao/service/===
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
//============文件上传start=======================================================
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=========================================================
public String jsonAction() {
// dataMap中的数据将会被Struts2转换成JSON字符串,所以这里要先清空其中的数据
jsonMap.clear();
jsonMap.put("success", true);
return JSON_TYPE;
}
//-------------------------华丽分割线---------------------------------------------//
//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
*/
public String equip(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Equip where 1=1 ");
if(equip.getType() != null&&!"".equals(equip.getType())){
sb.append(" and type = :type");
alias.put("type",equip.getType());
}
if(equip.getPrice() != null&&!"".equals(equip.getPrice())){
sb.append(" and price = :price");
alias.put("price",equip.getPrice());
}
if(equip!=null && equip.getName() !=null && !"".equals(equip.getName())){
sb.append(" and name like :name ");
alias.put("name", "%" +equip.getName()+ "%" );
}
sb = sb.append(" order by id desc");
Pager<Equip> pagers = equipService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", equip);
return SUCCESS;
}
public String equip1(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Equip where 1=1 ");
if(equip.getType() != null&&!"".equals(equip.getType())){
sb.append(" and type = :type");
alias.put("type",equip.getType());
}
if(equip.getPrice() != null&&!"".equals(equip.getPrice())){
sb.append(" and price = :price");
alias.put("price",equip.getPrice());
}
sb = sb.append(" order by id desc");
Pager<Equip> pagers = equipService.findByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", equip);
return SUCCESS;
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}
/**
* 执行添加
* @return
* @throws UnsupportedEncodingException
*/
public String exAdd() throws UnsupportedEncodingException{
String newName = new String(equip.getName().getBytes("ISO8859-1"),"utf-8");
equip.setName(newName);
equip.setState(0);
equipService.save(equip);
ActionContext.getContext().put("url", "/equip_equip.do");
return "redirect";
}
/**
* 查看详情页面
* @return
*/
public String view(){
Equip n = equipService.getById(equip.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
/**
* 跳转修改页面
* @return
*/
public String update(){
Equip n = equipService.getById(equip.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
public String update1(){
Equip n = equipService.getById(equip.getId());
if(n.getState()==null||n.getState()==1){
n.setState(0);
}else{
n.setState(1);
}
equipService.update(n);
ActionContext.getContext().put("url", "/equip_equip1.do");
return "redirect";
}
/**
* 执行修改
* @return
* @throws UnsupportedEncodingException
*/
public String exUpdate() throws UnsupportedEncodingException{
Equip n = equipService.getById(equip.getId());
String newName = new String(equip.getName().getBytes("ISO8859-1"),"utf-8");
n.setName(newName);
n.setPrice(equip.getPrice());
n.setType(equip.getType());
equipService.update(n);
ActionContext.getContext().put("url", "/equip_equip.do");
return "redirect";
}
/**
* 删除
* @return
*/
public String delete(){
equipService.delete(equip.getId());
ActionContext.getContext().put("url", "/equip_equip.do");
return "redirect";
}
//=============公=======共=======方=======法==========区=========end============//
//-------------------------华丽分割线---------------------------------------------//
//=============自=======定=======义=========方=======法==========区=========start============//
//=============自=======定=======义=========方=======法==========区=========end============//
}
如果也想学习本系统,下面领取。关注并回复:076ssh