@RequestMapping(“/login”)
public String login(HttpServletRequest request, HttpServletResponse response) {
Login user = LoginService.findByName(request.getParameter(“username”));
if (null == user || “”.equals(user)) {
return “/index”;
} else {
if ((user.getPassword()).equals(request.getParameter(“password”))) {
System.out.println();
Cookie cookie;
try {
cookie = new Cookie(“username”, URLEncoder.encode(
user.getUsername(), “utf-8”));
Cookie cookie1 = new Cookie(“usertype”, String.valueOf(user
.getUsertype()));
response.addCookie(cookie1);
response.addCookie(cookie);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return “/adminList”;
} else {
return “/index”;
}
}
}
@RequestMapping(“/userList”)
public String userList() {
return “redirect:/user/queryAll.do”;
}
@RequestMapping(“/exitAll”)
public String exitAll() {
return “/index”;
}
}
SaledrugController
package com.sjsq.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sjsq.bean.Saledrug;
import com.sjsq.bean.Warehouse;
import com.sjsq.service.SaledrugService;
import com.sjsq.service.WarehouseService;
@Controller
@RequestMapping(“/user”)
public class SaledrugController {
@Autowired
private SaledrugService saledrugService;
@Autowired
private WarehouseService warehouseService;
@RequestMapping(“/querysaledrugAll”)
public String querysaledrugAll(HttpServletRequest request) {
List list = saledrugService.querysaledrugAll();
request.setAttribute(“saledrugList”, list);
return “saledrugList”;
}
@RequestMapping(“/presaledrugadd”)
public String presaledrugadd() {
return “saledrugadd”;
}
@RequestMapping(“/saledrugadd”)
public String saledrugadd(Saledrug Saledrug, Warehouse warehouse,
HttpServletRequest request) {
warehouse.setDrug_id(Saledrug.getDrug_id());
if (warehouseService.queryWarehouseBydrug_id(warehouse) == null) {
request.setAttribute(“errorMessage”, “库存不足”);
return “saledrugadd”;
} else {
if (warehouseService.queryWarehouseBydrug_id(warehouse)
.getStock_number() > Saledrug.getSale_number()) {
saledrugService.saledrugadd(Saledrug);
warehouse.setStock_number(warehouseService
.queryWarehouseBydrug_id(warehouse).getStock_number()
- Saledrug.getSale_number());
warehouseService.updateWarehouseBydrug_id(warehouse);
return “redirect:/user/querysaledrugAll.do”;
} else {
request.setAttribute(“errorMessage”, “库存不足”);
return “saledrugadd”;
}
}
}
@RequestMapping(“/saledrugdelete”)
public String saledrugdelete(Saledrug saledrug, Warehouse warehouse) {
warehouse.setDrug_id(saledrugService
.querysaledrugById(saledrug.getId()).getDrug_id());
warehouse.setStock_number(warehouseService.queryWarehouseBydrug_id(
warehouse).getStock_number()
- saledrugService.querysaledrugById(saledrug.getId())
.getSale_number());
warehouseService.updateWarehouseBydrug_id(warehouse);
saledrugService.saledrugdelete(saledrug.getId());
return “redirect:/user/querysaledrugAll.do”;
}
@RequestMapping(“/querysaledrug”)
public String querysaledrug(Saledrug saledrug, HttpServletRequest request) {
List list = saledrugService.querysaledrug(saledrug);
request.setAttribute(“saledrugList”, list);
return “saledrugList”;
}
@RequestMapping(“/presaledrugupdate”)
public String presaledrugupdate(Saledrug saledrug,
HttpServletRequest request) {
List list = new ArrayList();
list.add(saledrugService.querysaledrugById(saledrug.getId()));
request.setAttribute(“saledrugList”, list);
return “saledrugupdate”;
}
@RequestMapping(“/saledrugupdate”)
public String saledrugupdate(Saledrug saledrug, Warehouse warehouse,
HttpServletRequest request) {
if ((saledrug.getDrug_id()).equals(saledrugService.querysaledrugById(
saledrug.getId()).getDrug_id())) {
warehouse.setDrug_id(saledrug.getDrug_id());
warehouse.setStock_number(warehouseService.queryWarehouseBydrug_id(
warehouse).getStock_number()
- saledrugService.querysaledrugById(saledrug.getId())
.getSale_number() - saledrug.getSale_number());
warehouseService.updateWarehouseBydrug_id(warehouse);
saledrugService.saledrugupdate(saledrug);
} else {
warehouse.setDrug_id(saledrugService.querysaledrugById(
saledrug.getId()).getDrug_id());
warehouse.setStock_number(warehouseService.queryWarehouseBydrug_id(
warehouse).getStock_number()
- saledrugService.querysaledrugById(saledrug.getId())
.getSale_number());
warehouseService.updateWarehouseBydrug_id(warehouse);
warehouse.setDrug_id(saledrug.getDrug_id());
if (warehouseService.queryWarehouseBydrug_id(warehouse) == null) {
request.setAttribute(“errorMessage”, “库存不足”);
return querysaledrugAll(request);
} else {
if (warehouseService.queryWarehouseBydrug_id(warehouse)
.getStock_number() > saledrug.getSale_number()) {
warehouse.setStock_number(warehouseService
.queryWarehouseBydrug_id(warehouse)
.getStock_number()
- saledrug.getSale_number());
warehouseService.updateWarehouseBydrug_id(warehouse);
saledrugService.saledrugupdate(saledrug);
} else {
request.setAttribute(“errorMessage”, “库存不足”);
return querysaledrugAll(request);
}
}
}
return “redirect:/user/querysaledrugAll.do”;
}
public WarehouseService getWarehouseService() {
return warehouseService;
}
public void setWarehouseService(WarehouseService warehouseService) {
this.warehouseService = warehouseService;
}
public SaledrugService getSaledrugService() {
return saledrugService;
}
public void setSaledrugService(SaledrugService saledrugService) {
this.saledrugService = saledrugService;
}
}
StockdrugController
package com.sjsq.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sjsq.bean.Stockdrug;
import com.sjsq.bean.Warehouse;
import com.sjsq.service.StockdrugService;
import com.sjsq.service.WarehouseService;
@Controller
@RequestMapping(“/user”)
public class StockdrugController {
@Autowired
private StockdrugService stockdrugService;
@Autowired
private WarehouseService warehouseService;
@RequestMapping(“/stockdrugList”)
public String stockdrugList(HttpServletRequest request) {
return querystockdrugAll(request);
}
@RequestMapping(“/querystockdrugAll”)
public String querystockdrugAll(HttpServletRequest request) {
List list = stockdrugService.querystockdrugAll();
request.setAttribute(“stokdrugList”, list);
return “stockdrugList”;
}
@RequestMapping(“/prestockdrugadd”)
public String prestockdrugadd() {
return “stockdrugadd”;
}
@RequestMapping(“/stockdrugadd”)
public String stockdrugadd(Stockdrug stockdrug, Warehouse warehouse) {
warehouse.setDrug_id(stockdrug.getDrug_id());
warehouse.setStock_number(stockdrug.getBuy_num());
if (warehouseService.queryWarehouseBydrug_id(warehouse) != null) {
warehouse.setStock_number((warehouse.getStock_number()) + ((warehouseService.queryWarehouseBydrug_id(warehouse)).getStock_number()));
warehouseService.updateWarehouseBydrug_id(warehouse);
stockdrugService.addStockdrugBydrug_id(stockdrug);
} else {
stockdrugService.addStockdrugBydrug_id(stockdrug);
warehouseService.addWarehouseBydrug_id(warehouse);
}
return “redirect:/user/querystockdrugAll.do”;
}
@RequestMapping(“/stockdrugdelete”)
public String stockdrugdelete(Stockdrug stockdrug) {
stockdrugService.stockdrugdelete(stockdrug.getId());
return “redirect:/user/querystockdrugAll.do”;
}
@RequestMapping(“/prestockdrugupdate”)
public String prestockdrugupdate(Stockdrug stockdrug, HttpServletRequest request) {
List list = stockdrugService.stockdrugQueryById(stockdrug.getId());
request.setAttribute(“stokdrugList”, list);
return “stockdrugupdate”;
}
@RequestMapping(“/stockdrugupdate”)
public String stockdrugupdate(Stockdrug stockdrug, Warehouse warehouse) {
String temp = “”;
int te = 0;
List list = stockdrugService.stockdrugQueryById(stockdrug.getId());
for (Stockdrug stockdrug2 : list) {
temp = stockdrug2.getDrug_id();
te = stockdrug2.getBuy_num();
}
if ((stockdrug.getDrug_id()).equals(temp)) {
warehouse.setDrug_id(stockdrug.getDrug_id());
int a = warehouseService.queryWarehouseBydrug_id(warehouse).getStock_number();
a = a - te + stockdrug.getBuy_num();
warehouse.setStock_number(a);
warehouseService.updateWarehouseBydrug_id(warehouse);
} else {
warehouse.setDrug_id(temp);
int a = warehouseService.queryWarehouseBydrug_id(warehouse).getStock_number();
warehouse.setStock_number(a - te);
warehouseService.updateWarehouseBydrug_id(warehouse);
warehouse.setDrug_id(stockdrug.getDrug_id());
if (warehouseService.queryWarehouseBydrug_id(warehouse) != null) {
warehouse.setStock_number(warehouseService.queryWarehouseBydrug_id(warehouse).getStock_number() + stockdrug.getBuy_num());
warehouseService.updateWarehouseBydrug_id(warehouse);
} else {
warehouse.setStock_number(stockdrug.getBuy_num());
warehouseService.addWarehouseBydrug_id(warehouse);
}
}
stockdrugService.stockdrugupdate(stockdrug);
return “redirect:/user/querystockdrugAll.do”;
}
@RequestMapping(“/querystockdrug”)
public String querystockdrug(Stockdrug stockdrug, HttpServletRequest request) {
List list = stockdrugService.querystockdrug(stockdrug);
request.setAttribute(“stokdrugList”, list);
return “stockdrugList”;
}
}
UserController
package com.sjsq.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sjsq.bean.User;
import com.sjsq.service.UserService;
@Controller
@RequestMapping(“/user”)
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(“/queryAll”)
public String queryAll(HttpServletRequest request) {
List list = userService.queryAll();
request.setAttribute(“userList”, list);
return “userList”;
}
@RequestMapping(“/preadd”)
public String preadd() {
return “useradd”;
}
@RequestMapping(“/add”)
public String add(User user, HttpServletRequest request) {
if (userService.queryByName(user.getUsername()) == null) {
userService.add(user);
} else {
request.setAttribute(“errorMessage”, “用户已存在”);
}
return queryAll(request);
}
@RequestMapping(“/delete”)
public String delete(User user) {
userService.delete(user.getId());
return “redirect:/user/queryAll.do”;
}
@RequestMapping(“/preupdate”)
public String update(User user, HttpServletRequest request) {
user = userService.queryById(user.getId());
List list = new ArrayList();
list.add(user);
request.setAttribute(“userList”, list);
return “userupdate”;
}
@RequestMapping(“/update”)
public String update(User user) {
userService.update(user);
return “redirect:/user/queryAll.do”;
}
@RequestMapping(“/queryByUsernameUserType”)
public String queryByUsernameUserType(User user, HttpServletRequest request) {
List list = userService.queryByUsernameUserType(user);
request.setAttribute(“userList”, list);
return “userList”;
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
}
WarehouseController
package com.sjsq.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sjsq.bean.Warehouse;
import com.sjsq.service.WarehouseService;
@Controller
@RequestMapping(“/user”)
public class WarehouseController {
@Autowired
private WarehouseService warehouseService;
public WarehouseService getWarehouseService() {
return warehouseService;
}
public void setWarehouseService(WarehouseService warehouseService) {
this.warehouseService = warehouseService;
}
@RequestMapping(“/querywarehouseAll”)
public String querywarehouseAll(HttpServletRequest request) {
List list = warehouseService.querywarehouseAll();
request.setAttribute(“warehoustList”, list);
return “warehouseList”;
}
@RequestMapping(“/querywarehouse”)
public String querywarehouse(Warehouse warehouse, HttpServletRequest request) {
List list = warehouseService.querywarehouse(warehouse);
request.setAttribute(“warehoustList”, list);
return “warehouseList”;
}
@RequestMapping(“/prewarehouseupdate”)
public String prewarehouseupdate(Warehouse warehouse, HttpServletRequest request) {
List list = warehouseService.queryWarehouseById(warehouse.getId());
request.setAttribute(“warehoustList”, list);
return “warehouseupdate”;
}
@RequestMapping(“/warehouseupdate”)
public String warehouseupdate(Warehouse warehouse) {
warehouseService.updateWarehouseById(warehouse);
return “redirect:/user/querywarehouseAll.do”;
}
}
四、其他
====
1.更多系统
Java+JSP系统系列实现
Java+Servlet系统系列实现
Java+SSM系统系列实现
Java+SSH系统系列实现
Java+Springboot系统系列实现
Java+Springboot+H-ui+Maven实现营销管理系统
Java+Springboot+Bootstrap+Maven实现网上商城系统
Java+Springboot+Bootstrap+Maven实现景区旅游管理系统
1.更多JavaWeb系统请关注专栏。
2.更多JavaSwing系统请关注专栏。
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
![](https://i-blog.csdnimg.cn/blog_migrate/38e82cc7ce8b40091f1cd550e30b914c.jpeg)
最后
基础知识是前端一面必问的,如果你在基础知识这一块翻车了,就算你框架玩的再6,webpack、git、node学习的再好也无济于事,因为对方就不会再给你展示的机会,千万不要因为基础错过了自己心怡的公司。前端的基础知识杂且多,并不是理解就ok了,有些是真的要去记。当然了我们是牛x的前端工程师,每天像背英语单词一样去背知识点就没必要了,只要平时工作中多注意总结,面试前端刷下题目就可以了。
什么?你问面试题资料在哪里,这不是就在你眼前吗(滑稽
.更多JavaSwing系统请关注专栏。
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-XSN52rgz-1712111791690)]
[外链图片转存中…(img-glYOxqRG-1712111791691)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
[外链图片转存中…(img-SLrAdJOs-1712111791691)]
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
![](https://i-blog.csdnimg.cn/blog_migrate/38e82cc7ce8b40091f1cd550e30b914c.jpeg)
最后
基础知识是前端一面必问的,如果你在基础知识这一块翻车了,就算你框架玩的再6,webpack、git、node学习的再好也无济于事,因为对方就不会再给你展示的机会,千万不要因为基础错过了自己心怡的公司。前端的基础知识杂且多,并不是理解就ok了,有些是真的要去记。当然了我们是牛x的前端工程师,每天像背英语单词一样去背知识点就没必要了,只要平时工作中多注意总结,面试前端刷下题目就可以了。
什么?你问面试题资料在哪里,这不是就在你眼前吗(滑稽