Java项目:161SpringBoot Vue的药房管理系统

本文详细介绍了基于SpringBoot和Vue的药房管理系统,包括管理员、用户和服务人员的功能操作,如登录、注册、药品信息查询等,以及所需的技术环境和使用方法。
摘要由CSDN通过智能技术生成
 作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

基于SpringBoot Vue的药房管理系统

角色:管理员、用户、服务人员

在系统首页可以查看首页,药品信息,疫情常识,保健品,系统公告,个人中心,购物车等内容进行详细操作

管理员:管理员登录系统后,可以对首页,个人中心,用户管理,保健品分类管理,药品分类管理,药品信息管理,疫情常识管理,保健品管理,系统管理,订单管理等进行相应的操作管理

用户:用户进入系统后能对首页,药品信息,疫情常识,保健品,系统公告,个人中心,购物车等功能进行操作

使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
4.数据库:MySql 5.7/8.0版本均可;

5.是否Maven项目:是;

技术栈

后端: SpringBoot+Mybaits

前端:Vue +ElementUI +Layui +HTML+CSS+JS

使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

运行截图

论文

前台界面

后管界面

相关代码

UserController

package com.jx.medical.controller;

import com.jx.medical.pojo.AjaxInfo;
import com.jx.medical.pojo.Buyer;
import com.jx.medical.pojo.User;
import com.jx.medical.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author jx
 * @date Created on 2020/12/3  15:53
 **/

