Java项目:学生会管理系统(java+SpringBoot+Thymeleaf+html+layui+bootstrap+maven+mysql)

源码获取:博客首页 "资源" 里下载!

项目介绍

学生会管理系统.主要功能包括:

后台首页:最新活动展示、最新公告、学生会部门职能介绍;
财务管理:资金报销登记、赞助商管理;
物资管理:物资借还管理、全部物资;添加、编辑、删除;
日常事务管理:工作计划管理、活动管理、文件管理;
申请请假:添加、修改、删除、查看;

我的待办;

环境需要

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

1. 后端:SpringBoot

2. 前端:Thymeleaf+html+layui+jQuery+bootstrap

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中application.yml及activiti.cfg.xml配置文件中的数据库配置改为自己的配置;
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
4. 运行项目,输入localhost:8085 登录

 

 

 

 

 

后台用户管理控制器:

/**
 * 后台用户管理控制器
 */
@RequestMapping("/admin/user")
@Component
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private RoleService roleService;
    @Autowired
    private OperaterLogService operaterLogService;
    /**
     * 用户列表页面
     * @param model
     * @return
     */
    @RequestMapping("/list")
    public String list(Model model, User user, PageBean<User> pageBean){
        model.addAttribute("usernmae",user.getUsername());
        model.addAttribute("pageBean",userService.findList(user,pageBean));
        model.addAttribute("title","用户列表");
        return "admin/user/list";
    }


    /**
     * 用户添加页面
     * @param model
     * @param
     * @return
     */
    @RequestMapping(value = "/add",method = RequestMethod.GET)
    public String add(Model model){
        List<Role> all = roleService.findAll();
        model.addAttribute("roles",all);
        return "admin/user/add";
    }

    @ResponseBody
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Result<Boolean> add(Model model,User user){
        //用统一验证实体方法验证是否合法
        CodeMsg validate = ValidateEntityUtil.validate(user);
        if(validate.getCode()!=CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        //判断用户的角色是否选择
        if(user.getRole()==null ||user.getRole().getId()==null){
            return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY);
        }
        //没有ID 传个0进去 0不是Long类型 所以加个0l L
        if(userService.isExistUsername(user.getUsername(),0l)){
            return Result.error(CodeMsg.ADMIN_USER_NAME_EXIST);
        }
        //到这说明一切符合条件进行数据库新增
        if(userService.save(user)==null){
            return Result.error(CodeMsg.ADMIN_USER_ADD_ERROR);
        }
        operaterLogService.add("添加用户,用户名:"+user.getUsername());
        return Result.success(true);
    }

    /**
     * 用户编辑页面
     * @param model
     * @param id
     * @return
     */
    @RequestMapping(value = "/edit",method = RequestMethod.GET)
    public String edit(Model model,@RequestParam(name = "id",required = true) Long id){
        model.addAttribute("user",userService.find(id));
        model.addAttribute("roles",roleService.findAll());
        return "admin/user/edit";
    }

    /**
     * 编辑用户信息表单提交处理
     * @param user
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    public Result<Boolean> edit(User user){
        //用统一验证实体方法验证是否合法
        CodeMsg validate = ValidateEntityUtil.validate(user);
        if(validate.getCode()!=CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        //判断用户的角色是否选择
        if(user.getRole()==null ||user.getRole().getId()==null){
            return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY);
        }
        if(user.getId()==null||user.getId().longValue()<=0){
            return Result.error(CodeMsg.ADMIN_USER_NO_EXIST);
        }
        //判断数据库user表有没有这个用户名
        if(userService.isExistUsername(user.getUsername(),user.getId().longValue())){
                return Result.error(CodeMsg.ADMIN_USER_NAME_EXIST);
        }
        //将提交的用户信息指定字段复制到已存在的user对象中
        User findbyId = userService.find(user.getId());
        //把source原来的字段复制到目标对象当中ignoreProperties表示忽略哪些字段 该方法会覆盖新字段内容
        BeanUtils.copyProperties(user,findbyId,"id","createTime","updateTime");
        //到这说明一切通过 开始进行数据库编辑
        if(userService.save(findbyId)==null){
            return Result.error(CodeMsg.ADMIN_USER_EDIT_ERROR);
        }
        operaterLogService.add("编辑用户,用户名:"+user.getUsername());
        return Result.success(true);
    }

    @ResponseBody
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public Result<Boolean> delete(@RequestParam(name = "id",required = true) Long id) {
        try {
        userService.delete(id);
        } catch (Exception e){
            return Result.error(CodeMsg.ADMIN_USER_DELETE_ERROR);
        }
        operaterLogService.add("删除用户,id为:"+id);
        return  Result.success(true);
    }
}

后台角色管理控制器: 

/**
 * 后台角色管理控制器
 */
@RequestMapping("/admin/role")
@Controller
public class RoleController {

    @Autowired
    private MenuService menuService;
    private Logger log= LoggerFactory.getLogger(RoleController.class);
    @Autowired
    private OperaterLogService operaterLogService;
    @Autowired
    private RoleService roleService;

