1、项目介绍

本文研究了一个农夫山泉送水管理系统,该系统基于B/S架构模式,使用SpringBoot框架开发设计而成。系统主要以Java语言作为开发基础,使用了Thymeleaf+SpringBoot等技术,采用Idea作为开发工具,以MySql作为数据库工具。本系统功能比较完善,界面友好,操作简单,方便用户的使用。

进入系统后登陆管理员账号进入管理员页面。管理员主要功能如下:a.会员管理 b.送水工管理 c.送水记录 d.工资管理 e.统计送水量 f.个人信息

2、技术框架

运行系统:windows

编程语言:java

系统架构:B/S

后端框框:SpringBoot+Mybatis-plus

前端框架:HTML+jQuery+Bootstrap+CSS

前后端分离:否

数据库:MySQL

Maven项目:是

数据库表数量:4

运行环境:JDK8+MySQL57+IntelliJ IDEA+Maven3.6

3、演示视频

基于springboot的送水管理系统

4、项目截图

5、文档截图

6、代码示例

@Controller
@RequestMapping("/admin/customer")
@Slf4j
public class CustomerController {
    /**
     * 控制器依赖业务逻辑,按照类型自动装配CustomerService对象
     */
    @Autowired
    private CustomerService customerService  ;


    /**
     * 查询所有会员
     * @param model
     * @return
     */
    @RequestMapping("/list")
    public String list(Model model,@RequestParam(name = "custName",defaultValue = "")String custName) {
        List<Customer> customerList = new ArrayList<>();
        if("".equals(custName)){
            customerList = customerService.listCustomer();
        }else{
            customerList = customerService.searchCustomer(custName);
        }
        // 把搜索条件回传到前端页面
        model.addAttribute("searchName",custName);
        model.addAttribute("customers",customerList);
        return "customer/list";
    }

  /**
     * 添加会员操作
     * @param customer
     * @return
     */
     @ResponseBody
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Message add(Customer customer) {
        if(StringUtils.isEmpty(customer.getCustName())){
            return Message.error("请填写会员名称");
        }
      if(StringUtils.isEmpty(customer.getCustAddress())){
          return Message.error("请填写会员地址");
      }
      if(StringUtils.isEmpty(customer.getCustMobile())){
          return Message.error("请填写会员联系方式");
      }
        if(customerService.saveCustomer(customer)<=0){
            return Message.error("会员添加失败");
        }
      return Message.success();
    }


    /**
     * 会员删除操作
     * @param cid
     * @return
     */
    @ResponseBody
    @RequestMapping("/delete")
    public Message delete(@RequestParam(name = "id") Integer cid) {
        try {
            int rows = customerService.deleteCustomerById(cid);
        }catch (Exception e){
            return Message.error("删除会员失败");
        }
        return Message.success();
    }

    /**
     * 根据id查询会员
     * @return
     */
    @ResponseBody
    @GetMapping("/edit")
    public Message edit(@RequestParam(name = "id")int id){
        Customer customerById = customerService.getCustomerById(id);
        return Message.success().add("data",customerById);
    }

    /**
     * 编辑会员操作
     * @param customer
     * @return
     */
    @ResponseBody
    @PostMapping("/edit")
    public Message edit(Customer customer){
        if(StringUtils.isEmpty(customer.getCustName())){
            return Message.error("请填写会员名称");
        }
        if(StringUtils.isEmpty(customer.getCustAddress())){
            return Message.error("请填写会员地址");
        }
        if(StringUtils.isEmpty(customer.getCustMobile())){
            return Message.error("请填写会员联系方式");
        }
        if(customerService.updateCustomer(customer)<=0){
            return Message.error("编辑会员失败");
        }
        return Message.success();
    }
}

Logo

一站式 AI 云服务平台

更多推荐