源码获取:博客首页 "资源" 里下载!
汉服文化bbs商城系统,主要分为前后台。共分两种角色:管理员与普通用户;
管理员可登录前后台,普通用户仅可登录前台;普通用户登录后可发布、修改、删除自己的文章;
前台主要功能包括:
首页:文章列表、公告列表、汉服舞曲;
汉服形制:汉服发展史、汉服名词;
汉服礼仪;
汉服穿搭:汉服妆容、汉服摄影;
汉服活动:汉服事记;
推荐:汉服店铺、汉服推荐、汉服体验;
后台主要功能包括:
文章管理:查询、删除;
店铺推荐:新增推荐店、查看、修改、删除;
汉服体验店推荐:新增体验店、查看、修改、删除;
社团推荐:新增社团、查看、修改、删除;
汉服舞曲:新增舞曲、查看、删除;
公告管理:新增公告、查看、修改、删除;
留言管理:查询、修改、删除;
评论管理:查询、修改、删除;
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
1. 后端:SpringBoot
2. 前端:Thymeleaf+html+layui+jQuery+bootstrap
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
4. 运行项目,输入http://localhost:8080/ 登录
@Controller
@RequestMapping("/admin/order")
public class AdminOrderController {
@Autowired
private OrderService orderService;
/**
* 打开订单列表页面
* @return
*/
@RequestMapping("/toList.html")
public String toList() {
return "admin/order/list";
}
/**
* 获取所有订单的总数
* @return
*/
@ResponseBody
@RequestMapping("/getTotal.do")
public ResultBean getTotal() {
Pageable pageable = new PageRequest(1, 15, null);
int total = (int) orderService.findAll(pageable).getTotalElements();
return new ResultBean<>(total);
}
/**
* 获取所有订单
* @param pageindex
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping("/list.do")
public ResultBean> listData(int pageindex,
@RequestParam(value = "pageSize", defaultValue = "15") int pageSize) {
Pageable pageable = new PageRequest(pageindex, pageSize, null);
List list = orderService.findAll(pageable).getContent();
return new ResultBean<>(list);
}
/**
* 获取订单项
* @param orderId
* @return
*/
@ResponseBody
@RequestMapping("/getDetail.do")
public ResultBean> getDetail(int orderId) {
List list = orderService.findItems(orderId);
return new ResultBean<>(list);
}
/**
* 发货
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/send.do")
public ResultBean send(int id) {
orderService.updateStatus(id,3);
return new ResultBean<>(true);
}
}
@Controller
@RequestMapping("/admin/user")
public class AdminUserController {
@Autowired
private UserService userService;
/**
* 打开用户列表页面
* @return
*/
@RequestMapping("/toList.html")
public String toList() {
return "admin/user/list";
}
/**
* 打开编辑页面
* @param id
* @param map
* @return
*/
@RequestMapping("/toEdit.html")
public String toEdit(int id, Map map) {
User user = userService.findById(id);
map.put("user", user);
return "admin/user/edit";
}
/**
* 获取所有用户列表
*
* @param pageindex
* @return
*/
@ResponseBody
@RequestMapping("/list.do")
public ResultBean> findAllUser(int pageindex,
@RequestParam(value = "pageSize", defaultValue = "15") int pageSize) {
Pageable pageable = new PageRequest(pageindex, pageSize, null);
List users = userService.findAll(pageable).getContent();
return new ResultBean<>(users);
}
@ResponseBody
@RequestMapping("/getTotal.do")
public ResultBean geTotal() {
Pageable pageable = new PageRequest(1, 15, null);
int total = (int) userService.findAll(pageable).getTotalElements();
return new ResultBean<>(total);
}
@ResponseBody
@RequestMapping("/del.do")
public ResultBean del(int id) {
userService.delById(id);
return new ResultBean<>(true);
}
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/update.do")
public ResultBean update(int id,String username,
String password,String name,
String phone,String email,
String addr) {
// 更新前先查询
User user = userService.findById(id);
user.setId(id);
user.setName(name);
user.setUsername(username);
user.setPassword(password);
user.setAddr(addr);
user.setEmail(email);
user.setPhone(phone);
userService.update(user);
return new ResultBean<>(true);
}
}
@Controller
@RequestMapping("/order")
public class OrderController {
@Autowired
private OrderService orderService;
/**
* 打开订单列表页面
*
* @return
*/
@RequestMapping("/toList.html")
public String toOrderList() {
return "mall/order/list";
}
/**
* 查询用户订单列表
*
* @param request
* @return
*/
@RequestMapping("/list.do")
@ResponseBody
public ResultBean> listData(HttpServletRequest request) {
List orders = orderService.findUserOrder(request);
return new ResultBean<>(orders);
}
/**
* 查询订单详情
*
* @param orderId
* @return
*/
@RequestMapping("/getDetail.do")
@ResponseBody
public ResultBean> getDetail(int orderId) {
List orderItems = orderService.findItems(orderId);
return new ResultBean<>(orderItems);
}
/**
* 提交订单
*
* @param name
* @param phone
* @param addr
* @param request
* @param response
*/
@RequestMapping("/submit.do")
public void submit(String name,
String phone,
String addr,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
orderService.submit(name, phone, addr, request, response);
}
/**
* 支付方法
*
* @param orderId
*/
@RequestMapping("pay.do")
@ResponseBody
public ResultBean pay(int orderId, HttpServletResponse response) throws IOException {
orderService.pay(orderId);
return new ResultBean<>(true);
}
/**
* 确认收货
* @param orderId
* @param response
* @return
* @throws IOException
*/
@RequestMapping("receive.do")
@ResponseBody
public ResultBean receive(int orderId, HttpServletResponse response) throws IOException {
orderService.receive(orderId);
return new ResultBean<>(true);
}
}
@Controller
@RequestMapping("/product")
public class ProductController {
@Autowired
private ProductService productService;
@Autowired
private ClassificationService classificationService;
@Autowired
private ShopCartService shopCartService;
/**
* 获取商品信息
*
* @param id
* @return
*/
@RequestMapping("/get.do")
public ResultBean getProduct(int id) {
Product product = productService.findById(id);
return new ResultBean<>(product);
}
/**
* 打开商品详情页面
*
* @param id
* @param map
* @return
*/
@RequestMapping("/get.html")
public String toProductPage(int id, Map map) {
Product product = productService.findById(id);
map.put("product", product);
return "mall/product/info";
}
/**
* 查找热门商品
*
* @return
*/
@ResponseBody
@RequestMapping("/hot.do")
public ResultBean> getHotProduct() {
List products = productService.findHotProduct();
return new ResultBean<>(products);
}
/**
* 查找最新商品
*
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping("/new.do")
public ResultBean> getNewProduct(int pageNo, int pageSize) {
Pageable pageable = new PageRequest(pageNo, pageSize);
List products = productService.findNewProduct(pageable);
return new ResultBean<>(products);
}
/**
* 打开分类查看商品页面
*
* @return
*/
@RequestMapping("/category.html")
public String toCatePage(int cid, Map map) {
Classification classification = classificationService.findById(cid);
map.put("category", classification);
return "mall/product/category";
}
@RequestMapping("/toCart.html")
public String toCart(){
return "mall/product/cart";
}
/**
* 按一级分类查找商品
*
* @param cid
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping("/category.do")
public ResultBean> getCategoryProduct(int cid, int pageNo, int pageSize) {
Pageable pageable = new PageRequest(pageNo, pageSize);
List products = productService.findByCid(cid, pageable);
return new ResultBean<>(products);
}
/**
* 按二级分类查找商品
*
* @param csId
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping("/categorySec.do")
public ResultBean> getCategorySecProduct(int csId, int pageNo, int pageSize) {
Pageable pageable = new PageRequest(pageNo, pageSize);
List products = productService.findByCsid(csId, pageable);
return new ResultBean<>(products);
}
/**
* 根据一级分类查询它所有的二级分类
* @param cid
* @return
*/
@ResponseBody
@RequestMapping("/getCategorySec.do")
public ResultBean> getCategorySec(int cid){
List list = classificationService.findByParentId(cid);
return new ResultBean<>(list);
}
/**
* 加购物车
*
* @param productId
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/addCart.do")
public ResultBean addToCart(int productId, HttpServletRequest request) throws Exception {
shopCartService.addCart(productId, request);
return new ResultBean<>(true);
}
/**
* 移除购物车
*
* @param productId
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/delCart.do")
public ResultBean delToCart(int productId, HttpServletRequest request) throws Exception {
shopCartService.remove(productId, request);
return new ResultBean<>(true);
}
/**
* 查看购物车商品
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/listCart.do")
public ResultBean> listCart(HttpServletRequest request) throws Exception {
List orderItems = shopCartService.listCart(request);
return new ResultBean<>(orderItems);
}
}
源码获取:博客首页 "资源" 里下载!