-
大小: 738KB文件類型: .zip金幣: 2下載: 1 次發(fā)布日期: 2021-06-02
- 語言: 數(shù)據(jù)庫
- 標(biāo)簽: ssm??
資源簡介
完美的ssm腳手架,數(shù)據(jù)庫mysql內(nèi)帶sql腳本,注解清晰適合學(xué)習(xí)開發(fā)

代碼片段和文件信息
package?com.gert.ssmall.controllers;
import?java.io.File;
import?java.util.UUID;
import?javax.annotation.Resource;
import?javax.servlet.http.HttpServletRequest;
import?javax.validation.Valid;
import?org.springframework.stereotype.Controller;
import?org.springframework.ui.Model;
import?org.springframework.validation.BindingResult;
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.mvc.support.RedirectAttributes;
import?com.gert.ssmall.entities.Goods;
import?com.gert.ssmall.services.GoodsService;
@Controller
@RequestMapping(“/goods“)
public?class?GoodsController?{
????
????@Resource
????GoodsService?goodsService;
????
????/*
?????*?產(chǎn)品列表與分頁Action
?????*/
????@RequestMapping(“/list“)
????public?String?list(Model?model@RequestParam(required=falsedefaultValue=“1“)?int?pageNO){
????????int?size=5;
????????model.addAttribute(“size“size);
????????model.addAttribute(“pageNO“pageNO);
????????model.addAttribute(“count“goodsService.getGoodsCount());
????????model.addAttribute(“goods“?goodsService.getGoodsPager(pageNO?size));
????????return?“goods/list“;
????}
????
????/*
?????*?刪除單個(gè)產(chǎn)品對象Action
?????*/
????@RequestMapping(“/delete/{id}“)
????public?String?delete(Model?model@PathVariable?int?id@RequestParam(required=falsedefaultValue=“1“)?int?pageNORedirectAttributes?redirectAttributes){
????????if(goodsService.delete(id)>0)
????????{
????????????redirectAttributes.addFlashAttribute(“message“?“刪除成功!“);
????????}else{
????????????redirectAttributes.addFlashAttribute(“message“?“刪除失?。 埃?
????????}
????????return?“redirect:/goods/list?pageNO=“+pageNO;
????}
????
????/*
?????*?刪除多個(gè)產(chǎn)品對象Action
?????*/
????@RequestMapping(“/deletes“)
????public?String?deletes(Model?model@RequestParam?int[]?id@RequestParam(required=falsedefaultValue=“1“)?int?pageNORedirectAttributes?redirectAttributes){
????????//執(zhí)行刪除
????????int?rows=goodsService.deletes(id);
????????if(rows>0)
????????{
????????????redirectAttributes.addFlashAttribute(“message“?“刪除“+rows+“行記錄成功!“);
????????}else{
????????????redirectAttributes.addFlashAttribute(“message“?“刪除失?。 埃?
????????}
????????return?“redirect:/goods/list?pageNO=“+pageNO;
????}
????
????/*
?????*?添加商品
?????*/
????@RequestMapping(“/add“)
????public?String?add(Model?model){
????????model.addAttribute(“entity“?new?Goods());
????????return?“goods/add“;
????}
????
????/*
?????*?添加商品保存
?????*/
????@RequestMapping(“/addSave“)
????public?String?addSave(Model?model@ModelAttribute(“entity“)?@Valid?Goods?entityBindingResult?bindingResult){
????????//如果模型中存在錯(cuò)誤
????????if(!bindingResult.hasErrors()){
????????????if(goodsService.insert(entity)>0)
????????????{
?????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????1132??2019-04-17?17:52??goods.sql
?????文件????????1660??2019-04-16?17:08??SSMall\.classpath
?????文件????????1082??2019-04-16?17:04??SSMall\.project
?????文件?????????639??2019-04-16?17:04??SSMall\.settings\.jsdtscope
?????文件??????????97??2019-04-17?09:18??SSMall\.settings\org.eclipse.core.resources.prefs
?????文件?????????478??2019-04-16?17:08??SSMall\.settings\org.eclipse.jdt.core.prefs
?????文件??????????90??2019-04-16?17:04??SSMall\.settings\org.eclipse.m2e.core.prefs
?????文件?????????575??2019-04-16?17:09??SSMall\.settings\org.eclipse.wst.common.component
?????文件?????????252??2019-04-16?17:08??SSMall\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2019-04-16?17:04??SSMall\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2019-04-16?17:04??SSMall\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件??????????50??2019-04-16?17:04??SSMall\.settings\org.eclipse.wst.validation.prefs
?????文件????????4983??2019-04-16?17:22??SSMall\pom.xm
?????文件????????5481??2019-04-17?09:35??SSMall\src\main\java\com\gert\ssmall\controllers\GoodsController.java
?????文件????????1467??2019-04-16?17:30??SSMall\src\main\java\com\gert\ssmall\entities\Goods.java
?????文件?????????625??2019-04-16?17:37??SSMall\src\main\java\com\gert\ssmall\mapper\GoodsDAO.java
?????文件????????1167??2019-04-16?17:51??SSMall\src\main\java\com\gert\ssmall\mapper\GoodsMapper.xm
?????文件?????????490??2019-04-16?18:07??SSMall\src\main\java\com\gert\ssmall\services\GoodsService.java
?????文件????????1231??2019-04-16?18:08??SSMall\src\main\java\com\gert\ssmall\services\GoodsServiceImpl.java
?????文件?????????959??2019-04-16?17:38??SSMall\src\main\java\com\gert\ssmall\test\MyBatisUtil.java
?????文件????????2272??2019-04-16?18:00??SSMall\src\main\java\com\gert\ssmall\test\TestGoods.java
?????文件????????3836??2019-04-16?18:04??SSMall\src\main\resources\applicationContext.xm
?????文件?????????219??2019-04-16?18:01??SSMall\src\main\resources\jdbc.properties
?????文件????????1927??2019-04-16?18:05??SSMall\src\main\resources\MyBatisCfg.xm
?????文件????????5393??2019-04-17?08:53??SSMall\src\main\resources\springmvc-servlet.xm
?????文件??????????72??2019-04-17?09:34??SSMall\src\main\resources\ValidationMessages.properties
?????文件???????44139??2019-04-16?19:10??SSMall\src\main\webapp\images\default.jpg
?????文件???????14204??2019-04-16?19:10??SSMall\src\main\webapp\images\pic(1).jpg
?????文件???????10093??2019-04-16?19:10??SSMall\src\main\webapp\images\pic(14).jpg
?????文件???????12305??2019-04-16?19:10??SSMall\src\main\webapp\images\pic(2).jpg
?????文件???????16665??2019-04-16?19:10??SSMall\src\main\webapp\images\pic(3).jpg
............此處省略42個(gè)文件信息
評論
共有 條評論