@RestController
@RequestMapping("/user")
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    public AjaxInfo login(@RequestBody User user, HttpSession session) {

        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(session.getId());
        User user1 = userService.findUser(user);
        if (user1 != null) {
            ajaxInfo.setCode(user1.getUserRight());
            ajaxInfo.setMsg("登陆成功!");
            ajaxInfo.setData(user1.getUserName());
            session.setAttribute("userName", user1.getUserName());
            System.out.println(session.getAttribute("userName"));
        } else {
            ajaxInfo.setCode(-1);
            ajaxInfo.setMsg("账号或密码错误!");
        }
        return ajaxInfo;
    }

    @RequestMapping("/logout")
    public String login(HttpSession session) {

        System.out.println(session.getId());
        System.out.println(session.getAttribute("userName"));
        session.removeAttribute("userName");
        return "success";
    }

    @RequestMapping("/registUser")
    public AjaxInfo regist(@RequestBody User user, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();

        User userByAcc = userService.getUserByAcc(user.getUserAcc());
        if (session.getAttribute("userName") != null) {
            if (userByAcc == null) {
                userService.registUser(user);
                ajaxInfo.setMsg("注册成功!");
            } else {
                ajaxInfo.setMsg("账号已存在!请重新输入~");
            }
            return ajaxInfo;
        } else {
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/queryUser")
    public AjaxInfo queryUser(@RequestBody User user, HttpSession session) {
        System.out.println(user);
        AjaxInfo ajaxInfo = new AjaxInfo();

        if (session.getAttribute("userName") != null) {
            User userByAcc = userService.getUserByAcc(user.getUserAcc());
            if (userByAcc == null||userByAcc.getUserRight()!=2) {
                ajaxInfo.setMsg("该取药员不存在,请重新输入!");
                ajaxInfo.setCode(-1);
            } else {
                ajaxInfo.setMsg("查询成功!");
                ajaxInfo.setCode(0);
                ajaxInfo.setData(userByAcc);
            }
            return ajaxInfo;
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/deleteUser")
    public AjaxInfo deleteUser(@RequestBody User user, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();

        if (session.getAttribute("userName") != null) {
            userService.deleteUser(user.getUserAcc());
            ajaxInfo.setMsg("删除成功!");
        } else {
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/registBuyer")
    public AjaxInfo registBuyer(@RequestBody Buyer buyer, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println("======"+buyer);
        Buyer buyerByUserId = userService.getBuyerById(buyer.getBuyerId());
        if (session.getAttribute("userName") != null) {
            if (buyerByUserId == null) {
                userService.registBuyer(buyer);
                ajaxInfo.setMsg("注册成功!");
            } else {
                ajaxInfo.setMsg("ID已存在!");
            }
            return ajaxInfo;
        } else {
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/queryBuyer")
    public AjaxInfo queryBuyer(@RequestBody Buyer buyer, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(buyer);

        if (session.getAttribute("userName") != null) {
            Buyer buyer1 = userService.getBuyerById(buyer.getBuyerId());
            if (buyer1 == null) {
                ajaxInfo.setMsg("该采购员不存在,请重新输入!");
                ajaxInfo.setCode(-1);
            } else {
                ajaxInfo.setMsg("查询成功!");
                ajaxInfo.setData(buyer1);
                ajaxInfo.setCode(0);
            }

        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        System.out.println("================="+ajaxInfo.getCode());
        return ajaxInfo;
    }

    @RequestMapping("/deleteBuyer")
    public AjaxInfo deleteBuyer(@RequestBody Buyer buyer, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            userService.deleteBuyer(buyer.getBuyerId());
            ajaxInfo.setMsg("删除成功!");
        } else {
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/updateBuyer")
    public AjaxInfo updateBuyer(@RequestBody Buyer buyer, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            userService.updateBuyer(buyer);
            ajaxInfo.setMsg("更新成功!");
        } else {
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

}

QueryController

package com.jx.medical.controller;

import com.jx.medical.pojo.*;
import com.jx.medical.service.QueryService;
import com.jx.medical.vo.MedicineTable;
import com.jx.medical.vo.ShowInRecord;
import com.jx.medical.vo.ShowOutRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author jx
 * @date Created on 2020/12/4  10:29
 **/
@RestController
@CrossOrigin
@RequestMapping("/query")
public class QueryController {

    @Autowired
    private QueryService queryService;

    @RequestMapping("/queryMedicine")
    public AjaxInfo queryMedicine(HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            List<Medicine> medicines = queryService.queryMedicine();
            ajaxInfo.setCode(0);
            ajaxInfo.setMsg("查询成功");
            ajaxInfo.setData(medicines);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/queryFactory")
    public AjaxInfo queryFactory(HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            List<Factory> factories = queryService.queryFactory();
            ajaxInfo.setCode(0);
            ajaxInfo.setData(factories);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/queryBuyer")
    public AjaxInfo queryBuyer1(HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            List<Buyer> buyers = queryService.queryBuyer();
            ajaxInfo.setCode(0);
            ajaxInfo.setData(buyers);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/showInRecord")
    public AjaxInfo showInRecord(MedicineTable medicineTable,HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<ShowInRecord> inRecord = queryService.getInRecord(medicineTable);
            ajaxInfo.setCount(queryService.getInRecordCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(inRecord);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

    @RequestMapping("/showOutRecord")
    public AjaxInfo queryBuyer(MedicineTable medicineTable,HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<ShowOutRecord> outRecord = queryService.getOutRecord(medicineTable);
            ajaxInfo.setCount(queryService.getOutRecordCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(outRecord);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }
    @RequestMapping("/queryMedicineByName")
    public AjaxInfo queryMedicineByName(MedicineTable medicineTable, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(medicineTable);
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<Medicine> medicines = queryService.queryMedicineByName(medicineTable);
            ajaxInfo.setMsg("查询成功");
            ajaxInfo.setCount(queryService.queryMedicineByNameCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(medicines);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }
    @RequestMapping("/queryFactoryByName")
    public AjaxInfo queryFactoryByName(MedicineTable medicineTable, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(medicineTable);
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<Factory> factories = queryService.queryFactoryByName(medicineTable);
            ajaxInfo.setMsg("查询成功");
            ajaxInfo.setCount(queryService.queryFactoryByNameCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(factories);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }
    @RequestMapping("/queryBuyerByName")
    public AjaxInfo queryBuyerByName(MedicineTable medicineTable, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(medicineTable);
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<Buyer> buyers = queryService.queryBuyerByName(medicineTable);
            ajaxInfo.setMsg("查询成功");
            ajaxInfo.setCount(queryService.queryBuyerByNameCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(buyers);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }
    @RequestMapping("/queryUserByName")
    public AjaxInfo queryUserByName(MedicineTable medicineTable, HttpSession session) {
        AjaxInfo ajaxInfo = new AjaxInfo();
        System.out.println(medicineTable);
        if (session.getAttribute("userName") != null) {
            int page=(medicineTable.getPage()-1)*medicineTable.getLimit();
            medicineTable.setPage(page);
            List<User> users = queryService.queryUserByName(medicineTable);
            ajaxInfo.setMsg("查询成功");
            ajaxInfo.setCount(queryService.queryUserByNameCount(medicineTable));
            ajaxInfo.setCode(0);
            ajaxInfo.setData(users);
        } else {
            ajaxInfo.setCode(-2);
            ajaxInfo.setMsg("权限不足!请先登录~");
        }
        return ajaxInfo;
    }

}

如果也想学习本系统,下面领取。关注并回复:161springboot

  • 29
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜未央5788

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

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

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

打赏作者

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

抵扣说明:

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

余额充值