    /**
     * 分页搜索角色列表
     * @param model
     * @param role
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/list")
    public String list(Model model, Role role, PageBean<Role> pageBean){
        model.addAttribute("title","角色列表");
        model.addAttribute("name",role.getName());
        model.addAttribute("pageBean",roleService.findByName(role,pageBean));
        return "admin/role/list";
    }

    /**
     * 角色添加页面
     * @param model
     * @return
     */
    @RequestMapping(value = "/add",method = RequestMethod.GET)
    public String add(Model model){
        List<Menu> all = menuService.findAll();
        model.addAttribute("title","添加角色");
        model.addAttribute("topMenus", MenuUtil.getTopMenus(all));
        model.addAttribute("secondMenus", MenuUtil.getSecondMenus(all));
        model.addAttribute("thirdMenus", MenuUtil.getThirdMenus(all));
        return "admin/role/add";
    }
    /**
     * 角色添加表单提交处理
     * @param role
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Result<Boolean> add(Role role, HttpServletRequest request){
        CodeMsg validate = ValidateEntityUtil.validate(role);
        if(validate.getCode()!=CodeMsg.SUCCESS.getCode()){
            return  Result.error(validate);
        }
        if(roleService.save(role)==null){
            return  Result.error(CodeMsg.ADMIN_ROLE_ADD_ERROR);
        }
        log.info("添加角色["+role+"]");
        operaterLogService.add("添加角色["+role.getName()+"]");
        return Result.success(true);
    }


    /**
     * 角色编辑页面
     * @param id
     * @param model
     * @return
     */
    @RequestMapping(value = "/edit",method = RequestMethod.GET)
    public String edit(@RequestParam(name = "id",required = true) Long id, Model model){
        List<Menu> all = menuService.findAll();
        model.addAttribute("title","添加角色");
        model.addAttribute("topMenus", MenuUtil.getTopMenus(all));
        model.addAttribute("secondMenus", MenuUtil.getSecondMenus(all));
        model.addAttribute("thirdMenus", MenuUtil.getThirdMenus(all));
        Role role = roleService.find(id);
        model.addAttribute("role",role);
        //list转换为数组
        model.addAttribute("authorities", JSONArray.toJSON(role.getAuthorities()).toString());
        return "admin/role/edit";
    }


    /**
     * 角色修改表单提交处理
     * @param role
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    public Result<Boolean> edit(Role role, HttpServletRequest request){
        CodeMsg validate = ValidateEntityUtil.validate(role);
        if(validate.getCode()!=CodeMsg.SUCCESS.getCode()){
            return  Result.error(validate);
        }
        Role existRole = roleService.find(role.getId());
        if(existRole==null){
            return  Result.error(CodeMsg.ADMIN_ROLE_NO_EXIST);
        }
        existRole.setName(role.getName());
        existRole.setRemark(role.getRemark());
        existRole.setStatus(role.getStatus());
        existRole.setAuthorities(role.getAuthorities());
        if(roleService.save(existRole)==null){
            return  Result.error(CodeMsg.ADMIN_ROLE_EDIT_ERROR);
        }
        log.info("编辑角色["+role+"]");

        operaterLogService.add("编辑角色["+role.getName()+"]");
        return Result.success(true);
    }
    @ResponseBody
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public Result<Boolean> delete(@RequestParam(name = "id",required = true) Long id,HttpServletRequest request){
        try {
            roleService.delete(id);
        }catch (Exception e){
            return Result.error(CodeMsg.ADMIN_ROLE_DELETE_ERROR);
        }
        log.info("删除角色ID["+id+"]");
        operaterLogService.add("删除角色ID["+id+"]");
        return Result.success(true);
    }

}

后台学生管理:

/**
 * 后台学生管理
 */

@RequestMapping("/admin/student/")
@Controller
public class StudentController {
    @Autowired
    private StudentService studentService ;

    @Autowired
    private OperaterLogService operaterLogService;

    /**
     * 学生管理列表
     * @param model
     * @return
     */
    @RequestMapping("/list")
    public String list(Model model, Student student, PageBean<Student> pageBean){
        model.addAttribute("pageBean",studentService.findList(student, pageBean));
        model.addAttribute("studentLoginName",student.getLoginName());
        model.addAttribute("title","学生列表");
        return "/admin/student/list";
    }

    /**
     * 后台学生添加页面
     */
    @RequestMapping(value = "/add",method = RequestMethod.GET)
    public String add(){
        return "/admin/student/add";
    }

    /**
     * 后台学生添加信息操作
     */
    @ResponseBody
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Result<Boolean> add(Model model,Student student){
        CodeMsg validate = ValidateEntityUtil.validate(student);
        if (validate.getCode() != CodeMsg.SUCCESS.getCode()) {
            return Result.error(validate);
        }
        if(studentService.findByLoginName(student.getLoginName())!=null){
            return Result.error(CodeMsg.ADMIN_STUDENT_ISEXIST_ERROR);
        }
        if(studentService.save(student)==null){
            return Result.error(CodeMsg.ADMIN_STUDENT_ADD_ERROR);
        }
        return Result.success(true);
    }

