diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeCategoryController.java b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeCategoryController.java new file mode 100644 index 0000000..554e86b --- /dev/null +++ b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeCategoryController.java @@ -0,0 +1,84 @@ +package com.macro.mall.controller; + +import com.macro.mall.dto.CommonResult; +import com.macro.mall.dto.PmsProductAttributeCategoryItem; +import com.macro.mall.model.PmsProductAttributeCategory; +import com.macro.mall.service.PmsProductAttributeCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * ƷԷController + */ +@Controller +@Api(tags = "PmsProductAttributeCategoryController", description = "ƷԷ") +@RequestMapping("/productAttribute/category") +public class PmsProductAttributeCategoryController { + @Autowired + private PmsProductAttributeCategoryService productAttributeCategoryService; + + @ApiOperation("ƷԷ") + @RequestMapping(value = "/create", method = RequestMethod.POST) + @ResponseBody + public Object create(@RequestParam String name) { + int count = productAttributeCategoryService.create(name); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸ƷԷ") + @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) + @ResponseBody + public Object update(@PathVariable Long id, @RequestParam String name) { + int count = productAttributeCategoryService.update(id, name); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ɾƷԷ") + @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) + @ResponseBody + public Object delete(@PathVariable Long id) { + int count = productAttributeCategoryService.delete(id); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ȡƷԷϢ") + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + public Object getItem(@PathVariable Long id) { + PmsProductAttributeCategory productAttributeCategory = productAttributeCategoryService.getItem(id); + return new CommonResult().success(productAttributeCategory); + } + + @ApiOperation("ҳȡƷԷ") + @RequestMapping(value = "/list", method = RequestMethod.GET) + @ResponseBody + public Object getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) { + List productAttributeCategoryList = productAttributeCategoryService.getList(pageSize, pageNum); + return new CommonResult().pageSuccess(productAttributeCategoryList); + } + + @ApiOperation("ȡƷԷ༰") + @RequestMapping(value = "/list/withAttr", method = RequestMethod.GET) + @ResponseBody + public Object getListWithAttr() { + List productAttributeCategoryResultList = productAttributeCategoryService.getListWithAttr(); + return new CommonResult().success(productAttributeCategoryResultList); + } +} diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeController.java b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeController.java new file mode 100644 index 0000000..a348a81 --- /dev/null +++ b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductAttributeController.java @@ -0,0 +1,94 @@ +package com.macro.mall.controller; + +import com.macro.mall.dto.CommonResult; +import com.macro.mall.dto.PmsProductAttributeParam; +import com.macro.mall.dto.ProductAttrInfo; +import com.macro.mall.model.PmsProductAttribute; +import com.macro.mall.service.PmsProductAttributeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * ƷԹController + */ +@Controller +@Api(tags = "PmsProductAttributeController", description = "ƷԹ") +@RequestMapping("/productAttribute") +public class PmsProductAttributeController { + @Autowired + private PmsProductAttributeService productAttributeService;//ƷԷ + + @ApiOperation("ݷѯбб") + @ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0ʾԣ1ʾ", required = true, paramType = "query", dataType = "integer")}) + @RequestMapping(value = "/list/{cid}", method = RequestMethod.GET) + @ResponseBody + public Object getList(@PathVariable Long cid, + @RequestParam(value = "type") Integer type, + @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {//ȡб + List productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum); + return new CommonResult().pageSuccess(productAttributeList); + } + + @ApiOperation("ƷϢ") + @RequestMapping(value = "/create", method = RequestMethod.POST) + @ResponseBody + public Object create(@RequestBody PmsProductAttributeParam productAttributeParam, BindingResult bindingResult) { + int count = productAttributeService.create(productAttributeParam);//ƷԷ + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸ƷϢ") + @RequestMapping(value = "/update/{id}",method = RequestMethod.POST) + @ResponseBody + public Object update(@PathVariable Long id,@RequestBody PmsProductAttributeParam productAttributeParam,BindingResult bindingResult){// + int count = productAttributeService.update(id,productAttributeParam); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ѯƷ") + @RequestMapping(value = "/{id}",method = RequestMethod.GET) + @ResponseBody + public Object getItem(@PathVariable Long id){//ȡϢ + PmsProductAttribute productAttribute = productAttributeService.getItem(id); + return new CommonResult().success(productAttribute); + } + + @ApiOperation("ɾƷ") + @RequestMapping(value = "/delete",method = RequestMethod.POST) + @ResponseBody + public Object delete(@RequestParam("ids") List ids){ + int count = productAttributeService.delete(ids); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ƷidȡƷԼԷ") + @RequestMapping(value = "/attrInfo/{productCategoryId}",method = RequestMethod.GET) + @ResponseBody + public Object getAttrInfo(@PathVariable Long productCategoryId){//ȡϢ + List productAttrInfoList = productAttributeService.getProductAttrInfo(productCategoryId); + return new CommonResult().success(productAttrInfoList); + } +} \ No newline at end of file diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductCategoryController.java b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductCategoryController.java new file mode 100644 index 0000000..5ce9b90 --- /dev/null +++ b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductCategoryController.java @@ -0,0 +1,126 @@ +package com.macro.mall.controller; + +import com.macro.mall.dto.CommonResult; +import com.macro.mall.dto.PmsProductCategoryParam; +import com.macro.mall.dto.PmsProductCategoryWithChildrenItem; +import com.macro.mall.model.PmsProductCategory; +import com.macro.mall.service.PmsProductCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * ƷģController + */ +@Controller +@Api(tags = "PmsProductCategoryController", description = "Ʒ") +@RequestMapping("/productCategory") +public class PmsProductCategoryController {//Ʒ + @Autowired + private PmsProductCategoryService productCategoryService;//Ʒ + + @ApiOperation("ӲƷ") + @RequestMapping(value = "/create", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:create')") + public Object create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam, + BindingResult result) { + int count = productCategoryService.create(productCategoryParam); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸Ʒ") + @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:update')") + public Object update(@PathVariable Long id, + @Validated + @RequestBody PmsProductCategoryParam productCategoryParam, + BindingResult result) { + int count = productCategoryService.update(id, productCategoryParam); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ҳѯƷ") + @RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:read')") + public Object getList(@PathVariable Long parentId, + @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { + List productCategoryList = productCategoryService.getList(parentId, pageSize, pageNum); + return new CommonResult().pageSuccess(productCategoryList); + } + + @ApiOperation("idȡƷ") + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:read')") + public Object getItem(@PathVariable Long id) { + PmsProductCategory productCategory = productCategoryService.getItem(id); + return new CommonResult().success(productCategory); + } + + @ApiOperation("ɾƷ") + @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:delete')") + public Object delete(@PathVariable Long id) { + int count = productCategoryService.delete(id); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸ĵʾ״̬") + @RequestMapping(value = "/update/navStatus", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:update')") + public Object updateNavStatus(@RequestParam("ids") List ids, @RequestParam("navStatus") Integer navStatus) { + int count = productCategoryService.updateNavStatus(ids, navStatus); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸ʾ״̬") + @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:update')") + public Object updateShowStatus(@RequestParam("ids") List ids, @RequestParam("showStatus") Integer showStatus) { + int count = productCategoryService.updateShowStatus(ids, showStatus); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ѯһ༰ӷ") + @RequestMapping(value = "/list/withChildren", method = RequestMethod.GET) + @ResponseBody + @PreAuthorize("hasAuthority('pms:productCategory:read')") + public Object listWithChildren() {//Яӷ + List list = productCategoryService.listWithChildren(); + return new CommonResult().success(list); + } +} \ No newline at end of file diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductController.java b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductController.java new file mode 100644 index 0000000..7c90ec6 --- /dev/null +++ b/代码库/mall-admin/src/main/java/com/sock/mall/controller/PmsProductController.java @@ -0,0 +1,153 @@ +package com.macro.mall.controller; + +import com.macro.mall.dto.CommonResult; +import com.macro.mall.dto.PmsProductParam; +import com.macro.mall.dto.PmsProductQueryParam; +import com.macro.mall.dto.PmsProductResult; +import com.macro.mall.model.PmsProduct; +import com.macro.mall.service.PmsProductService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * ƷController + */ +@Controller +@Api(tags = "PmsProductController", description = "Ʒ") +@RequestMapping("/product") +public class PmsProductController { + @Autowired + private PmsProductService productService; + + @ApiOperation("Ʒ") + @RequestMapping(value = "/create", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:create')") + public Object create(@RequestBody PmsProductParam productParam, BindingResult bindingResult) {//ӣƷ + int count = productService.create(productParam);//Ʒ + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ƷidȡƷ༭Ϣ") + @RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)//Ϣ + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:read')") + public Object getUpdateInfo(@PathVariable Long id) { + PmsProductResult productResult = productService.getUpdateInfo(id); + return new CommonResult().success(productResult); + } + + @ApiOperation("Ʒ") + @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:update')") + public Object update(@PathVariable Long id, @RequestBody PmsProductParam productParam, BindingResult bindingResult) { + int count = productService.update(id, productParam); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ѯƷ") + @RequestMapping(value = "/list", method = RequestMethod.GET) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:read')") + public Object getList(PmsProductQueryParam productQueryParam, + @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { + List productList = productService.list(productQueryParam, pageSize, pageNum); + return new CommonResult().pageSuccess(productList); + } + + @ApiOperation("Ʒƻģѯ") + @RequestMapping(value = "/simpleList", method = RequestMethod.GET) + @ResponseBody + public Object getList(String keyword) {//ģѯ + List productList = productService.list(keyword); + return new CommonResult().success(productList); + } + + @ApiOperation("޸״̬") + @RequestMapping(value = "/update/verifyStatus",method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:update')") + public Object updateVerifyStatus(@RequestParam("ids") List ids, + @RequestParam("verifyStatus") Integer verifyStatus,//״̬ + @RequestParam("detail") String detail)//ϸϢ { + int count = productService.updateVerifyStatus(ids, verifyStatus, detail); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("¼") + @RequestMapping(value = "/update/publishStatus",method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:update')") + public Object updatePublishStatus(@RequestParam("ids") List ids, + @RequestParam("publishStatus") Integer publishStatus) //ϼ״̬{ + int count = productService.updatePublishStatus(ids, publishStatus); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ƼƷ") + @RequestMapping(value = "/update/recommendStatus",method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:update')") + public Object updateRecommendStatus(@RequestParam("ids") List ids, + @RequestParam("recommendStatus") Integer recommendStatus)//Ƽ״̬ { + int count = productService.updateRecommendStatus(ids, recommendStatus);//Ƽ״̬ + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("ΪƷ") + @RequestMapping(value = "/update/newStatus",method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:update')") + public Object updateNewStatus(@RequestParam("ids") List ids, + @RequestParam("newStatus") Integer newStatus) { + int count = productService.updateNewStatus(ids, newStatus); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("޸ɾ״̬") + @RequestMapping(value = "/update/deleteStatus",method = RequestMethod.POST) + @ResponseBody + @PreAuthorize("hasAuthority('pms:product:delete')") + public Object updateDeleteStatus(@RequestParam("ids") List ids, + @RequestParam("deleteStatus") Integer deleteStatus) { + int count = productService.updateDeleteStatus(ids, deleteStatus); + if (count > 0) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } +} \ No newline at end of file