2 天以前 300cf495c6a708df63621ff70e6d5408abc2912a
src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
@@ -1,6 +1,5 @@
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -23,6 +22,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -45,11 +45,11 @@
    @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("设备名称已存在");
        }
//        LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
//        deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel());
//        if (this.count(deviceLedgerLambdaQueryWrapper) > 0) {
//            return AjaxResult.error("设备型号已存在");
//        }
        boolean save = this.save(deviceLedger);
        if (save){
            return AjaxResult.success();
@@ -104,6 +104,7 @@
        ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<DeviceLedgerExeclDto>(DeviceLedgerExeclDto.class);
        List<DeviceLedgerExeclDto> userList = util.importExcel(file.getInputStream());
        userList.forEach(c -> {
            for (Integer i = 0; i < c.getNumber(); i++) {
            DeviceLedger deviceLedger = new DeviceLedger();
            SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser());
            if (sysUser!=null) {
@@ -112,7 +113,9 @@
                deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue());
            }
            BeanUtils.copyProperties(c,deviceLedger);
                deviceLedger.setNumber(new BigDecimal(1));
            deviceLedgerMapper.insert(deviceLedger);
            }
        });
        return true;