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

一、项目简述
功能:一个基于JavaWeb的网上书店的设计与实现,归纳 出了几个模块,首先是登录注册模块,图书查找模块,购物车模块,订单模块,个人中心模块,用户管理模块,图 书管理模块等。 该项目是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等等

javaee网上书城文稿 网上书店javaweb_java


javaee网上书城文稿 网上书店javaweb_mysql_02


javaee网上书城文稿 网上书店javaweb_用户管理_03


javaee网上书城文稿 网上书店javaweb_javaee网上书城文稿_04


javaee网上书城文稿 网上书店javaweb_javaee网上书城文稿_05

适用

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

{
      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
}
        else
        	return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
    }*/
    @GetMapping("/list/{orderId}")
        public ResultVO getOrderByOrderId(@PathVariable("orderId") Integer orderId) {
    	Order orders = orderService.selectByOrderId(orderId);
    	if(orders!=null)
        return new ResultVO(ResultCode.SUCCESS,orders);
    	else
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);
}
    //跳转添加书籍页面
    @GetMapping("/add_book")
    public String AddBook(){
        return "admin/add_book";
    }
    //跳转后台登录页面
    @GetMapping("/login")
    public String toAdminLogin(){
        return "admin/login";
    }
}
书籍管理模块控制器:
/**
 * @Description: 书籍管理模块控制器
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
     */
    @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)
           {
int books = bookService.bookDeleteSearchById(bookId);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    //添加验证注解
    @PostMapping("/insert")
    public ResultVO bookInsert(@Valid Book record) {
        int books = bookService.bookInsert(record);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    @GetMapping("/searchcode")
  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);
     }
public ResultVO bookInsert(@Valid Book record) {
        int books = bookService.bookInsert(record);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    @GetMapping("/searchcode")
  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);
  }
    //添加验证注解
public ResultVO categoryDelete(String categoryCode)
	{
		int categories = categoryService.deleteByByCategoryCode(categoryCode);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/insert")
	public ResultVO categoryInsert(@Valid Category record)
	{
		
		int categories = categoryService.insert(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/update")
List<Order> orders = orderService.searchOrders(order, page, limit);
        PageInfo pageInfo = new PageInfo(orders);
        return new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), orders);
    }
}
后台页面的路由跳转:
/**
 * @Description: 后台页面的路由跳转
 */
@Controller
@RequestMapping("/admin")
public class AdminRouterController {
    //跳转用户管理页面
    @GetMapping("/user_manage")
    public String toUserManage(){
        return "admin/user";
    }
    //跳转书籍管理页面
    @GetMapping({"/","/book_manage"})
    public String toBookManage(){
        return "admin/books";
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);
    }
    @PostMapping("/delete")
    public ResultVO bookDelete(Integer bookId) {
        int books = bookService.bookDeleteSearchById(bookId);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    //添加验证注解
    @PostMapping("/insert")
    public ResultVO bookInsert(@Valid Book record) {
        int books = bookService.bookInsert(record);
        return new ResultVO(ResultCode.SUCCESS, null);
@Autowired
    private OrderHandleService orderHandleService;
    /**
     * 分页获取订单列表,如果都为空,则获取所有
     * @param page    页码
     * @param limit   每页的条数
     * @return
     */
    @GetMapping("/list")
    public ResultVO getOrderList(@RequestParam(required = false) Integer page,@RequestParam(required = false) Integer limit) {
}
    /**
     * 删除指定orderId的订单
     * @param orderId
     * @return
     */
    @DeleteMapping("/list/{orderId}")
    public ResultVO deleteOrder(@PathVariable("orderId") Integer orderId) {
    	int orders = orderService.deleteByOrderId(orderId);
        return new ResultVO(ResultCode.SUCCESS,null);
    }
   /* @GetMapping("/list/user_order/{userId}")
    public ResultVO getOrderByUserId(@PathVariable("userId") Integer userId) {
    	List<Order> orders = orderService.selectByUserId(userId);
    	if(orders.size()!=0)
    	{
    		return new ResultVO(ResultCode.SUCCESS,orders);
    	}
@GetMapping("/order_manage")
    public String toOrderManage(){
        return "admin/order";
    }
    //跳转添加书籍页面
    @GetMapping("/add_book")
    public String AddBook(){
        return "admin/add_book";
    }
    //跳转后台登录页面
    @GetMapping("/login")
    public String toAdminLogin(){
        return "admin/login";
    }
}
书籍管理模块控制器:
/**
 * @Description: 书籍管理模块控制器
 */
@RestController
* @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 new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), orders);
    }
}
后台页面的路由跳转:
/**
 * @Description: 后台页面的路由跳转
 */
