aihk 发表于 2021-9-3 17:11:31

撸完这个springboot项目,我对boot轻车熟路!

系统教程:
一般开发项目,猛哥还是比较快,但是录教程真的非常耗时!

为了帮助大家更好的理解项目,还是录吧!

都开源了!

小伙伴,记得给个三连!

教程非常详细了:

视频教程点

3,系统环境
系统开发平台:

JDK1.8+Maven3.6.1

框架:Springboot2.X+Layui

数据库和工具:MySql5.7 Navicat

开发工具: Intellij Idea

浏览器:Chrome

涉及到的技术:MySql、Springboot、MyBatisPlus、lombok、Shiro、layui、jquery、element

4,系统演示






















大家若看详细的演示还是去看视频吧:

https://www.bilibili.com/video/BV1eh411k7P3

老铁,这些好的实战项目,你确认不三连吗?嘿嘿……

5,系统核心代码
controller:

@Controller
public class UserController {

    /**
   * 转向登录页面
   */
    @RequestMapping(value = "/login")
    public String login(){
      return "/login";
    }

    /**
   * 判断用户登录是否成功
   */
    @RequestMapping(value = "/toLogin")
    @ResponseBody
    public Object toLogin(String username,String password){
      if(username==null||password==null){
            return ResultMapUtil.getHashMapLogin("用户名密码不能为空","2");
      }
      Subject subject = SecurityUtils.getSubject();
      UsernamePasswordToken token = new UsernamePasswordToken(username,password);
      try{
            subject.login(token);
      }catch (UnknownAccountException e){
            return ResultMapUtil.getHashMapLogin("用户名不存在","2");
      }catch (IncorrectCredentialsException e){
            return ResultMapUtil.getHashMapLogin("密码错误","2");
      }
      return ResultMapUtil.getHashMapLogin("验证成功","1");
    }

    /**
   * 转向后台管理首页
   */
    @RequestMapping(value = "/index")
    public String index(){
      return "/index";
    }

    /**
   * 退出登录
   */
    @RequestMapping(value = "/logout")
    public String logout(){
      Subject subject = SecurityUtils.getSubject();
      subject.logout();
      return "redirect:/login";
    }

}
SupplierController

public class SupplierController {

    @Autowired
    private ISupplierService supplierService;

    /**
   * 转向供应商页面
   */
    @RequestMapping
    public String supplier(){
      return "/supplier";
    }

