src/com/shop/controller/admin/GoodController.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.shop.controller.admin;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.asm.commons.Method;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import com.shop.dao.OsCategoryMapper;
import com.shop.dao.OsProductMapper;
import com.shop.po.OsCategory;
import com.shop.po.OsProduct;
import com.shop.po.OsProductCategory;
import com.shop.service.OsProductCartService;
import com.shop.util.MyUpload;
@Controller
@RequestMapping("/admin/good/")
public class GoodController extends BaseController {
@Autowired
OsProductMapper dao;
@Autowired
OsCategoryMapper dao1;
@RequestMapping("list")
public String list(HttpServletRequest request)
{
List list=dao.selectAll();
request.setAttribute("list", list);
return "/admin/good/list";
}
@RequestMapping("add")
public String add(HttpServletRequest request){
List types=dao.getAllCategory();
request.setAttribute("types", types);
return "/admin/good/add";
}
@RequestMapping(value="add",method=RequestMethod.POST)
public String add(HttpServletRequest request,OsProduct p,MultipartFile img)
{
if(img!=null && !img.isEmpty()){
String path = "./uploads/";
String path1 = request.getSession().getServletContext().getRealPath(path);
String filename=MyUpload.doUpload(img, path1, path);
p.setPicImg(filename);
}
后面还有 74 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。