package com.qianwen.smartman.modules.cps.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; import javax.validation.Valid; import com.qianwen.core.scanner.modular.annotation.GetResource; import com.qianwen.core.scanner.modular.annotation.PostResource; import com.qianwen.core.scanner.modular.stereotype.ApiResource; import com.qianwen.core.secure.annotation.PreAuth; import com.qianwen.core.tenant.annotation.NonDS; import com.qianwen.core.tool.api.R; import com.qianwen.core.tool.utils.Func; import com.qianwen.smartman.modules.cps.service.IWorkstationWorkbenchService; import com.qianwen.smartman.modules.cps.vo.MachineInformationVO; import com.qianwen.smartman.modules.cps.vo.WorkstationOfWorkbenchVO; import com.qianwen.smartman.modules.cps.vo.WorkstationWorkbenchVO; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Api(value = "工位工作台管理", tags = {"工位工作台管理"}) @RestController @ApiResource({"smis/workstation-workbench"}) @NonDS @Validated public class WorkstationWorkbenchController { private final IWorkstationWorkbenchService workbenchService; public WorkstationWorkbenchController(final IWorkstationWorkbenchService workbenchService) { this.workbenchService = workbenchService; } @PreAuth @PostResource({"/saveWorkbench"}) @ApiOperation("增加工位工作台信息") public R saveWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) { return R.data(this.workbenchService.saveWorkstationWorkbench(vo)); } @GetMapping({"/listWorkbench"}) @ApiOperation("遍历工位工作台") public R listWorkbench(Long workstationId) { return R.data(this.workbenchService.listWorkstationWorkbench(workstationId)); } @PreAuth @PostResource({"/deleteWorkbench"}) @ApiOperation("删除工位工作台信息") public R deleteWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) { return R.data(this.workbenchService.deleteWorkstationWorkbench(vo)); } @PreAuth @PostResource({"/updateWorkbench"}) @ApiOperation("修改工位工作台信息") public R updateWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) { return R.data(this.workbenchService.updateWorkstationWorkbench(vo)); } @PreAuth @GetResource({"/listByGroupId"}) @ApiOperation("根据工位组查询工位和工作台集合") public R> listByGroupId(@RequestParam(required = false) String groupId, @RequestParam(required = false) String settingsId, @RequestParam(required = false) String keyWord) { return R.data(this.workbenchService.listByGroupId(Func.isNotEmpty(groupId) ? Long.valueOf(groupId) : null, Func.isNotEmpty(settingsId) ? Long.valueOf(settingsId) : null, keyWord)); } }