feat(新增-商品管理): 商品上下架
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
50f376d312
commit
e0115dbf30
|
@ -6,6 +6,7 @@ import com.atguigu.spzx.model.dto.product.ProductDto;
|
|||
import com.atguigu.spzx.model.entity.product.Brand;
|
||||
import com.atguigu.spzx.model.entity.product.Product;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import com.atguigu.spzx.model.vo.result.ResultCodeEnum;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
|
@ -72,4 +73,11 @@ public class ProductController {
|
|||
productService.updateAuditStatus(id, auditStatus);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "商品上下架", description = "商品上下架")
|
||||
@GetMapping("/updateStatus/{id}/{status}")
|
||||
public Result updateStatus(@PathVariable Long id, @PathVariable Integer status) {
|
||||
productService.updateStatus(id, status);
|
||||
return Result.build(null, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -51,4 +51,12 @@ public interface ProductService {
|
|||
* @param auditStatus 审核状态
|
||||
*/
|
||||
void updateAuditStatus(Long id, Integer auditStatus);
|
||||
|
||||
/**
|
||||
* 商品上下架
|
||||
*
|
||||
* @param id 上下架ID
|
||||
* @param status 上下架状态
|
||||
*/
|
||||
void updateStatus(Long id, Integer status);
|
||||
}
|
||||
|
|
|
@ -154,4 +154,22 @@ public class ProductServiceImpl implements ProductService {
|
|||
}
|
||||
productMapper.updateById(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品上下架
|
||||
*
|
||||
* @param id 上下架ID
|
||||
* @param status 上下架状态
|
||||
*/
|
||||
@Override
|
||||
public void updateStatus(Long id, Integer status) {
|
||||
Product product = new Product();
|
||||
product.setId(id);
|
||||
if (status == 1) {
|
||||
product.setStatus(1);
|
||||
} else {
|
||||
product.setStatus(-1);
|
||||
}
|
||||
productMapper.updateById(product);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue