feat(新增-商品管理): 商品审核

Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
bunny 2024-03-26 16:30:00 +08:00
parent 315659d1f7
commit 50f376d312
3 changed files with 35 additions and 0 deletions

View File

@ -65,4 +65,11 @@ public class ProductController {
productService.deleteById(id); productService.deleteById(id);
return Result.success(); return Result.success();
} }
@Operation(summary = "商品审核", description = "商品审核")
@GetMapping("/updateAuditStatus/{id}/{auditStatus}")
public Result<Product> updateAuditStatus(@PathVariable Long id, @PathVariable Integer auditStatus) {
productService.updateAuditStatus(id, auditStatus);
return Result.success();
}
} }

View File

@ -43,4 +43,12 @@ public interface ProductService {
* @param id 删除ID * @param id 删除ID
*/ */
void deleteById(Long id); void deleteById(Long id);
/**
* 商品审核
*
* @param id 审核ID
* @param auditStatus 审核状态
*/
void updateAuditStatus(Long id, Integer auditStatus);
} }

View File

@ -134,4 +134,24 @@ public class ProductServiceImpl implements ProductService {
productSkuMapper.deleteByProductId(id); // 根据商品id删除商品的sku数据 productSkuMapper.deleteByProductId(id); // 根据商品id删除商品的sku数据
productDetailsMapper.deleteByProductId(id); // 根据商品的id删除商品的详情数据 productDetailsMapper.deleteByProductId(id); // 根据商品的id删除商品的详情数据
} }
/**
* 商品审核
*
* @param id 审核ID
* @param auditStatus 审核状态
*/
@Override
public void updateAuditStatus(Long id, Integer auditStatus) {
Product product = new Product();
product.setId(id);
if (auditStatus == 1) {
product.setAuditStatus(1);
product.setAuditMessage("审批通过");
} else {
product.setAuditStatus(-1);
product.setAuditMessage("审批不通过");
}
productMapper.updateById(product);
}
} }