文件更新

master
chen 2 years ago
parent 6765eb34ac
commit 1e2ed7cbc2
  1. 6
      src/main/java/com/huoran/iasf/controller/SysFilesController.java

@ -1,5 +1,6 @@
package com.huoran.iasf.controller; package com.huoran.iasf.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -68,14 +69,13 @@ public class SysFilesController {
@ApiOperation(value = "更新文件信息") @ApiOperation(value = "更新文件信息")
@PostMapping("/update") @PostMapping("/update")
public R update(FileParameters fileParameters) { public R update(@RequestBody FileParameters fileParameters) {
if (fileParameters.getId()==null){ if (StrUtil.isEmpty(fileParameters.getId())){
return R.fail("id不能为空"); return R.fail("id不能为空");
} }
UpdateWrapper<SysFilesEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("quote",fileParameters.getQuote()). updateWrapper.set("quote",fileParameters.getQuote()).
set("is_release",fileParameters.getIsRelease()). set("is_release",fileParameters.getIsRelease()).
eq("site",fileParameters.getSite()).
eq("id", fileParameters.getId()); eq("id", fileParameters.getId());
return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败"); return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败");
} }

Loading…
Cancel
Save