| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | |
| | | @Override |
| | | public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) { |
| | | |
| | | return deviceLedgerMapper.queryPage(page, deviceLedger); |
| | | IPage<DeviceLedgerDto> deviceLedgerDtoIPage = deviceLedgerMapper.queryPage(page, deviceLedger); |
| | | deviceLedgerDtoIPage.getRecords().forEach(c -> { |
| | | c.setStatus("1".equals(c.getStatus()) ? "正常" : "停用"); |
| | | }); |
| | | return deviceLedgerDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | return AjaxResult.error("设备型号已存在"); |
| | | } |
| | | boolean save = this.save(deviceLedger); |
| | | if (save){ |
| | | return AjaxResult.success(); |