@Controller
@RequestMapping("/admin")
public class AdminRouterController {
    //跳转用户管理页面
    @GetMapping("/user_manage")
    public String toUserManage(){
        return "admin/user";
    }
    //跳转书籍管理页面
    @GetMapping({"/","/book_manage"})
    public String toBookManage(){
        return "admin/books";
    }
    //跳转分类管理页面
    @GetMapping("/category_manage")
if (order.getConsigneeName().isEmpty()) {
            order.setConsigneeName(null);
        }
        List<Order> orders = orderService.searchOrders(order, page, limit);
        PageInfo pageInfo = new PageInfo(orders);
        return new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), orders);
    }
}
后台页面的路由跳转:
/**
 * @Description: 后台页面的路由跳转
 */
@Controller
@RequestMapping("/admin")
@GetMapping({"/","/book_manage"})
    public String toBookManage(){
        return "admin/books";
    }
    //跳转分类管理页面
    @GetMapping("/category_manage")
    public String toCategoryManage(){
        return "admin/category";
    }
    //跳转订单管理页面
    @GetMapping("/order_manage")
    public String toOrderManage(){
        return "admin/order";
    }
    //跳转添加书籍页面
    @GetMapping("/add_book")
    public String AddBook(){
        return "admin/add_book";
    }
int categories = categoryService.insert(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/update")
	public  ResultVO categoryUpdate(@Valid Category record)
	{
		int categories = categoryService.updateByCategoryCode(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加分页
	@GetMapping("/searchall")
	public  ResultVO categorySearchAll(Integer page,Integer limit)
	{
		List<Category> categories = categoryService.selectAll(page==null?0:page,limit==null?10:limit);
		if(categories.size()!=0)
			return new ResultVO(ResultCode.SUCCESS,categories);
		else
			return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
	}	
}
订单管理模块:
/**
@GetMapping("/searchcode")
  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")
if(categories.size()!=0)
			return new ResultVO(ResultCode.SUCCESS,categories);
		else
			return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
	}	
}
订单管理模块:
/**
 * @Description: 订单管理模块
 */
@RestController
@RequestMapping("/order")
public class OrderController {
     @Autowired
     private OrderService orderService;
    @Autowired
    private OrderHandleService orderHandleService;
    /**
@PostMapping("/delete")
	public ResultVO categoryDelete(String categoryCode)
	{
		int categories = categoryService.deleteByByCategoryCode(categoryCode);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/insert")
	public ResultVO categoryInsert(@Valid Category record)
	{
		
		int categories = categoryService.insert(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/update")
	public  ResultVO categoryUpdate(@Valid Category record)
	{
		int categories = categoryService.updateByCategoryCode(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加分页
	@GetMapping("/searchall")
	public  ResultVO categorySearchAll(Integer page,Integer limit)
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);
    }
    /**
/**
     * 删除指定orderId的订单
     * @param orderId
     * @return
     */
    @DeleteMapping("/list/{orderId}")
    public ResultVO deleteOrder(@PathVariable("orderId") Integer orderId) {
    	int orders = orderService.deleteByOrderId(orderId);
        return new ResultVO(ResultCode.SUCCESS,null);
    }
   /* @GetMapping("/list/user_order/{userId}")
    public ResultVO getOrderByUserId(@PathVariable("userId") Integer userId) {
    	List<Order> orders = orderService.selectByUserId(userId);
    	if(orders.size()!=0)
    	{
    		return new ResultVO(ResultCode.SUCCESS,orders);
    	}
        else
        	return new ResultVO(ResultCode.RECORD_NOT_FOUND,null);
    }*/
    @GetMapping("/list/{orderId}")
        public ResultVO getOrderByOrderId(@PathVariable("orderId") Integer orderId) {
    	Order orders = orderService.selectByOrderId(orderId);
    	if(orders!=null)
@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);
    }
    @PostMapping("/delete")
    public ResultVO bookDelete(Integer bookId) {
        int books = bookService.bookDeleteSearchById(bookId);
        return new ResultVO(ResultCode.SUCCESS, null);
    }
    //添加验证注解
    @PostMapping("/insert")
    public ResultVO bookInsert(@Valid Book record) {
        int books = bookService.bookInsert(record);
        return new ResultVO(ResultCode.SUCCESS, null);
public ResultVO categoryDelete(String categoryCode)
	{
		int categories = categoryService.deleteByByCategoryCode(categoryCode);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证
	@PostMapping("/insert")
	public ResultVO categoryInsert(@Valid Category record)
	{
		
		int categories = categoryService.insert(record);
		return new ResultVO(ResultCode.SUCCESS,null);
	}
	//添加验证

javaee网上书城文稿 网上书店javaweb_List_06