基于javaweb的药品进货销售管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的药品进货销售管理系统(java+ssm+html+js+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的药品进货销售管理系统(java+SSM+HTML+JS+JSP+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.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
用户管理控制器:
/**
- Descriiption: 用户控制器
*/
@Controller
@RequestMapping(value = “user/user”, method = {RequestMethod.POST})
public class UserController {
@Autowired
UserService userService;
/**
登录Controller
@param request HttpServletRequest 对象
@param username 用户名
@param password 密码
@return Map 返回相关状态
@throws Exception 异常
*/
@RequestMapping(value = “login”)
public @ResponseBody
Map<String, String> login(HttpServletRequest request, @RequestParam(value = “username”, defaultValue = “”) String username,
@RequestParam(value = “password”, defaultValue = “”) String password) throws Exception {
System.out.println("username: " + username + ", password: " + password);
User user = userService.loginCheck(username, password);
Map<String, String> resultMap =new HashMap<String, String>();
if (user != null) {
request.getSession().setAttribute(“userid”, user.getUid());
request.getSession().setAttribute(“username”, user.getUsername());
request.getSession().setAttribute(“identity”, “user”);
resultMap.put(“state”, “success”);
} else {
resultMap.put(“state”, “fail”);
resultMap.put(“reason”, ErrorInfoUtil.getErrorInfo(“user.login.check.null”));
return resultMap;
/**
获取指定用户ID的用户信息
@param userIds 用户ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getSomeUser”)
public @ResponseBody
Map<String, Object> getSomeUser(@RequestParam(value = “userIds[]”) String[] userIds) throws Exception {
List users = userService.getSomeUser(userIds);
Map<String, Object> result = new HashMap<String, Object>();
if (users.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, users);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
获取用户总量
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getUserCount”)
public @ResponseBody
Map<String, Object> getUserCount() throws Exception {
int count = userService.count();
Map<String, Object> result = new HashMap<String, Object>();
if (count > 0) {
result.put(“state”, “success”);
result.put(“result”, count);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
获取指定数量的用户信息
@param offset 偏移量
@param limit 限制返回条数
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getLimitUser”)
public @ResponseBody
Map<String, Object> getLimitUser(@RequestParam(value = “offset”) int offset,
@RequestParam(value = “limit”) int limit) throws Exception {
List userList = userService.getLimitUser(offset, limit);
Map<String, Object> result = new HashMap<String, Object>();
if (userList.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, userList);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
根据用户ID更新用户信息
@param user 新的用户信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “updateUserById”)
public @ResponseBody
Map<String, Object> updateUserById(@RequestBody User user) throws Exception {
int updateCount = userService.updateById(user);
Map<String, Object> result = new HashMap<String, Object>();
if (updateCount > 0) {
result.put(“state”, “success”);
result.put(“result”, updateCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
根据用户ID数组删除一些用户信息
@param userIds 用户ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “deleteSomeUser”)
public @ResponseBody
Map<String, Object> deleteSomeUser(@RequestParam(value = “userIds[]”) String[] userIds) throws Exception {
int deleteNum = userService.deleteSomeUser(userIds);
Map<String, Object> result = new HashMap<String, Object>();
if (deleteNum > 0) {
result.put(“state”, “success”);
result.put(“result”, deleteNum);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
添加用户
@param user 用户信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = {“addUser”, “registerUser”})
public @ResponseBody
Map<String, Object> addUser(@RequestBody User user) throws Exception {
int addCount = userService.addUser(user);
Map<String, Object> result = new HashMap<String, Object>();
if (addCount > 0) {
result.put(“state”, “success”);
result.put(“result”, addCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
根据用户ID更新用户密码
@param uid 用户ID
@param originalPasswd 原密码
@param newPasswd 新密码
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “updateUserPasswdById”)
public @ResponseBody
Map<String, Object> updateUserPasswdById(@RequestParam(value = “uid”, defaultValue = “”) String uid,
@RequestParam(value = “originalPasswd”, defaultValue = “”) String originalPasswd,
@RequestParam(value = “newPasswd”, defaultValue = “”) String newPasswd) throws Exception {
int updateCount = userService.updatePasswdById(uid, originalPasswd, newPasswd);
Map<String, Object> result = new HashMap<String, Object>();
if (updateCount > 0) {
result.put(“state”, “success”);
result.put(“result”, updateCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
获取当前登录用户
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getCurrentUser”)
public @ResponseBody
Map<String, Object> getCurrentUser(HttpServletRequest request) throws Exception {
String userId = (String) request.getSession().getAttribute(“userid”);
User user = null;
if (userId != null && !“”.equals(userId)) {
user = userService.getUserById(userId);
Map<String, Object> result = new HashMap<String, Object>();
if (user != null) {
result.put(“state”, “success”);
result.put(“result”, user);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
药品管理控制器:
/**
- Descriiption: 药品控制器
*/
@Controller
@RequestMapping(value = “medicine/medicine”, method = {RequestMethod.POST})
public class MedicineController {
@Autowired
MedicineService medicineService;
/**
获取指定数量的药品信息
@param offset 偏移量
@param limit 返回限制条数
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getFilteredLimitMedicine”)
public @ResponseBody
Map<String, Object> getFilteredLimitMedicine(@RequestParam(value = “medTypeId”, defaultValue = “”) String medTypeId,
@RequestParam(value = “offset”) int offset,
@RequestParam(value = “limit”) int limit) throws Exception {
medTypeId = “”.equals(medTypeId) ? null : medTypeId;
List medicines = medicineService.getFilteredLimitMedicine(medTypeId, offset, limit);
Map<String, Object> result = new HashMap<String, Object>();
if (medicines.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, medicines);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
获取指定ID的药品信息
@param medicineIds String[] 药品ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getSomeMedicine”)
public @ResponseBody
Map<String, Object> getSomeMedicine(@RequestParam(value = “medicineIds[]”) String[] medicineIds) throws Exception {
List medicines = medicineService.getSomeMedicine(medicineIds);
Map<String, Object> result = new HashMap<String, Object>();
if (medicines.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, medicines);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
获取药品总量
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getMedicineCount”)
public @ResponseBody
Map<String, Object> getMedicineCount() throws Exception {
int count = medicineService.count();
Map<String, Object> result = new HashMap<String, Object>();
if (count > 0) {
result.put(“state”, “success”);
result.put(“result”, count);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
根据药品ID更新药品信息
@param medicine 新的药品信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “updateMedicineById”)
public @ResponseBody
Map<String, Object> updateMedicineById(@RequestBody Medicine medicine) throws Exception {
int updateCount = medicineService.updateById(medicine);
Map<String, Object> result = new HashMap<String, Object>();
if (updateCount > 0) {
result.put(“state”, “success”);
result.put(“result”, updateCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
根据药品ID数组删除一些药品信息
@param medicineIds 药品ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “deleteSomeMedicine”)
public @ResponseBody
Map<String, Object> deleteSomeMedicine(@RequestParam(value = “medicineIds[]”) String[] medicineIds) throws Exception {
int deleteNum = medicineService.deleteSomeMedicine(medicineIds);
Map<String, Object> result = new HashMap<String, Object>();
if (deleteNum > 0) {
result.put(“state”, “success”);
result.put(“result”, deleteNum);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
添加药品
@param medicine 药品信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “addMedicine”)
public @ResponseBody
Map<String, Object> addMedicine(@RequestBody Medicine medicine) throws Exception {
int addCount = medicineService.addMedicine(medicine);
Map<String, Object> result = new HashMap<String, Object>();
if (addCount > 0) {
result.put(“state”, “success”);
result.put(“result”, addCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
药品图片上传
@param medicinePic 药品图片
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “addMedicinePic”)
public @ResponseBody
Map<String, Object> addMedicinePic(HttpServletRequest request,
@RequestParam(“medicinePic”) MultipartFile medicinePic) throws Exception {
Map<String, Object> result = new HashMap<String, Object>();
String imgPath = medicineService.uploadFile(request, medicinePic);
System.out.println("upload img path: " + imgPath);
if (imgPath != null) {
result.put(“state”, “success”);
result.put(“result”, imgPath);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
根据过滤条件过滤查询药品总数
@param medicine 药品过滤信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getFilteredMedicineCount”)
public @ResponseBody
Map<String, Object> getFilteredMedicineCount(@RequestBody Medicine medicine) throws Exception {
System.out.println("getFilteredMedicineCount — medicine: " + medicine);
Map<String, Object> result = new HashMap<String, Object>();
int count = medicineService.getFilteredCount(medicine);
if (count > 0) {
result.put(“state”, “success”);
result.put(“result”, count);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
药品信息管理控制层:
@Controller
@RequestMapping(value = “medicine/medicine_type”, method = {RequestMethod.POST})
public class MedicineTypeController {
@Autowired
MedicineTypeService medicineTypeService;
/**
获取指定ID的药品类型信息
@param typeIds String[] 药品类型ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getSomeMedicineType”)
public @ResponseBody
Map<String, Object> getSomeMedicineType(@RequestParam(value = “typeIds[]”) String[] typeIds) throws Exception {
List medicineTypes = medicineTypeService.getSomeMedicineType(typeIds);
Map<String, Object> result = new HashMap<String, Object>();
if (medicineTypes.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, medicineTypes);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
获取药品类型总量
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getMedicineTypeCount”)
public @ResponseBody
Map<String, Object> getMedicineTypeCount() throws Exception {
int count = medicineTypeService.count();
Map<String, Object> result = new HashMap<String, Object>();
if (count > 0) {
result.put(“state”, “success”);
result.put(“result”, count);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
获取指定数量的药品类型信息
@param offset 偏移量
@param limit 返回限制条数
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getLimitMedicineType”)
public @ResponseBody
Map<String, Object> getLimitMedicineType(@RequestParam(value = “offset”) int offset,
@RequestParam(value = “limit”) int limit) throws Exception {
List medicineTypes = medicineTypeService.getLimitMedicineType(offset, limit);
Map<String, Object> result = new HashMap<String, Object>();
if (medicineTypes.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, medicineTypes);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
根据药品类型ID更新药品类型信息
@param medicineType 新的药品类型信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “updateMedicineTypeById”)
public @ResponseBody
Map<String, Object> updateMedicineTypeById(@RequestBody MedicineType medicineType) throws Exception {
int updateCount = medicineTypeService.updateById(medicineType);
Map<String, Object> result = new HashMap<String, Object>();
if (updateCount > 0) {
result.put(“state”, “success”);
result.put(“result”, updateCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
根据药品类型ID数组删除一些药品类型信息
@param medicineTypeIds 药品类型ID数组
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “deleteSomeMedicineType”)
public @ResponseBody
Map<String, Object> deleteSomeMedicineType(@RequestParam(value = “medicineTypeIds[]”) String[] medicineTypeIds) throws Exception {
int deleteNum = medicineTypeService.deleteSomeMedicineType(medicineTypeIds);
Map<String, Object> result = new HashMap<String, Object>();
if (deleteNum > 0) {
result.put(“state”, “success”);
result.put(“result”, deleteNum);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
/**
添加药品类型
@param medicineType 药品信息
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “addMedicineType”)
public @ResponseBody
Map<String, Object> addMedicineType(@RequestBody MedicineType medicineType) throws Exception {
System.out.println(medicineType);
int addCount = medicineTypeService.addMedicineType(medicineType);
Map<String, Object> result = new HashMap<String, Object>();
if (addCount > 0) {
result.put(“state”, “success”);
result.put(“result”, addCount);
} else {
result.put(“state”, “fail”);
result.put(“reason”, 0);
return result;
/**
查询所有药品类型
@return Map 返回相关状态及信息
@throws Exception 异常
*/
@RequestMapping(value = “getAllMedicineType”)
public @ResponseBody
Map<String, Object> getAllMedicineType() throws Exception {
List medicineTypes = medicineTypeService.getAllMedicineType();
Map<String, Object> result = new HashMap<String, Object>();
if (medicineTypes.size() > 0) {
result.put(“state”, “success”);
result.put(“result”, medicineTypes);
} else {
result.put(“state”, “fail”);
result.put(“reason”, null);
return result;
基于javaweb的药品进货销售管理系统(java+ssm+html+js+jsp+mysql)相关推荐
- Java项目:药品进货销售管理系统(java+SSM+HTML+JS+JSP+mysql)
源码获取:俺的博客首页 "资源" 里下载! 项目介绍 管理员角色包含以下功能: 管理员登录,角色权限管理,职工管理,药品销售管理,供应商管理,进货管理,药品信息管理,过期药品处理等 ...
- 基于javaweb的律师事务所律师管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的律师事务所律师管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/m ...
- 基于javaweb的网吧计费管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的网吧计费管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...
- 基于javaweb的物流快递管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的物流快递管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...
- 基于javaweb的新闻管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的新闻管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myecli ...
- 基于javaweb的物业缴费管理系统(java+ssm+html+js+jsp+mysql)
基于javaweb的物业缴费管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...
- 基于javaweb+mysql的律师事务所律师管理系统(java+SSM+HTML+JS+jsp+mysql)
项目介绍 管理员角色包含以下功能: 管理员登录,律师信息管理,预约审核管理,预约记录查看,拒绝预约查询,注册一个用户,个人信息修改等功能. 用户角色包含以下功能: 用户登录,律师信息查看,预约记录查询 ...
- Java项目:考试在线报名管理系统(java+SSM+HTML+JS+jsp+mysql)
源码获取:俺的博客首页 "资源" 里下载! 项目介绍 考务管理员角色包含以下功能: 考务管理员登录,教务办公室管理,考场管理,考试管理,考场分配管理,报名管理等功能. 管理员角色包 ...
- Java项目:网吧计费管理系统(java+SSM+HTML+JS+jsp+mysql)
源码获取:俺的博客首页 "资源" 里下载! 项目介绍 管理员角色包含以下功能: 登录与注册,会员管理,会员充值,烟饮料外卖,营业额信息统计,今日营业信息查看等功能. 环境需要 1. ...
最新文章
- Redis两种持久化方式(RDBAOF)
- tidevice.exceptions.MuxServiceError: Could not start service: com.apple.testmanagerd.lockdown.secure
- Spring Boot文档阅读笔记=Caching Data with Spring
- LoadDruidSegmentStep failed SQLException: Cannot load JDBC driver class ‘com.mysql.jdbc.Driver‘
- SAP License:赛锐信息访谈启示录(四)
- 使用jQuery实现全选、全不选、 反选(button)
- junit单元测试不通过报documentationPluginsBootstrapper相关异常
- CUDA ---- Hello World From GPU
- [CLR团队公告]CLR基础研究团队纲领
- 第七版(谢希仁)计算机网络 知识点总结
- 文件扩展名(后缀名)是什么?win10怎么显示扩展名?
- maven的生命周期,插件介绍(二)
- python查文章字数
- JLabel.setBounds的四个参数
- NPN和PNP三极管收录笔记
- Google Guava EventBus 消息发布-订阅异步调用使用
- 软件中的易用性设计及测试(一)
- Nginx服务详细篇从基础到反向代理和负载均衡
- javascript 使用canvans 画圆形 椭圆 正方形 长方形签章
- 监视注册表变化 - Registry Auditing