• 大小: 15.98MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-26
  • 语言: 其他
  • 标签: ssm  

资源简介

简易的网上拍卖系统,有基本的增删改查,后台添加拍卖商品,修改等等,前台可以竞拍商品

资源截图

代码片段和文件信息

package cn.web.auction.controller;

import java.io.File;
import java.io.IOException;
import java.util.Date;
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.ModelAttribute;
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.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mysql.jdbc.PingTarget;

import cn.web.auction.pojo.Auction;
import cn.web.auction.pojo.Auctionrecord;
import cn.web.auction.pojo.Auctionuser;
import cn.web.auction.service.AuctionService;

@Controller
@RequestMapping(“/auction“)
public class AuctionController {

private static final int PAGE_SIZE = 5;

@Autowired
private AuctionService auctionService;

@RequestMapping(“/queryAuctions“)
public ModelAndView queryAuctions(
@ModelAttribute(“condition“) Auction condition
@RequestParam(value=“pageNo“required=falsedefaultValue=“1“) int pageNo) {
//pageNo 页码  pageSize 每页记录数
PageHelper.startPage(pageNoPAGE_SIZE);
List list = auctionService.findAuctions(condition);

//创建pageInfo对象,分页bean
PageInfo pageInfo = new PageInfo<>(list);

ModelAndView mv = new ModelAndView();
mv.addobject(“auctionList“ list);
mv.addobject(“pageInfo“ pageInfo);
mv.setViewName(“index“);
return mv;

}

@RequestMapping(“/doLogout“)
public String doLogout(HttpSession session) {
session.invalidate();
return “login“;
}

@RequestMapping(“/publishAuctions“)
public String publishAuctions(Auction auctionMultipartFile picHttpSession session) {
try {
if(pic.getSize() > 0) {//判断是否有上传的文件
//1.上传商品图片
//pic(二进制文件数据)--->Tomcat目录:D:\\eclipse2017-workspace\\MyAuction\\WebRoot\\upload
//获取upload目录在Tomcat的绝对路径
String path = session.getServletContext().getRealPath(“upload“);
System.out.println(path);

File tagetFile = new File(pathpic.getOriginalFilename());
pic.transferTo(tagetFile);
//把文件的名称和类型设置到pojo中
auction.setAuctionpic(pic.getOriginalFilename());
auction.setAuctionpictype(pic.getContentType());
}
//2.保存商品的文本信息到db
auctionService.addAuction(auction);
} catch (IOException e) {
e.printStackTrace();
}
return “redirect:/auction/queryAuctions“;
}

//根据商品的id查询商品的详情,跳转到updateAuction.jsp
@RequestMapping(“/toUpdate/{auctionid}“)
public ModelAndView toUpdate(@PathVariable int auctionid) {
ModelAndView mv = new ModelAndView();
Auction auction = auctionService.findAuctionById(auctionid);
mv.addobject(“auction“auction);
mv.setViewName(“updateAuction“);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        889  2018-07-03 10:09  MyAuction\.classpath

     文件        909  2018-07-03 10:02  MyAuction\.project

     文件        564  2018-07-03 10:02  MyAuction\.settings\.jsdtscope

     文件        364  2018-07-03 10:02  MyAuction\.settings\org.eclipse.jdt.core.prefs

     文件        563  2018-07-03 10:09  MyAuction\.settings\org.eclipse.wst.common.component

     文件        345  2018-07-03 10:02  MyAuction\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-07-03 10:02  MyAuction\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-07-03 10:02  MyAuction\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件        160  2018-07-03 10:15  MyAuction\config\db.properties

     文件        421  2018-07-03 10:09  MyAuction\config\log4j.properties

     文件        752  2018-07-03 16:04  MyAuction\config\mybatis\SqlMapConfig.xml

     文件       2003  2018-07-03 10:13  MyAuction\config\spring\applicationContext-dao.xml

     文件       1077  2018-07-03 10:34  MyAuction\config\spring\applicationContext-service.xml

     文件       2187  2018-07-03 10:34  MyAuction\config\spring\applicationContext-tx.xml

     文件       2535  2018-07-07 11:10  MyAuction\config\spring\springmvc.xml

     文件       5029  2018-07-07 14:35  MyAuction\src\cn\web\auction\controller\AuctionController.java

     文件       1248  2018-07-03 16:39  MyAuction\src\cn\web\auction\controller\UserController.java

     文件        184  2018-07-07 09:48  MyAuction\src\cn\web\auction\mapper\AuctionCustomMapper.java

     文件       2389  2018-07-07 10:09  MyAuction\src\cn\web\auction\mapper\AuctionCustomMapper.xml

     文件        885  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionMapper.java

     文件      11307  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionMapper.xml

     文件        967  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionrecordMapper.java

     文件       8164  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionrecordMapper.xml

     文件        943  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionuserMapper.java

     文件      11549  2018-07-03 10:36  MyAuction\src\cn\web\auction\mapper\AuctionuserMapper.xml

     文件       2568  2018-07-07 10:02  MyAuction\src\cn\web\auction\pojo\Auction.java

     文件      27341  2018-07-03 21:03  MyAuction\src\cn\web\auction\pojo\AuctionExample.java

     文件       1223  2018-07-07 09:07  MyAuction\src\cn\web\auction\pojo\Auctionrecord.java

     文件      15980  2018-07-03 10:36  MyAuction\src\cn\web\auction\pojo\AuctionrecordExample.java

     文件       2436  2018-07-03 10:36  MyAuction\src\cn\web\auction\pojo\Auctionuser.java

............此处省略149个文件信息

评论

共有 条评论