|  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:devices:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Devices devices) { | 
|---|
|  |  |  | devices.setCreator(getLoginUser().getId()); | 
|---|
|  |  |  | devices.setEditor(getLoginUser().getId()); | 
|---|
|  |  |  | devices.setCreator(getLoginUser(null).getId()); | 
|---|
|  |  |  | devices.setEditor(getLoginUser(null).getId()); | 
|---|
|  |  |  | return ApiResponse.success(devicesService.create(devices)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @RequiresPermissions("business:devices:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Devices devices) { | 
|---|
|  |  |  | devices.setEditor(getLoginUser().getId()); | 
|---|
|  |  |  | devices.setEditor(getLoginUser(null).getId()); | 
|---|
|  |  |  | devicesService.updateById(devices); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|