|
@@ -1,17 +1,23 @@
|
|
|
package cn.rankin.cmsweb.controller.resource;
|
|
|
|
|
|
+import cn.rankin.cmsweb.code.CmsWebAPICode;
|
|
|
import cn.rankin.cmsweb.service.resource.ResourceService;
|
|
|
import cn.rankin.common.utils.api.model.APIResult;
|
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
|
-import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
|
|
|
import cn.rankin.common.utils.dto.resource.ResourceDTO;
|
|
|
+import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
|
|
|
import cn.rankin.common.utils.util.BeanUtil;
|
|
|
import cn.rankin.common.utils.vo.resource.ResourceVo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/resource")
|
|
|
+@Slf4j
|
|
|
public class ResourceController {
|
|
|
|
|
|
@Autowired
|
|
@@ -27,8 +33,13 @@ public class ResourceController {
|
|
|
return resourceService.create(resourceDTO);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
|
|
|
- public APIResult<ResourceVo> create(@PathVariable("id") String id, @RequestBody ResourceDTO resourceDTO) {
|
|
|
+ @RequestMapping(method = RequestMethod.PUT)
|
|
|
+ public APIResult<ResourceVo> update(@RequestBody ResourceDTO resourceDTO) {
|
|
|
+ String id = resourceDTO.getId();
|
|
|
+ if (null == id || id.isEmpty()){
|
|
|
+ log.error("id Is Null");
|
|
|
+ return APIResult.error(CmsWebAPICode.PARAMETER_ERROR);
|
|
|
+ }
|
|
|
return resourceService.update(id,resourceDTO);
|
|
|
}
|
|
|
}
|