| | |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.LEDProgramParam; |
| | | import com.sandu.ximon.admin.param.ReceiveParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LEDProgramService; |
| | | import com.sandu.ximon.dao.domain.LEDProgram; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RequestMapping("/v1/LEDProgram") |
| | | public class LEDProgramController { |
| | | private final LEDProgramService ledProgramService; |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addLEDProgram(@RequestBody @Validated LEDProgramParam ledProgramParam) { |
| | |
| | | |
| | | @PostMapping("/update/{pid}") |
| | | public ResponseVO<Object> updateLEDProgram(@PathVariable Long pid, @RequestBody @Validated LEDProgramParam ledProgramParam) { |
| | | return ResponseUtil.success(ledProgramService.updateProgram(pid,ledProgramParam)); |
| | | return ResponseUtil.success(ledProgramService.updateProgram(pid, ledProgramParam)); |
| | | } |
| | | |
| | | @GetMapping("/getbypid/{pid}") |
| | | public ResponseVO<Object> getByPid(@PathVariable Long pid) { |
| | | return ResponseUtil.success(ledProgramService.getByPid(pid)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/delete/{pid}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long pid) { |
| | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listProgram(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.LED_PROGRAM_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram(); |
| | | if(null!=keyword){ |
| | | wrapper.like(LEDProgram::getName,keyword); |
| | | if (null != keyword) { |
| | | wrapper.like(LEDProgram::getName, keyword); |
| | | } |
| | | return ResponseUtil.successPage(ledProgramService.list(wrapper)); |
| | | |