|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.asset.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -14,9 +15,11 @@ import com.ruoyi.asset.domain.dto.TbBorrowRecordDTO;
|
|
|
import com.ruoyi.asset.mapper.TbAssetMapper;
|
|
|
import com.ruoyi.asset.mapper.TbAssetStatusRecordMapper;
|
|
|
import com.ruoyi.asset.mapper.TbPlaceMapper;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.UserUtils;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -50,6 +53,9 @@ public class TbAssetBorrowRecordServiceImpl extends ServiceImpl<TbAssetBorrowRec
|
|
|
@Resource
|
|
|
private TbAssetStatusRecordMapper tbAssetStatusRecordMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询设备借用记录
|
|
|
*
|
|
@@ -62,18 +68,30 @@ public class TbAssetBorrowRecordServiceImpl extends ServiceImpl<TbAssetBorrowRec
|
|
|
return tbAssetBorrowRecordMapper.selectTbAssetBorrowRecordById(id);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询设备借用记录列表
|
|
|
- *
|
|
|
- * @param tbAssetBorrowRecord 设备借用记录
|
|
|
- * @return 设备借用记录
|
|
|
- */
|
|
|
@Override
|
|
|
- public List<TbAssetBorrowRecord> selectTbAssetBorrowRecordList(TbAssetBorrowRecord tbAssetBorrowRecord)
|
|
|
- {
|
|
|
+ public List<TbAssetBorrowRecord> selectTbAssetBorrowRecordList(TbAssetBorrowRecord tbAssetBorrowRecord) {
|
|
|
return tbAssetBorrowRecordMapper.selectTbAssetBorrowRecordList(tbAssetBorrowRecord);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<TbBorrowRecordDTO> selectTbAssetBorrowRecordDTOList(TbAssetBorrowRecord tbAssetBorrowRecord)
|
|
|
+ {
|
|
|
+ List<TbAssetBorrowRecord> tbAssetBorrowRecords = tbAssetBorrowRecordMapper.selectTbAssetBorrowRecordList(tbAssetBorrowRecord);
|
|
|
+ List<TbBorrowRecordDTO> borrowRecordDTOS = new ArrayList<>();
|
|
|
+ for (TbAssetBorrowRecord assetBorrowRecord : tbAssetBorrowRecords) {
|
|
|
+ TbBorrowRecordDTO tbBorrowRecordDTO = BeanUtil.toBean(assetBorrowRecord, TbBorrowRecordDTO.class);
|
|
|
+ Long userId = assetBorrowRecord.getUserId();
|
|
|
+ SysUser sysUser = sysUserMapper.selectUserById(userId);
|
|
|
+ tbBorrowRecordDTO.setUsername(sysUser.getUserName());
|
|
|
+ String assetBarCode = assetBorrowRecord.getAssetBarCode();
|
|
|
+ TbAsset tbAsset = tbAssetMapper.selectTbAssetByBarCode(assetBarCode);
|
|
|
+ tbBorrowRecordDTO.setTbAsset(tbAsset);
|
|
|
+
|
|
|
+ borrowRecordDTOS.add(tbBorrowRecordDTO);
|
|
|
+ }
|
|
|
+ return borrowRecordDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增设备借用记录
|
|
|
*
|