| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.sandu.ximon.admin.service.PoleLightemitService; |
| | | import com.sandu.ximon.admin.service.XiXunPlayerService; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.PlayPlanNv; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword); |
| | | // if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){ |
| | | // boolean clientId = clientService.findClientId(); |
| | | // if(clientId){ |
| | | // wrapper= wrapper.eq(PoleXixunPlayerEntity::getUserId,SecurityUtils.getUserId()); |
| | | // } |
| | | // wrapper= wrapper.eq(PoleXixunPlayerEntity::getClientId,clientService.getClientId()); |
| | | // } |
| | | // wrapper=Wrappers.lambdaQuery(PoleXixunPlayerEntity.class); |
| | | // if(StrUtil.isNotBlank(keyword)){ |
| | | // wrapper.like(PoleXixunPlayerEntity::getLightemitName,keyword).or( |
| | | // lambdaQueryWrapper -> { |
| | | // lambdaQueryWrapper.like(PoleXixunPlayerEntity::getLightemitControlCode, keyword); |
| | | // } |
| | | // ); |
| | | // } |
| | | // return ResponseUtil.success(poleLightemitService.list(wrapper)); |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | // clientService.findClientId() |
| | | // wrapper.eq(PoleXixunPlayerEntity::getCreateUserId,) |
| | | //wrapper.eq(LedPlayerEntity::get) |
| | | |
| | | return ResponseUtil.success(xiXunPlayerService.list(wrapper)); // todo |
| | | }else { |
| | | return ResponseUtil.success(xiXunPlayerService.list(wrapper)); |
| | |
| | | |
| | | poleLightemitService.savePoleLightemit(poleLightemit); |
| | | |
| | | |
| | | return ResponseUtil.success("新增成功"); |
| | | } |
| | | |
| | | @PostMapping("/updateLed/{ledId}") |
| | | public ResponseVO<Object> updatePoleLightemit(@PathVariable Long ledId,@RequestBody PoleLightemitEntity poleLightemit){ |
| | | poleLightemitService.updatePoleLightemit(ledId,poleLightemit); |
| | | return ResponseUtil.success("修改成功"); |
| | | } |
| | | |
| | | @PostMapping("/deleteLed") |
| | | public ResponseVO<Object> deleteLed(@RequestBody List<Long> ledIds){ |
| | | boolean b = poleLightemitService.deletePoleLightemit(ledIds); |
| | | if(b){ |
| | | return ResponseUtil.success("删除成功"); |
| | | }else { |
| | | return ResponseUtil.success("删除失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/listLed") |
| | | public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class); |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){ |
| | | boolean clientId = clientService.findClientId(); |
| | | if(clientId){ |
| | | wrapper= wrapper.eq(PoleLightemitEntity::getUserId,SecurityUtils.getUserId()); |
| | | } |
| | | wrapper= wrapper.eq(PoleLightemitEntity::getClientId,clientService.getClientId()); |
| | | } |
| | | wrapper=Wrappers.lambdaQuery(PoleLightemitEntity.class); |
| | | if(StrUtil.isNotBlank(keyword)){ |
| | | wrapper.like(PoleLightemitEntity::getLightemitName,keyword).or( |
| | | lambdaQueryWrapper -> { |
| | | lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword); |
| | | } |
| | | ); |
| | | } |
| | | return ResponseUtil.success(poleLightemitService.list(wrapper)); |
| | | } |
| | | } |