    /**
   * 分页查询供应商列表
   */
    @RequestMapping(value = "/supplierQueryPage")
    @ResponseBody
    public Object supplierQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
      try{
            IPage<Supplier> iPage = supplierService.selectSupplierPage(pageNum,pageSize,param);
            return ResultMapUtil.getHashMapMysqlPage(iPage);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 转向供应商新增页面
   */
    @RequestMapping(value = "/supplierPage")
    public String supplierPage(){
      return "/supplierPage";
    }

    /**
   * 添加一个供应商
   */
    @RequestMapping(value = "/supplierAdd")
    @ResponseBody
    public Object supplierAdd(Supplier supplier){
      try{
            supplier.setCreatetime(new Date());
            int i = supplierService.addSupplier(supplier);
            return ResultMapUtil.getHashMapSave(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 转向供应商编辑页面
   */
    @RequestMapping(value = "/supplierQueryById")
    public String supplierQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
      Supplier supplier = supplierService.querySupplierById(id);
      model.addAttribute("obj",supplier);
      return "/supplierPage";
    }

    /**
   * 修改一个供应商
   */
    @RequestMapping(value = "/supplierEdit")
    @ResponseBody
    public Object supplierEdit(Supplier supplier){
      try{
            int i = supplierService.editSupplier(supplier);
            return ResultMapUtil.getHashMapSave(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 删除一个供应商
   */
    @RequestMapping(value = "/supplierDelById")
    @ResponseBody
    public Object supplierDelById(Integer id){
      try{
            int i = supplierService.delSupplierById(id);
            return ResultMapUtil.getHashMapDel(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }
SaleinfoController


    @Autowired
    private ISaleinfoService saleinfoService;

    /**
   * 转向销售记录页面
   */
    @RequestMapping
    public String saleinfo(){
      return "/saleinfo";
    }

    /**
   * 分页查询销售记录列表
   */
    @RequestMapping(value = "/saleinfoQueryPage")
    @ResponseBody
    public Object saleinfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
      try{
            IPage<Saleinfo> iPage = saleinfoService.selectSaleinfoPage(pageNum,pageSize,param);
            return ResultMapUtil.getHashMapMysqlPage(iPage);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 转向销售记录新增页面
   */
    @RequestMapping(value = "/saleinfoPage")
    public String saleinfoPage(){
      return "/saleinfoPage";
    }

    /**
   * 添加一个销售记录
   */
    @RequestMapping(value = "/saleinfoAdd")
    @ResponseBody
    public Object saleinfoAdd(Saleinfo saleinfo){
      try{
            int i = saleinfoService.addSaleinfo(saleinfo);
            return ResultMapUtil.getHashMapSave(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 转向销售记录编辑页面
   */
    @RequestMapping(value = "/saleinfoQueryById")
    public String saleinfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
      Saleinfo saleinfo = saleinfoService.querySaleinfoById(id);
      model.addAttribute("obj",saleinfo);
      return "/saleinfoPage";
    }

    /**
   * 修改一个销售记录
   */
    @RequestMapping(value = "/saleinfoEdit")
    @ResponseBody
    public Object saleinfoEdit(Saleinfo saleinfo){
      try{
            int i = saleinfoService.editSaleinfo(saleinfo);
            return ResultMapUtil.getHashMapSave(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }

    /**
   * 删除一个销售记录
   */
    @RequestMapping(value = "/saleinfoDelById")
    @ResponseBody
    public Object saleinfoDelById(Integer id){
      try{
            int i = saleinfoService.delSaleinfoById(id);
            return ResultMapUtil.getHashMapDel(i);
      } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
      }
    }
6,数据表设计
DROP TABLE IF EXISTS `billinfo`;
CREATE TABLE `billinfo`(
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`sname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '供应商名称',
`dname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '药品名称',
`count` int(10) NULL DEFAULT NULL COMMENT '药品数量',
`total` float(20, 2) NULL DEFAULT NULL COMMENT '总金额',
`buytime` datetime(0) NULL DEFAULT NULL COMMENT '进货时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '账单信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of billinfo
-- ----------------------------
INSERT INTO `billinfo` VALUES (1, '哈药六厂', '感冒灵', 1000, 22500.00, '2021-02-02 16:00:00');

-- ----------------------------
-- Table structure for druginfo
-- ----------------------------
DROP TABLE IF EXISTS `druginfo`;
CREATE TABLE `druginfo`(
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
`supplier` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '供应商',
`producttime` date NULL DEFAULT NULL COMMENT '生产时间',
`warrenty` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '保质期(月)',
`number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '药品编码',
`price` float(20, 2) NULL DEFAULT NULL COMMENT '价格',
`stock` int(10) NULL DEFAULT NULL COMMENT '库存',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '药品信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of druginfo
-- ----------------------------
INSERT INTO `druginfo` VALUES (2, '感冒灵', '哈药六厂', '2020-01-27', '24', '1001', 22.50, 50);
INSERT INTO `druginfo` VALUES (3, '白药片', '云南白药', '2021-02-02', '36', '2021052', 30.50, 100);

-- ----------------------------
-- Table structure for owinfo
-- ----------------------------
DROP TABLE IF EXISTS `owinfo`;
CREATE TABLE `owinfo`(
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '药品名称',
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出库/入库',
`count` int(10) NULL DEFAULT NULL COMMENT '数量',
`operator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作人',
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '出入库' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of owinfo
-- ----------------------------
INSERT INTO `owinfo` VALUES (1, '白药片', '出库', 3, '华佗', '2021-02-20 14:21:53');
INSERT INTO `owinfo` VALUES (2, '感冒灵', '入库', 20, '扁鹊', '2021-02-20 14:22:12');

-- ----------------------------
-- Table structure for problem
-- ----------------------------
DROP TABLE IF EXISTS `problem`;
CREATE TABLE `problem`(
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '药品名称',
`dcount` int(10) NULL DEFAULT NULL COMMENT '问题药品数量',
`dprice` float(20, 2) NULL DEFAULT NULL COMMENT '药品单价',
`reason` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '问题原因',
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '问题药品' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of problem
-- ----------------------------
INSERT INTO `problem` VALUES (1, '感冒灵', 2, 22.50, '受潮了。不能欺骗消费者。', '2021-02-24 14:19:36');

-- ----------------------------
-- Table structure for returngoods
-- ----------------------------
DROP TABLE IF EXISTS `returngoods`;
CREATE TABLE `returngoods`(
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '药品名称',
`count` int(10) NULL DEFAULT NULL COMMENT '数量',
`reason` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退货原因',
`total` float(20, 2) NULL DEFAULT NULL COMMENT '总金额',
`operatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '收到退货' ROW_FORMAT = Dynamic;

————————————————
武汉兰树网络科技有限公司
www.ls-idc.com
QQ:775260000
TG:@lsidc
页: [1]
查看完整版本: 撸完这个springboot项目,我对boot轻车熟路!