|
@@ -45,13 +45,14 @@ public class ProductController {
|
|
|
|
|
|
@Autowired
|
|
|
private Classify01enService classify01enService;
|
|
|
+
|
|
|
//查找所有的商品
|
|
|
@RequestMapping("admin/product_list.html")
|
|
|
public String productList(Model model, String name, String minDate, String maxDate,
|
|
|
- @RequestParam(value="cid",defaultValue="0")Integer cid,
|
|
|
- @RequestParam(value="wid",defaultValue="0")Integer wid,
|
|
|
- @RequestParam(value="page",defaultValue="1")Integer page,
|
|
|
- @RequestParam(value="rows",defaultValue = "10") Integer rows){
|
|
|
+ @RequestParam(value = "cid", defaultValue = "0") Integer cid,
|
|
|
+ @RequestParam(value = "wid", defaultValue = "0") Integer wid,
|
|
|
+ @RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
|
+ @RequestParam(value = "rows", defaultValue = "10") Integer rows) {
|
|
|
List<Product> list;
|
|
|
PageHelper.startPage(page, rows);
|
|
|
list = productService.findProductByPid(cid, wid, name, minDate, maxDate);
|
|
@@ -73,10 +74,10 @@ public class ProductController {
|
|
|
//查找所有的商品
|
|
|
@RequestMapping("admin/product_list_en.html")
|
|
|
public String productListEn(Model model, String name, String minDate, String maxDate,
|
|
|
- @RequestParam(value="cid",defaultValue="0")Integer cid,
|
|
|
- @RequestParam(value="wid",defaultValue="0")Integer wid,
|
|
|
- @RequestParam(value="page",defaultValue="1")Integer page,
|
|
|
- @RequestParam(value="rows",defaultValue = "10") Integer rows,HttpServletRequest request){
|
|
|
+ @RequestParam(value = "cid", defaultValue = "0") Integer cid,
|
|
|
+ @RequestParam(value = "wid", defaultValue = "0") Integer wid,
|
|
|
+ @RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
|
+ @RequestParam(value = "rows", defaultValue = "10") Integer rows, HttpServletRequest request) {
|
|
|
List<Producten> listen;
|
|
|
PageHelper.startPage(page, rows);
|
|
|
listen = productenService.findProductByPid(cid, wid, name, minDate, maxDate);
|
|
@@ -95,10 +96,23 @@ public class ProductController {
|
|
|
return "adminEn/product_list";
|
|
|
}
|
|
|
|
|
|
+ //提交更新的商品
|
|
|
+ @RequestMapping("admin/submit_upProduct.html")
|
|
|
+ public String submitUpProduct(HttpServletRequest request, Product product) {
|
|
|
+ String rootPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
+ String contextPath = request.getSession().getServletContext().getContextPath();
|
|
|
+ BaseState state = (BaseState) new ActionEnter(request, rootPath, contextPath, "img").invoke(ActionMap.UPLOAD_FILE);
|
|
|
+ String url = state.getInfo("url");
|
|
|
+ product.setImg(url);
|
|
|
+ productService.updateNotNull(product);
|
|
|
+ return "redirect: product_list.html?wid=" + product.getWid() + "&cid=" + product.getCid();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//根据商品id删除商品
|
|
|
- @RequestMapping(value = "/admin/delete_product.html",method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/admin/delete_product.html", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public String deleteProduct(Integer pid){
|
|
|
+ public String deleteProduct(Integer pid) {
|
|
|
int num = productService.delete(pid);
|
|
|
if (num > 0) {
|
|
|
return "ok";
|
|
@@ -108,9 +122,9 @@ public class ProductController {
|
|
|
}
|
|
|
|
|
|
//根据商品id删除商品
|
|
|
- @RequestMapping(value = "/admin/delete_product_en.html",method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/admin/delete_product_en.html", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public String deleteProductEn(Integer pid){
|
|
|
+ public String deleteProductEn(Integer pid) {
|
|
|
int num = productenService.delete(pid);
|
|
|
if (num > 0) {
|
|
|
return "ok";
|
|
@@ -121,7 +135,7 @@ public class ProductController {
|
|
|
|
|
|
//新增某一个二级分类下的商品
|
|
|
@RequestMapping("admin/add_product.html")
|
|
|
- public String addProduct(Model model){
|
|
|
+ public String addProduct(Model model) {
|
|
|
List<Classify01> list01 = classify01Service.findAllClass01();
|
|
|
model.addAttribute("list01", list01);
|
|
|
return "admin/add_product";
|
|
@@ -129,7 +143,7 @@ public class ProductController {
|
|
|
|
|
|
//新增某一个二级分类下的商品
|
|
|
@RequestMapping("admin/add_product_en.html")
|
|
|
- public String addProductEn(Model model){
|
|
|
+ public String addProductEn(Model model) {
|
|
|
List<Classify01en> list01en = classify01enService.findAllClass01();
|
|
|
model.addAttribute("list01", list01en);
|
|
|
return "adminEn/add_product";
|
|
@@ -137,7 +151,7 @@ public class ProductController {
|
|
|
|
|
|
//提交新增的商品
|
|
|
@RequestMapping("admin/submit_addProduct.html")
|
|
|
- public String submitAddProduct(HttpServletRequest request, Product product){
|
|
|
+ public String submitAddProduct(HttpServletRequest request, Product product) {
|
|
|
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
String contextPath = request.getSession().getServletContext().getContextPath();
|
|
|
BaseState state = (BaseState) new ActionEnter(request, rootPath, contextPath, "img").invoke(ActionMap.UPLOAD_FILE);
|
|
@@ -149,7 +163,7 @@ public class ProductController {
|
|
|
|
|
|
//提交新增的商品
|
|
|
@RequestMapping("admin/submit_addProduct_en.html")
|
|
|
- public String submitAddProductEn(HttpServletRequest request,Producten producten){
|
|
|
+ public String submitAddProductEn(HttpServletRequest request, Producten producten) {
|
|
|
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
String contextPath = request.getSession().getServletContext().getContextPath();
|
|
|
BaseState state = (BaseState) new ActionEnter(request, rootPath, contextPath, "img").invoke(ActionMap.UPLOAD_FILE);
|
|
@@ -161,7 +175,7 @@ public class ProductController {
|
|
|
|
|
|
//根据id更新某一个二级分类下的商品
|
|
|
@RequestMapping("admin/update_product.html")
|
|
|
- public String updateProduct(Integer pid,Model model){
|
|
|
+ public String updateProduct(Integer pid, Model model) {
|
|
|
Product product = productService.selectByKey(pid);
|
|
|
List<Classify01> list01 = classify01Service.findAllClass01();
|
|
|
List<Classify02> list02 = classify02Service.findClassByCid(product.getCid());//通过一级id查找二级分类集合
|
|
@@ -173,7 +187,7 @@ public class ProductController {
|
|
|
|
|
|
//根据id更新某一个二级分类下的商品
|
|
|
@RequestMapping("admin/update_product_en.html")
|
|
|
- public String updateProductEn(Integer pid,Model model){
|
|
|
+ public String updateProductEn(Integer pid, Model model) {
|
|
|
Producten producten = productenService.selectByKey(pid);
|
|
|
List<Classify01en> list01en = classify01enService.findAllClass01();
|
|
|
List<Classify02en> list02en = classify02enService.findClassByCid(producten.getCid());//通过一级id查找二级分类集合
|
|
@@ -183,21 +197,10 @@ public class ProductController {
|
|
|
return "adminEn/update_product";
|
|
|
}
|
|
|
|
|
|
- //提交更新的商品
|
|
|
- @RequestMapping("admin/submit_upProduct.html")
|
|
|
- public String submitUpProduct(HttpServletRequest request, Product product){
|
|
|
- String rootPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
- String contextPath = request.getSession().getServletContext().getContextPath();
|
|
|
- BaseState state = (BaseState) new ActionEnter(request, rootPath, contextPath, "img").invoke(ActionMap.UPLOAD_FILE);
|
|
|
- String url = state.getInfo("url");
|
|
|
- product.setImg(url);
|
|
|
- productService.updateNotNull(product);
|
|
|
- return "redirect: product_list.html";
|
|
|
- }
|
|
|
|
|
|
//提交更新的商品
|
|
|
@RequestMapping("admin/submit_upProduct_en.html")
|
|
|
- public String submitUpProductEn(HttpServletRequest request,Producten producten){
|
|
|
+ public String submitUpProductEn(HttpServletRequest request, Producten producten) {
|
|
|
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
String contextPath = request.getSession().getServletContext().getContextPath();
|
|
|
BaseState state = (BaseState) new ActionEnter(request, rootPath, contextPath, "img").invoke(ActionMap.UPLOAD_FILE);
|
|
@@ -209,7 +212,7 @@ public class ProductController {
|
|
|
|
|
|
/*执行批量删除*/
|
|
|
@RequestMapping("admin/delete_ProList.html")
|
|
|
- public String deleteProList(String checkValue){
|
|
|
+ public String deleteProList(String checkValue) {
|
|
|
String[] skt = checkValue.split(",");
|
|
|
for (int i = 0; i < skt.length; i++) {
|
|
|
productService.delete(Integer.parseInt(skt[i]));
|
|
@@ -219,7 +222,7 @@ public class ProductController {
|
|
|
|
|
|
/*执行批量删除*/
|
|
|
@RequestMapping("admin/delete_ProList_en.html")
|
|
|
- public String deleteProListEn(String checkValue){
|
|
|
+ public String deleteProListEn(String checkValue) {
|
|
|
String[] skt = checkValue.split(",");
|
|
|
for (int i = 0; i < skt.length; i++) {
|
|
|
productenService.delete(Integer.parseInt(skt[i]));
|