栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

基于springboot养老院管理系统源码

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于springboot养老院管理系统源码

基于springboot的养老院管理系统326,本系统为后台管理系统,分为三个角色,分别是超级管理员、管理员、用户。

超级管理员、管理员的功能如下:
登录、修改密码、账号管理、健康档案管理、病例管理、药品管理、每月餐饮管理、外出报备、入住登记、寝室分配、事故记录、访客记录、收费管理; 其中超级管理员可进行管理员账号管理;

用户的功能如下:
登录、修改密码、个人信息、家人情况、每月餐饮管理、外出报备、查看收费标准

开发工具:idea (eclipse) 环境:jdk1.8  mysql5.7

后端:springboot+Mybatis

2.前端:HTML+thymeleaf+Javascript+css

 

package com.module.controller;

import com.github.pagehelper.Page;
import com.module.mapper.SorttypeMapper;
import com.module.pojo.Sorttype;
import com.module.util.ResultUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Controller
public class SorttypeController {
    @Autowired
    SorttypeMapper sorttypeMapper;


    
    @RequestMapping("manage/sorttypeList")
    public String sorttypeList() {
        return "manage/sorttype/sorttypeList";
    }

    
    @RequestMapping("manage/addSorttype")
    public String addSorttype(Model model) {
        return "manage/sorttype/saveSorttype";
    }

    
    @RequestMapping("manage/editSorttype")
    public String editSorttype(Integer id, Model model) {
        Sorttype sorttype = sorttypeMapper.selectSorttypeById(id);
        model.addAttribute("sorttype", sorttype);
        return "manage/sorttype/saveSorttype";
    }

    
    @RequestMapping("manage/sorttypeInfo")
    public String sorttypeInfo(Integer id, Model model) {
        Sorttype sorttype = sorttypeMapper.selectSorttypeById(id);
        model.addAttribute("sorttype", sorttype);
        return "manage/sorttype/sorttypeInfo";
    }


    
    @RequestMapping("manage/querySorttypeList")
    @ResponseBody
    public ResultUtil getCarouseList(Integer page, Integer limit, String keyword) {
        if (null == page) { //默认第一页
            page = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 10;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
        }
        Page pageHelper = PageHelper.startPage(page, limit, true);
        pageHelper.setOrderBy(" id desc ");
        List list = sorttypeMapper.selectAll(map);
        PageInfo pageInfo = new PageInfo(list);  //使用mybatis分页插件
        ResultUtil resultUtil = new ResultUtil();
        resultUtil.setCode(0);  //设置返回状态0为成功
        resultUtil.setCount(pageInfo.getTotal());  //获取总记录数目 类似count(*)
        resultUtil.setData(pageInfo.getList());    //获取当前查询出来的集合
        return resultUtil;
    }

    
    @RequestMapping("manage/saveSorttype")
    @ResponseBody
    public ResultUtil saveSorttype(Sorttype sorttype, HttpSession session) {
        Date nowTime = new Date();
        sorttype.setCreatetime(nowTime);
        try {
            sorttypeMapper.insertSorttype(sorttype);
            return ResultUtil.ok("添加分类成功");
        } catch (Exception e) {
            return ResultUtil.error("添加分类出错,稍后再试!");
        }
    }

    
    @RequestMapping("manage/updateSorttype")
    @ResponseBody
    public ResultUtil updateSorttype(Sorttype sorttype, HttpSession session) {
        Date nowTime = new Date();
        sorttype.setCreatetime(nowTime);
        try {
            sorttypeMapper.updateSorttype(sorttype);
            return ResultUtil.ok("修改分类成功");
        } catch (Exception e) {
            return ResultUtil.error("修改分类出错,稍后再试!");
        }
    }


    
    @RequestMapping("manage/deleteSorttype")
    @ResponseBody
    public ResultUtil deleteSorttypeById(Integer id) {
        try {
            sorttypeMapper.deleteSorttypeById(id);
            return ResultUtil.ok("删除分类成功");
        } catch (Exception e) {
            return ResultUtil.error("删除分类出错,稍后再试!");
        }
    }

    
    @RequestMapping("manage/deletesSorttype")
    @ResponseBody
    public ResultUtil deletesSorttype(String idsStr) {
        try {
            if (!StringUtils.isBlank(idsStr)) {
                String[] ids = idsStr.split(",");
                for (String id : ids) {
                    sorttypeMapper.deleteSorttypeById(Integer.parseInt(id));
                }
            }
            return ResultUtil.ok("批量删除分类成功");
        } catch (Exception e) {
            return ResultUtil.error("删除分类出错,稍后再试!");
        }
    }


}

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/632528.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号