基于javaweb+mysql的springboot健身管理系统(java+springboot+mysql+jsp)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot健身管理系统(java+springboot+mysql+jsp)
主要技术:springmvc、 springboot 、jpa、mysql 、jQuery、layui、css、jsp shiro权限控制
主要功能截图如下:
用户登录、首页主要功能有:会员信息管理、会员到期续费管理、充值管理、教练课程管理、私教管理、器材管理、小商品售卖管理、信息统计、修改密码等主要功能:
会员管理、续卡、会员卡类型管理:
教练列表展示和添加修改删除教练信息:
会员私教课程管理:
添加私教信息:
健身课程列表展示查询和添加修改:
健身器材列表展示查询和添加修改:
物品遗失管理、归还、添加丢失物品、查询、取回丢失物品等:
健身房小商品售卖管理:列表数据展示、查询、进货、售卖 退货等操作
简单的树状图统计:
代码:
数据库表:
@RequestMapping("/cha")
@ResponseBody
public Optional<Goods> one(long goodsId){
return goodsDao.findById(goodsId);
}
/**
* @Description: 商品管理-根据商品名称计算总数量
* xiaoc
*/
@RequestMapping("/count")
@ResponseBody
public Long count (String goodsName){
goodsDaoImpl.count(goodsName);
return goodsDaoImpl.count(goodsName);
}
/**
* @Description: 商品管理-修改商品信息
* xiaoc
*/
@RequestMapping("/upd")
@ResponseBody
public void upd(Goods goods){
goodsDaoImpl.update(goods);
}
/**
* @Description: 商品管理-修改商品信息
* xiaoc
*/
@RequestMapping("/update")
@ResponseBody
public void update(Goods goods){
goodsDao.save(goods);
}
/**
* @Description: 商品管理-查询所有商品信息
* xiaoc
*/
@RequestMapping("/topcoach")
@ResponseBody
public Map<String,Object> topcoach(){
Map<String,Object> map = new HashMap<String,Object>();
map.put("goods",goodsDao.findAll());
return map ;
return loos;
}
}
/**
* @Description: 会员卡类型信息Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/metype")
public class MetypeController {
@Autowired
private MembertypeDaoImpl membertypeDaoImpl;
@Autowired
private MemberttypeDao memberttypeDao;
/**
* @Description: 会员卡类型-删除
* xiaoc
*/
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long typeId,String typeName, int pageSize, int pageNumber){
memberttypeDao.deleteById(typeId);
* @Description: 商品售卖信息管理-根据商品id,会员id查询商品售卖信息
* xiaoc
*/
@RequestMapping("/query")
@ResponseBody
public Map<String,Object> query(Integer goodsid,Integer memberid, int pageSize, int pageNumber){
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("goodsid",goodsid);
map1.put("memberid",memberid);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return goodInfoDaoImpl.query(map1);
}
/**
* @Description: 商品售卖信息管理-根据商品id,会员id删除信息
* xiaoc
*/
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long id,Integer goodsid,Integer memberid,int pageSize, int pageNumber){
goodInfoDao.deleteById(id);
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("goodsid",goodsid);
map1.put("memberid",memberid);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return goodInfoDaoImpl.query(map1);
}
/**
* @Description: 商品售卖信息管理-根据商品id,会员id批量删除信息
* xiaoc
*/
@RequestMapping("/dellist")
@ResponseBody
public Map<String,Object> delete(int array[],Integer goodsid,Integer memberid,int pageSize, int pageNumber){
System.out.println(array[0]);
for(int i = 0;i<array.length;i++){
goodInfoDao.deleteById((long) array[i]);
}
return query(goodsid,memberid,pageSize,pageNumber);
}
/**
* @Description: 商品售卖信息管理-添加商品售卖信息
* xiaoc
}
/**
* @Description: 商品售卖信息管理-根据商品id,会员id查询商品售卖信息
* xiaoc
*/
@RequestMapping("/query")
@ResponseBody
public Map<String,Object> query(Integer goodsid,Integer memberid, int pageSize, int pageNumber){
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("goodsid",goodsid);
map1.put("memberid",memberid);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return goodInfoDaoImpl.query(map1);
}
/**
* @Description: 商品售卖信息管理-根据商品id,会员id删除信息
* xiaoc
*/
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long id,Integer goodsid,Integer memberid,int pageSize, int pageNumber){
goodInfoDao.deleteById(id);
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("goodsid",goodsid);
map1.put("memberid",memberid);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return goodInfoDaoImpl.query(map1);
}
/**
* @Description: 商品售卖信息管理-根据商品id,会员id批量删除信息
* xiaoc
*/
@RequestMapping("/dellist")
*/
@RequestMapping("/cha")
@ResponseBody
public Optional<GoodInfo> one(long goodsId){
return goodInfoDao.findById(goodsId);
}
/**
* @Description: 商品售卖信息管理-根据商品id查询商品信息
* xiaoc
*/
@RequestMapping("/chagoods")
@ResponseBody
public Optional<Goods> oneg(long goodsId){
return goodsDao.findById(goodsId);
}
/**
* @Description: 商品售卖信息管理-根据会员id查询会员信息
* xiaoc
*/
@RequestMapping("/chamember")
@ResponseBody
public Optional<Member> onem(long memberId){
return menberDao.findById(memberId);
}
/**
* @Description: 商品售卖信息管理-修改商品售卖信息
* xiaoc
*/
@RequestMapping("/upd")
@ResponseBody
public void upd(GoodInfo goodInfo){
goodInfoDao.save(goodInfo);
}
/**
* @Description: 商品售卖信息管理-修改会员信息
* xiaoc
*/
@RequestMapping("/updmember")
member.setMemberxufei(date);
menberDao.save(member);
return query(0,null,5,1);
}
}
/**
* @Description: 会员充值管理Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/cz")
public class chongzhiController {
}
}
/**
* @Description: 器材管理Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/qc")
public class EquipmentController {
@Autowired
private EquipmentDaoImpl equipmentDao;
/**
* @Description: 器材管理-进入器材信息界面
* xiaoc
*/
@RequestMapping("/yemian")
public String yemian(){
return "WEB-INF/jsp/CEquipment";
}
/**
* @Description: 器材管理-根据器材名称分页查询
* xiaoc
*/
@RequestMapping("/query")
@ResponseBody
public Map<String,Object> query(String hyname, int pageSize, int pageNumber){
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("hyname",hyname);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return equipmentDao.query(map1);
* xiaoc
*/
@RequestMapping("/query")
@ResponseBody
public Map<String,Object> query(String hyname, int pageSize, int pageNumber){
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("hyname",hyname);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return equipmentDao.query(map1);
}
/**
* @Description: 器材管理-添加器材
* xiaoc
*/
@RequestMapping("/insert")
@ResponseBody
public Map<String,Object> insert(Equipment equipment){
equipmentDao.insert(equipment);
return query("",5,1);
}
/**
* @Description: 器材管理-根据器材id删除
* xiaoc
*/
@RequestMapping("/delete")
@ResponseBody
public Map<String,Object> del(int eqId){
equipmentDao.del(eqId);
return query("",5,1);
}
}
*/
@RequestMapping("/upd")
@ResponseBody
public void upd(PrivateCoachInfo privateCoachInfo){
privateCoachInfoDaoImpl.update(privateCoachInfo);
}
/**
* @Description: 会员私教详情-根据会员id查询所有会员私教信息的数量
* xiaoc
*/
@RequestMapping("/count")
@ResponseBody
public Long count (Integer memid){
privateCoachInfoDaoImpl.count(memid);
return privateCoachInfoDaoImpl.count(memid);
}
/**
* @Description: 会员私教详情-根据会员id在会员私教信息表中查询信息
* xiaoc
*/
@RequestMapping("/byid")
@ResponseBody
public List<PrivateCoachInfo> queryid(Long memberid){
return privateCoachInfoDaoImpl.ByMemberid(memberid);
}
}
* xiaoc
*/
@RequestMapping("/update")
@ResponseBody
public void update(Goods goods){
goodsDao.save(goods);
}
/**
* @Description: 商品管理-查询所有商品信息
* xiaoc
*/
@RequestMapping("/topcoach")
@ResponseBody
public Map<String,Object> topcoach(){
Map<String,Object> map = new HashMap<String,Object>();
map.put("goods",goodsDao.findAll());
return map ;
}
}
return query("",5,1);
}
/**
* @Description: 器材管理-根据器材id删除
* xiaoc
*/
@RequestMapping("/delete")
@ResponseBody
public Map<String,Object> del(int eqId){
equipmentDao.del(eqId);
return query("",5,1);
}
}
/**
* @Description: 会员卡类型Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/ktype")
public class MembertypeController {
@Autowired
private MembertypeDaoImpl membertypeDaoImpl;
/**
* @Description: 会员卡类型-进入jsp页面
* xiaoc
*/
@RequestMapping("/jin5")
public String jin5(){
return "WEB-INF/jsp/Membertype";
}
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long id,Integer coachid,Integer subjectid, Integer memberid, int pageSize, int pageNumber){
privateCoachInfoDao.deleteById(id);
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("coachid",coachid);
map1.put("subjectid",subjectid);
map1.put("memberid",memberid);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return privateCoachInfoDaoImpl.query(map1);
}
/**
* @Description: 会员私教详情-修改会员私教信息
* xiaoc
*/
@RequestMapping("/upd")
@ResponseBody
public void upd(PrivateCoachInfo privateCoachInfo){
privateCoachInfoDaoImpl.update(privateCoachInfo);
}
/**
* @Description: 会员私教详情-根据会员id查询所有会员私教信息的数量
* xiaoc
*/
@RequestMapping("/count")
@ResponseBody
public Long count (Integer memid){
privateCoachInfoDaoImpl.count(memid);
return privateCoachInfoDaoImpl.count(memid);
}
/**
* @Description: 会员私教详情-根据会员id在会员私教信息表中查询信息
* xiaoc
*/
@RequestMapping("/byid")
@ResponseBody
public List<PrivateCoachInfo> queryid(Long memberid){
return privateCoachInfoDaoImpl.ByMemberid(memberid);
coachDao.save(coach);
}
/**
* @Description: 教练管理-根据教练id查询
* xiaoc
*/
@RequestMapping("/cha")
@ResponseBody
public Optional<Coach> one(long id){
return coachDao.findById(id);
}
/**
* @Description: 教练管理-修改教练信息
* xiaoc
*/
@RequestMapping("/upd")
@ResponseBody
public void upd(Coach coach){
coachDao.save(coach);
}
}
/**
* @Description: 会员私教课程Controller控制层
* xiaoc
model.addAttribute("msg","新密码最少为8位并为字母+数字+特殊字符");
return "WEB-INF/jsp/updPassword";
}
if(!newPassword.equals(newPasswordAgain)){
model.addAttribute("msg","两次输入新密码不一致,请重新输入");
return "WEB-INF/jsp/updPassword";
}
Adminuser adminuser=(Adminuser) httpSession.getAttribute("user");
if(null != adminuser){
if(!adminuser.getAdminPassword().equals(/*DigestUtils.md5Hex*/(oldPassword))){
model.addAttribute("msg","原密码不正确,请重新输入");
return "WEB-INF/jsp/updPassword";
}
adminuserDao.updPassword(adminuser.getAdminId(), /*DigestUtils.md5Hex*/(newPassword));
}
Subject subject = SecurityUtils.getSubject();
subject.logout();
return "redirect:/login.jsp";
}
}
/**
* @Description: 课程管理Controller控制层
* xiaoc
/**
* @Description: 退出登录后清楚session
* xiaoc
*/
@RequestMapping("/logout")
public String logout(){
Subject subject = SecurityUtils.getSubject();
subject.logout();
return "redirect:/login";
}
/**
* @Description: 跳转到修改密码界面
* xiaoc
*/
@RequestMapping("/updPassword")
public String updPassword(){
return "WEB-INF/jsp/updPassword";
}
/**
* @Description: 修改密码
* xiaoc
*/
@RequestMapping("/upd/updPassword")
public String updPasswordConfirm(String oldPassword,String newPassword,String newPasswordAgain,HttpSession httpSession,Model model){
Pattern p = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)(?=.*[$@$!.%*#?&])[A-Za-z\\d$@$!.%*#?&]{8,}$");
Matcher m = p.matcher(newPassword);
if(!m.matches()){
model.addAttribute("msg","新密码最少为8位并为字母+数字+特殊字符");
return "WEB-INF/jsp/updPassword";
}
if(!newPassword.equals(newPasswordAgain)){
model.addAttribute("msg","两次输入新密码不一致,请重新输入");
return "WEB-INF/jsp/updPassword";
}
Adminuser adminuser=(Adminuser) httpSession.getAttribute("user");
if(null != adminuser){
if(!adminuser.getAdminPassword().equals(/*DigestUtils.md5Hex*/(oldPassword))){
model.addAttribute("msg","原密码不正确,请重新输入");
return "WEB-INF/jsp/updPassword";
}
adminuserDao.updPassword(adminuser.getAdminId(), /*DigestUtils.md5Hex*/(newPassword));
}
Subject subject = SecurityUtils.getSubject();
subject.logout();
Optional<Loos> loos =loosDao.findById(loosId);
return loos;
}
}
/**
* @Description: 会员卡类型信息Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/metype")
public class MetypeController {
@Autowired
private MembertypeDaoImpl membertypeDaoImpl;
@Autowired
private MemberttypeDao memberttypeDao;
/**
* @Description: 会员卡类型-删除
* xiaoc
*/
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long typeId,String typeName, int pageSize, int pageNumber){
memberttypeDao.deleteById(typeId);
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("typeName",typeName);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return membertypeDaoImpl.query(map1);
}
/**
/**
* @Description: 会员私教课程-根据课程id查询课程信息
* xiaoc
*/
@RequestMapping("/cha")
@ResponseBody
public Optional<Subject> one(long id){
return subjectDao.findById(id);
}
/**
* @Description: 会员私教课程-根据会员id查询会员信息
* xiaoc
*/
@RequestMapping("/cha2")
@ResponseBody
public Optional<Member> two(long id){
return menberDao.findById(id);
}
}
/**
* @Description: 遗失物品管理Controller控制层
* xiaoc
*/
@Controller
@RequestMapping("/loos")
public class LoosController {
@Autowired
private LoosDaoImpl loosDaoImpl;
@Autowired
private LoosDao loosDao;
private GoodInfoDao goodInfoDao;
@Autowired
private GoodsDaoImpl goodsDaoImpl;
/**
* @Description: 商品管理-进入商品列表界面
* xiaoc
*/
@RequestMapping("/sp")
public String sp(){
return "WEB-INF/jsp/Goods";
}
/**
* @Description: 商品管理-根据商品名称分页查询
* xiaoc
*/
@RequestMapping("/query")
@ResponseBody
public Map<String,Object> query(String goodsname, int pageSize, int pageNumber){
Map<String,Object> map1=new HashMap<String,Object>();
map1.put("goodsname",goodsname);
map1.put("qi",(pageNumber-1)*pageSize);
map1.put("shi",pageSize);
return goodsDaoImpl.query(map1);
}
/**
* @Description: 商品管理-查询所有商品信息
* xiaoc
*/
@RequestMapping("/query2")
@ResponseBody
public List<Goods> query2(){
List list = goodsDao.findAll();
return list;
}
/**
* @Description: 商品管理-根据商品id删除商品信息
* xiaoc
*/
@RequestMapping("/del")
@ResponseBody
public Map<String,Object> del(long goodsId,String goodsname, int pageSize, int pageNumber){
//先根据商品id在商品信息表里查询是否有其信息
List<GoodInfo> goodInfoList = goodInfoDao.queryByGoodsIdNative(goodsId);
if(goodInfoList !=null && goodInfoList.size() > 0){