基于javaweb+mysql的在线购书系统网上书店图书商城(前台、后台)(java+Springboot+ssm+mysql+maven)

一、项目简述
功能:一个基于javaweb+mysql的网上书店的设计与实现,归纳 出了几个模块,首先是登录注册模块,图书查找模块,购物车模块,订单模块,个人中心模块,用户管理模块,图 书管理模块等。 该项目是javaJeb技术的实战操作,采用了MVC设计模 式,包括基本的entity, jscript, servlet,以及ajax异步请 求,查询分页,持久化层方法的封装等等,对javaweb技 术的巩固很有帮助,为J2EE的学习打下基础,适用于课程 设计,毕业设计。

二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Springboot+ SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

     }
     else
    	 return new ResultVO(ResultCode.RECORD_NOT_FOUND, null);
  }
    //添加验证注解
    @PostMapping("/update")
    public ResultVO bookUpdate(@Valid Book record) {
        int books = bookService.bookUpdate(record);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    /**
     * 多条件搜索   ----by guozongchao
     * @param book
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/search")
    public ResultVO searchBooks(Book book,Integer page, Integer limit) {
        if(book.getBookName().isEmpty()){
            book.setBookName(null);
        }
        if(book.getIsbn().isEmpty()){
        }
        if(book.getIsbn().isEmpty()){
            book.setIsbn(null);
        }
        List<Book> books = bookService.searchBooks(book, page, limit);
        PageInfo pageInfo = new PageInfo(books);
        return new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), books);
    }
}
分类管理模块控制器:
/**
 * @Description: 分类管理模块控制器
 */
@RestController
@RequestMapping("category")
public class CategoryController {
	@Autowired
	private CategoryService categoryService;
	@Resource
	private CategoryMapper categoryMapper;
	@GetMapping("/searchcode")
	public ResultVO categorySearchByCode(String categoryCode)
	{
		
		Category categories = categoryService.selectByByCategoryCode(categoryCode);
		if(categories!=null)
		return new ResultVO(ResultCode.SUCCESS,categories);
		else
			return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
	}
	@PostMapping("/delete")
	public ResultVO categoryDelete(String categoryCode)
  public ResultVO bookSerchByCategoryCode(String catrgoryCode,Integer page,Integer limit) {
      List<Book> books = bookService.bookSearchByCode(catrgoryCode,page,limit);
        PageInfo pageInfo = new PageInfo(books);
     if(books.size()!=0)
     {
      return new ResultVO(ResultCode.SUCCESS,(int)pageInfo.getTotal(), books);
     }
     else
    	 return new ResultVO(ResultCode.RECORD_NOT_FOUND, null);
  }
    //添加验证注解
    @PostMapping("/update")
    public ResultVO bookUpdate(@Valid Book record) {
        int books = bookService.bookUpdate(record);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    /**
     * 多条件搜索   ----by guozongchao
     * @param book
    }
    //跳转后台登录页面
    @GetMapping("/login")
    public String toAdminLogin(){
        return "admin/login";
    }
}
书籍管理模块控制器:
/**
 * @Description: 书籍管理模块控制器
 */
@RestController
@RequestMapping("/book")
public class BookController {
    @Autowired
    private BookService bookService;
    @GetMapping("/searchid")
    public ResultVO bookSearchByBookId(Integer bookId) {
        // Book books=bookMapper.selectByBookId(bookIde);
        Book books = bookService.bookSearchById(bookId);
        if (books != null)
            return new ResultVO(ResultCode.SUCCESS,books);
        else
            return new ResultVO(ResultCode.RECORD_NOT_FOUND, null);
    }
	private CategoryMapper categoryMapper;
	@GetMapping("/searchcode")
	public ResultVO categorySearchByCode(String categoryCode)
	{
		
		Category categories = categoryService.selectByByCategoryCode(categoryCode);
		if(categories!=null)
		return new ResultVO(ResultCode.SUCCESS,categories);
		else
			return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
	}
	@PostMapping("/delete")
	public ResultVO categoryDelete(String categoryCode)
	{
		int categories = categoryService.deleteByByCategoryCode(categoryCode);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
     */
    @PostMapping("/submit")
    public ResultVO orderSubmit(@RequestBody @Valid Order order, HttpSession session) {
        User user = (User) session.getAttribute("user");
        order.setUserId(user.getUserId());
        orderHandleService.createOrder(order);
        return new ResultVO(ResultCode.SUCCESS,"/"+user.getUserName()+"/orders");
    }
    /**
     * 更新订单信息,比如审核通过
     * @param order
     * @return
     */
    @PutMapping("/list/{orderId}")
    public ResultVO updateOrder(@PathVariable("orderId") Integer orderId,@RequestBody Order order) {
           Order orders1 = orderService.selectByOrderId(orderId);
           if(orders1!=null)
           {
        	order.setOrderId(orderId);
        	int orders = orderService.updateByOrderId(order);
        	return new ResultVO(ResultCode.SUCCESS,null);
           }
           else
        	return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
    }
     * @return
     */
    @GetMapping("/search")
    public ResultVO searchBooks(Book book,Integer page, Integer limit) {
        if(book.getBookName().isEmpty()){
            book.setBookName(null);
        }
        if(book.getIsbn().isEmpty()){
            book.setIsbn(null);
        }
        List<Book> books = bookService.searchBooks(book, page, limit);
        PageInfo pageInfo = new PageInfo(books);
        return new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), books);
    }
}
分类管理模块控制器:
/**
 * @Description: 分类管理模块控制器
 */
@RestController
@RequestMapping("category")
public class CategoryController {
	@Autowired
	private CategoryService categoryService;
}
书籍管理模块控制器:
/**
 * @Description: 书籍管理模块控制器
 */
@RestController
@RequestMapping("/book")
public class BookController {
    @Autowired
    private BookService bookService;
    @GetMapping("/searchid")
    public ResultVO bookSearchByBookId(Integer bookId) {
        // Book books=bookMapper.selectByBookId(bookIde);
        Book books = bookService.bookSearchById(bookId);
    private OrderHandleService orderHandleService;
    /**
     * 分页获取订单列表,如果都为空,则获取所有
     * @param page    页码
     * @param limit   每页的条数
     * @return
     */
    @GetMapping("/list")
    public ResultVO getOrderList(@RequestParam(required = false) Integer page,@RequestParam(required = false) Integer limit) {
        List<Order> orders = orderHandleService.getAllOrdersByPage(page, limit);
        PageInfo pageInfo = new PageInfo(orders);
        return new ResultVO(ResultCode.SUCCESS,(int)pageInfo.getTotal(),orders);
    }
    /**
     * 用户提交订单处理
     * @param order
     * @param session
     * @return
     */
    @PostMapping("/submit")
    public ResultVO orderSubmit(@RequestBody @Valid Order order, HttpSession session) {
        User user = (User) session.getAttribute("user");
        order.setUserId(user.getUserId());

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值