| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.redis.RedisService; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | |
| | | /** |
| | | * 获取用户所有的设备码 |
| | | */ |
| | | public List<String> listDeviceCode(/*int start, int end*/) { |
| | | return baseMapper.listCode(/*start,end,*/SecurityUtils.getClientId()); |
| | | public CommonPage<String> listDeviceCode(int pageNo, int pageSize, String keyword, String deviceCode) { |
| | | List<String> list; |
| | | if (SecurityUtils.getClientId() != null) { |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | list = baseMapper.listCode(SecurityUtils.getUserId(), keyword, deviceCode); |
| | | } else { |
| | | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | list = baseMapper.listCode(null, keyword, deviceCode); |
| | | } |
| | | |
| | | return CommonPage.restPage(list); |
| | | } |
| | | |
| | | public boolean setPower(List<Long> ids, Integer power1, Integer power2) { |
| | | List<Light> lights = listByIds(ids); |
| | | lights.forEach(light -> { |
| | | light.setPower1(power1); |
| | | light.setPower2(power2); |
| | | } |
| | | ); |
| | | return updateBatchById(lights); |
| | | } |
| | | } |