| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.desk.entity.Notice; |
| | | import org.springblade.modules.remote.wrapper.RemoteWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.springblade.modules.remote.vo.RemoteVO; |
| | | import org.springblade.modules.remote.service.IRemoteService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页 |
| | | * 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入remote") |
| | | public R<IPage<Remote>> list(Remote remote, Query query) { |
| | | IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote)); |
| | | return R.data(pages); |
| | | public R<IPage<RemoteVO>> list(@ApiIgnore @RequestParam Map<String, Object> remote, Query query) { |
| | | //IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote)); |
| | | IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote, Remote.class)); |
| | | return R.data(RemoteWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @GetMapping("/getSensings") |
| | | public R getSensing(String type){ |
| | | return R.data(remoteService.getRemoteList(type)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | * 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入remote") |
| | | public R submit(@Valid @RequestBody Remote remote) { |
| | | if (remote.getReType().equals("0")) {//判断是否修改为展示 |
| | | //查找当前类型默认展示的数量 |
| | | List<Remote> remoteList = remoteService.findByType(remote); |
| | | if (remoteList.size() > 0) { |
| | | throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("该类型已有默认展示,请先取消默认展示")); |
| | | } |
| | | } |
| | | return R.status(remoteService.saveOrUpdate(remote)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | |
| | | return R.status(remoteService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | |
| | | } |