文件上传https

This commit is contained in:
chen-xin-zhi 2025-03-22 11:50:46 +08:00
parent 5c14c61ae8
commit 07ac1fca56

View File

@ -2,6 +2,7 @@ package com.cultural.heritage.controller.clothes;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cultural.heritage.annotation.AuthCheck; import com.cultural.heritage.annotation.AuthCheck;
@ -195,4 +196,33 @@ public class ClothesController {
/**
* Web端管理员上()架服装
* @param commonRequest 服装id
* @return 是否更新成功
*/
@PostMapping("/shelves")
@Operation(summary = "Web端管理员上(下)架服装", description = "参数服装id权限管理员(admin, boss)方法名updateClothesShelvesStatus")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
public BaseResponse<Boolean> updateClothesShelvesStatus(@RequestBody CommonRequest commonRequest) {
if (commonRequest == null || commonRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// 获取当前服装的上()架状态
Long id = commonRequest.getId();
Clothes clothes = clothesService.getById(id);
ThrowUtils.throwIf(clothes == null, ErrorCode.OPERATION_ERROR, "服装不存在");
Integer status = clothes.getIsShelves() == 0 ? 1 : 0;
UpdateWrapper<Clothes> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id);
updateWrapper.set("isShelves", status);
boolean update = clothesService.update(updateWrapper);
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "上架状态更新失败");
return ResultUtils.success(true);
}
} }