|
@@ -1,7 +1,14 @@
|
|
|
package com.caimei365.manager.controller.caimei.page;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.caimei365.manager.entity.PaginationVo;
|
|
|
+import com.caimei365.manager.entity.ResponseJson;
|
|
|
+import com.caimei365.manager.entity.caimei.page.NewPageZone;
|
|
|
+import com.caimei365.manager.entity.caimei.page.NewPageZoneImage;
|
|
|
+import com.caimei365.manager.entity.caimei.product.Product;
|
|
|
+import com.caimei365.manager.service.caimei.page.NewPageZoneService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 网页管理接口
|
|
@@ -10,5 +17,119 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/page")
|
|
|
public class WebPageApi {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private NewPageZoneService newPageZoneService;
|
|
|
+
|
|
|
+ @GetMapping("/zoneList")
|
|
|
+ public ResponseJson<PaginationVo<NewPageZone>> pageZoneList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
+ return newPageZoneService.getZoneList(pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/saveZone")
|
|
|
+ public ResponseJson saveZone(NewPageZone pageZone) {
|
|
|
+ return newPageZoneService.saveZone(pageZone);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/delZone")
|
|
|
+ public ResponseJson delZone(Integer id) {
|
|
|
+ return newPageZoneService.delZone(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param id
|
|
|
+ * @param status 0停用 1启用
|
|
|
+ * @param type 0www 1小程序
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/updateEnabledStatus")
|
|
|
+ public ResponseJson updateEnabledStatus(Integer id, Integer status, Integer type) {
|
|
|
+ return newPageZoneService.updateEnabledStatus(id, status, type);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/updateSort")
|
|
|
+ public ResponseJson updateSort(Integer id, Integer sort) {
|
|
|
+ if (null == id) {
|
|
|
+ return ResponseJson.error(-1, "专区id不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == sort) {
|
|
|
+ return ResponseJson.error(-1, "排序值不能为空", null);
|
|
|
+ }
|
|
|
+ return newPageZoneService.updateSort(id, sort);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专区商品列表
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/zoneProductList")
|
|
|
+ public ResponseJson<PaginationVo<Product>> pageZoneProductList(Integer id,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
+ return newPageZoneService.getZoneProductList(id, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/delZoneProduct")
|
|
|
+ public ResponseJson delZoneProduct(Integer id, String ids) {
|
|
|
+ return newPageZoneService.delZoneProduct(id, ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/addZoneProduct")
|
|
|
+ public ResponseJson addZoneProduct(Integer id, String ids) {
|
|
|
+ return newPageZoneService.addZoneProduct(id, ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/updateProductSort")
|
|
|
+ public ResponseJson updateProductSort(Integer id, Integer productId, Integer sort) {
|
|
|
+ if (null == id) {
|
|
|
+ return ResponseJson.error(-1, "专区id不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == productId) {
|
|
|
+ return ResponseJson.error(-1, "商品id不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == sort) {
|
|
|
+ return ResponseJson.error(-1, "排序值不能为空", null);
|
|
|
+ }
|
|
|
+ return newPageZoneService.updateProductSort(id, productId, sort);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专区轮播图
|
|
|
+ * @param id
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/zoneImageList")
|
|
|
+ public ResponseJson<PaginationVo<NewPageZoneImage>> pageZoneImageList(Integer id,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
+ return newPageZoneService.getZoneImageList(id, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/saveZoneImage")
|
|
|
+ public ResponseJson saveZoneImage(NewPageZoneImage pageZoneImage) {
|
|
|
+ return newPageZoneService.saveZoneImage(pageZoneImage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/delZoneImage")
|
|
|
+ public ResponseJson delZoneImage(Integer imageId) {
|
|
|
+ return newPageZoneService.delZoneImage(imageId);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ @GetMapping("/updateImageSort")
|
|
|
+ public ResponseJson updateImageSort(Integer imageId, Integer sort) {
|
|
|
+ if (null == imageId) {
|
|
|
+ return ResponseJson.error(-1, "id不能为空", null);
|
|
|
+ }
|
|
|
+ if (null == sort) {
|
|
|
+ return ResponseJson.error(-1, "排序值不能为空", null);
|
|
|
+ }
|
|
|
+ return newPageZoneService.updateImageSort(imageId, sort);
|
|
|
+ }
|
|
|
}
|