• 大小:
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-12-12
  • 语言: 其他
  • 标签: Spring  SSM  MVC  MyBatis  Vue  

资源简介

使用SSM开发商城项目

资源截图

代码片段和文件信息

package com.gqz.shop.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageInfo;
import com.gqz.shop.pojo.Adminuser;
import com.gqz.shop.service.AdminuserService;
import com.gqz.shop.util.MyException;

/**
 * 知识点【@RequestMapping】 //使用RequestMapping注解 在类名前添加统一路径
 * 配置@RequestMapping时可省略后缀(.htm)注意访问的时候不能省略
 */
@Controller
@RequestMapping(“/admin“)
public class AdminuserController {
@Autowired
private AdminuserService adminuserService;

// 后台登录
@RequestMapping(“/login“)
public String login(Adminuser adminuser HttpSession session) {
Adminuser admin = adminuserService.login(adminuser.getUsername()adminuser.getPassword());
if (admin != null) {
session.setAttribute(“adminuser“ admin);
return “index“;
}
return “login“;
}

// 根据用户名和管理员类型进行迷糊查询
@RequestMapping(“/selectAdminuserByTerm“)
public ModelAndView selectAdminuserByTerm(Adminuser adminuser) {
List list = adminuserService.selectAdminuserByTerm(adminuser);
ModelAndView modelAndView = new ModelAndView();
if (list == null || list.size() == 0) {
modelAndView.addobject(“msg“ “没有查询结果请更换查询条件!“);
} else {
modelAndView.addobject(“adminlist“ list);
}
modelAndView.setViewName(“admin_list“);
return modelAndView;
}

@RequestMapping(“/adminlist“)
public ModelAndView adminlist() throws MyException {
// 模拟异常 测试自定义异常处理器
// List list=new ArrayList();
// if (list==null||list.size()==0) {
// throw new MyException(“管理员列表为空,请稍后再试!!“);
// }
// 模拟异常 之 未知异常
// int i=1/0;
List list = adminuserService.getAdminUserList();
ModelAndView modelAndView = new ModelAndView();
modelAndView.addobject(“adminlist“ list);
// modelAndView.setViewName(“/admin/admin_list.jsp“);
modelAndView.setViewName(“admin_list“);
return modelAndView;
}

// 通过分页查询管理员列表
@RequestMapping(“/adminListByPage“)
@ResponseBody()
public PageInfo adminListByPage(int page int pageSize) {
return adminuserService.getAdminListByPage(page pageSize);
}

// 使用RESTful风格
@RequestMapping(“/adminEdit/{uid}“)
public ModelAndView adminEdit(@PathVariable() Integer uid) {
// 访问services
Adminuser admin = adminuserService.getAdminuserById(uid);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addobject(“admin“ admin);
modelAndView.setViewName(“/admin/edit_admin“);
return modelAndView;
}

// 修改
@RequestMapping(“adminModify“)
public String adminModify(Adminuser

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-07 15:48  SSM项目+shop\
     文件         119  2018-04-10 21:40  SSM项目+shop\ForFuture.url
     目录           0  2018-06-07 15:43  SSM项目+shop\shop\
     文件      294043  2018-06-06 18:03  SSM项目+shop\shop.sql
     目录           0  2018-06-07 15:46  SSM项目+shop\ShopFile\
     目录           0  2018-06-07 15:46  SSM项目+shop\ShopFile\upload\
     文件        5797  2018-05-03 15:02  SSM项目+shop\ShopFile\upload\0.jpg
     文件      573676  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\006577ba66504a5d93ef30e4016dd5a6.png
     文件      596644  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\045888ae4cfa479ab73b34f3d0c1ea05.png
     文件      596644  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\046704786a6a4e2e8387fbd76242ef03.png
     文件      180208  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\046b2a47b4b3455fa7db77e8d5cbfcfe.png
     文件       31478  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\057903c896894e9cb178b391252a05b8.jpg
     文件      596644  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\07f0a41a146145799334dd900cc32a4f.png
     文件        1727  2018-05-13 19:36  SSM项目+shop\ShopFile\upload\0a109e85263241b39731858990d56c34.jpg
     文件       85539  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\0a40ecf7df34429783ff48b999283f13.jpg
     文件       89257  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\0bc332371463443ea48778d3839e1610.png
     文件       11239  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\0c39fd70aa2542abb4aad8efa7b65434.jpg
     文件        1430  2018-05-08 11:30  SSM项目+shop\ShopFile\upload\0cdce97e3ab74bd2ae0110a52f52795d.mVXa_!!0-item_pic.jpg_60x60q90.jpg
     文件       59240  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\0dbd6bb877634dd7aefb946e196ceb62.png
     文件        6769  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\0f76c6af9032491e9235d992ed0bc2e2.jpg
     文件      145795  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\1.jpg
     文件      122378  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\113a0b44602a4bf1a4f7a275939f8b29.png
     文件        2578  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\124013d4da0348298ea69faa9b8e6083.jpg
     文件      300101  2018-05-11 14:57  SSM项目+shop\ShopFile\upload\1499e1d6f7b44ecd8909af393506d3a1.jpg
     文件        4880  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\14a3eb69147f4d06ad97c9b715711b05.jpg
     文件      179121  2018-05-11 14:55  SSM项目+shop\ShopFile\upload\162084b875a7416496ed827255a34dee.jpg
     文件        2247  2018-05-04 16:07  SSM项目+shop\ShopFile\upload\18e148a0fd9e47439c8668a1fb12af87.jpg
     文件      470318  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\1a1a9eebff494a8d9a9a97f50a8a22ae.png
     文件      598258  2018-03-13 09:19  SSM项目+shop\ShopFile\upload\1acba502cd414f72a752c2877eed9881.png
     文件       51573  2018-05-13 19:36  SSM项目+shop\ShopFile\upload\1ebaf6eba868473b8cc575315c365f5e.jpg
     文件      212417  2018-03-13 09:18  SSM项目+shop\ShopFile\upload\1f21a183ff034de798c2363da5bf367a.png
............此处省略1464个文件信息

评论

共有 条评论