    /**
     * 编辑学生页面
     * @param model
     * @param id
     * @return
     */
    @RequestMapping(value = "/edit",method = RequestMethod.GET)
    public String edit(Model model, @RequestParam("id")Long id){
        if(studentService.findById(id)!=null){
            model.addAttribute("student",studentService.findById(id));
        }
        return "/admin/student/edit";
    }


    /**
     * 编辑后台学生信息
     * @param student
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public Result<Boolean> edit(Student student, HttpServletRequest request) {
        //用统一验证实体方法验证是否合法
        CodeMsg validate = ValidateEntityUtil.validate(student);
        if (validate.getCode() != CodeMsg.SUCCESS.getCode()) {
            return Result.error(validate);
        }
      //将提交的学生信息指定字段复制到已存在的student对象中
        Student findbyId = studentService.findById(student.getId());
        //把source原来的字段复制到目标对象当中ignoreProperties表示忽略哪些字段 该方法会覆盖新字段内容
        BeanUtils.copyProperties(student, findbyId, "id", "createTime", "updateTime");
        //到这说明一切通过 开始进行数据库编辑
        if (studentService.save(findbyId) == null) {
            return Result.error(CodeMsg.ADMIN_STUDENT_EDIT_ERROR);
        }
        operaterLogService.add("编辑学生,学生姓名:" + student.getStuName());
        return Result.success(true);
    }


    /**
     * 学生删除操作
     * @param ids
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Result<Boolean> delete(@RequestParam(name = "ids", required = true) String ids) {
        if (!StringUtils.isEmpty(ids)) {
            String[] splitIds = ids.split(",");
            for (String id : splitIds) {
                Student student = studentService.findById(Long.valueOf(id));
                if (student != null) {
                    try {
                        studentService.delete(Long.valueOf(id));
                        operaterLogService.add("删除学生,id为:" + id);
                    }catch (Exception e){
                        return Result.error(CodeMsg.ADMIN_STUDENT_DELETE_ERROR);
                    }
                }

            }

        }
        return Result.success(true);
    }

}

 源码获取:博客首页 "资源" 里下载!

  • 8
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
课程介绍 仓库管理系统主要功能有采购入库,采购退货,销售出库,销售退货,仓库盘点,库存报表,Excel导入导出,按钮级权限控制及系统日志等功能,系统采用SpringBoot ,mybatis,easyui,ajax,mssql数据库等技术开发。提供所有源代码下载,系统功能完善,可直接运行。开发环境项目开发语言:SpringBoot ,mybatis,easyui,ajax,mssql数据库项目运行环境:jdk1.8及以上版本,tomcat8.0及以上版本,sql server2005及以上版本项目开发工具: 本项目开发工具是Intellij Idea课程目标掌握SpringBoot等技术,熟悉仓库管理系统主要功能,采购入库,采购退货,销售出库,销售退货,仓库盘点,系统报表,权限控制及日志等50多门JAVA系列全套课程,包括大一新生到大四毕业的所有JAVA系列技术专业课程,项目实战,商业项目等;基础课程:JAVA初级工程师: 1、计算机基础 2、HTML语言基础 3、C语言从入门到精通+贪吃蛇游戏 4、贪吃蛇游戏 5、SQL SERVER数据库基础 6、JAVA从入门到精通+推箱子游戏+QQ即时通讯软件 7、推箱子游戏; 8、仿QQ即时通讯软件;JAVA中级工程师: 9、SQLSERVER数据库高级 10、SQLSERVER从入门到精通(基础+高级) 11、JavaScript从入门到精通, 12、JSP从入门到精通+点餐系统, 13、JSP从入门到精通+在线视频学习教育平台, 14、JSP从入门到精通+大型电商平台; 15、XML从入门到精通, 16、数据结构(JAVA版),JAVA高级工程师: 17、Oracle数据库从入门到精通, 18、ajax+jquery从入门到精通, 19、EasyUI从入门到精通,SSH框架: 20、Struts2从入门到精通课程, 21、Hibernate从入门到精通课程, 22、Spring从入门到精通课程; 23、Echarts从入门到精通, 24、Excel基于POI的导入导出工作流框架: 25、Activiti流程框架从入门到精通 26、JBPM流程框架从入门到精通SSM框架: 27、MyBatis从入门到精通 28、Spring MVC从入门到精通 29、Spring Boot入门到精通 30、Spring Cloud入门到精通面试题: 31、职业生涯规划及面试题集锦商业项目: 32、微信公众号在线支付系统 33、微信生活缴费在线支付系统 34、支付宝生活缴费在线支付系统 35、在线考试系统 36、人脸识别智能考试系统(人工智能AI) 37、仓库管理及质量追溯系统 38、房屋出租管理系统APP(身份证识别) 39、手机订餐管理系统, 40、CRM客户关系管理系统 41、大型房地产CRM销售管理系统 42、CMPP2,CMPP3移动网关系统 43、仓库管理系统SpringBoot) 44、影院在线售票系统(仿猫眼电影)人工智能: 45、人脸识别在线考试系统 46、人脸识别系统项目实战 47、车牌识别停车场管理系统 48、身份证识别系统项目实战 49、营业执照识别系统项目实战 50、名片识别管理系统

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值