後端Springboot前端VUE實現Excel導入功能

来源:https://www.cnblogs.com/su-ke/archive/2020/01/20/12218487.html
-Advertisement-
Play Games

功能描述:做的是物聯網的項目,Excel導入實現的功能是將Excel中的數據批量的導入AEP系統,再導入我們系統中。目前已經完成該功能,前端還會添加進度條優化。Excel模板: 前端向後端傳遞的參數: 前端代碼: <Upload name="wlwDeviceFile" ref="upload" : ...



功能描述:
做的是物聯網的項目,Excel導入實現的功能是將Excel中的數據批量的導入AEP系統,再導入我們系統中。目前已經完成該功能,前端還會添加進度條優化。
對於導入導出功能,推薦這個Git:https://gitee.com/lemur/easypoi

Excel模板:

 

 


前端向後端傳遞的參數:

 

 

前端代碼:
<Upload
name="wlwDeviceFile"
ref="upload"
:action="pathUrl"
:on-success="handleSuccess"
:on-error="handleError"
:format="['xls','xlsx']"
:max-size="5120"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
:before-upload="handleBeforeUpload"
:data="extraData"
:disabled="!isLock"
>
<Button type="primary">選擇文件</Button>
</Upload>
data() {
return {
isLock: true,
mesg: false,
extraData: {
aepProductId: localStorage.productId,
productId: localStorage.productItemId,
projectId: localStorage.currentProjectId
},
mes: "",
cod: 0,
// currentShow: false,
pathUrl: Util.baseUrl + "/api/excel/import",
wlwDevice: {
fileName: "", //用於顯示上傳文件名
id: localStorage.productId,
autoSubscribe: 0
},
ruleValidate: {
fileName: [
{
required: true,
message: "請選擇文件",
trigger: "change"
}
]
}
};
},

handleSuccess(res, file) {
// console.log("res++++++++++++++++++++++++++", res);
if (res.code == 0) {
this.cod = res.code;
this.mes = '導入成功';
console.log(this.$refs.upload.fileList);
// this.$refs.upload.fileList.splice(0, 1);
} else {
this.cod = res.code;
this.mes = res.message;
}
this.isLock = true;
// this.$Spin.hide();
this.wlwDevice.fileName = file.name;
if (this.$refs.upload.fileList.length > 1) {
this.$refs.upload.fileList.splice(0, 1);
}

// this.$emit("cancel", this.isOpen);
},

handleSubmit(name) {
console.log("----------------------");
this.$refs[name].validate(valid => {
if (valid) {
this.mesg = true;
this.$refs[name].resetFields();
this.$emit("cancel", this.isOpen);
this.$emit("refreshList");
console.log("-------------@@@--------");
} else {
this.$Message.error(this.$t("errorText"));
}
});
},

後端解析 Excel,將數據讀取出來導入AEP系統

 

 導入我們系統:

 

 


後端代碼:
導入POM依賴:

<dependency>
    <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>

解析Excel的方法:
@Component
@NoArgsConstructor
public class ParseExcelUtil {
private static final Logger log = LoggerFactory.getLogger(ParseExcelUtil.class);

public static Workbook getWorkbook(InputStream is, String fileName) throws ExcelIOException {
Workbook workbook = null;
String fileType = fileName.substring(fileName.lastIndexOf("."));
// 推薦使用poi-ooxml中的WorkbookFactory.create(is)來創建Workbook,
// 因為HSSFWorkbook和XSSFWorkbook都實現了Workbook介面(可以解決以下報錯問題)
try {
if (ExcelVersion.V2003.getSuffix().equals(fileType)) {
workbook = new HSSFWorkbook(is);

} else if (ExcelVersion.V2007.getSuffix().equals(fileType)) {
workbook = new XSSFWorkbook(is);

}
}catch (IOException e){
// 無效尾碼名稱,這裡之能保證excel的尾碼名稱,不能保證文件類型正確,不過沒關係,在創建Workbook的時候會校驗文件格式
throw new ExcelIOException("請上傳文件!");
}
return workbook;
}
}
Excel版本問題的枚舉:
@NoArgsConstructor
public enum ExcelVersion {
/**
* 雖然V2007版本支持最大支持1048575 * 16383 ,
* V2003版支持65535*255
* 但是在實際應用中如果使用如此龐大的對象集合會導致記憶體溢出,
* 因此這裡限制最大為10000*100,如果還要加大建議先通過單元測試進行性能測試。
* 1000*100 全部導出預計時間為27s左右
*/
V2003(".xls", 10000, 100), V2007(".xlsx", 100, 100);

private String suffix;

private int maxRow;

private int maxColumn;

ExcelVersion(String suffix, int maxRow, int maxColumn) {
this.suffix = suffix;
this.maxRow = maxRow;
this.maxColumn = maxColumn;
}

public String getSuffix() {
return this.suffix;
}

public int getMaxRow() {
return maxRow;
}

void setMaxRow(int maxRow) {
this.maxRow = maxRow;
}

public int getMaxColumn() {
return maxColumn;
}

void setMaxColumn(int maxColumn) {
this.maxColumn = maxColumn;
}

void setSuffix(String suffix) {
this.suffix = suffix;
}

}
Long型轉ZonedDateTime型方法:
/**
* 將Long類型轉化成0
* @author yk
* @param time
* @return
*/
public static ZonedDateTime toZonedDateTime(Long time){
SimpleDateFormat sdf = new SimpleDateFormat(LONG_DATE);
Date createDate = new Date(time);
String format = sdf.format(createDate);
DateTimeFormatter beijingFormatter = DateTimeFormatter.ofPattern(LONG_DATE).withZone(ZoneId.of("Asia/Shanghai"));
if(StringUtils.isBlank(format)){
return null;
}
ZonedDateTime beijingDateTime = ZonedDateTime.parse(format, beijingFormatter);
ZonedDateTime utc = beijingDateTime.withZoneSameInstant(ZoneId.of("UTC"));
return utc;

}

控制層
@RestController
@RequestMapping("/api/excel")
public class ImportExcelController {

private final Logger log = LoggerFactory.getLogger(ImportExcelController.class);

private final WlwDeviceService wlwDeviceService;

@Autowired
private ImportExcelService importExcelService;

public ImportExcelController(WlwDeviceService wlwDeviceService) {
this.wlwDeviceService = wlwDeviceService;
}

@PostMapping("/import")
public ImportExcelResult excelToWlwDevice(@RequestParam("wlwDeviceFile") MultipartFile wlwDeviceFile, @RequestParam("productId") String productId, @RequestParam("aepProductId") String aepProductId, @RequestParam("projectId") String projectId) throws Exception {
return importExcelService.excelToWlwDeviceService(wlwDeviceFile, productId, aepProductId, projectId);
}

Service介面:
public interface ImportExcelService {
/**
* 導入
* @param wlwDeviceFile
* @param productId
* @param aepProductId
* @param projectId
* @return
*/
ImportExcelResult excelToWlwDeviceService(MultipartFile wlwDeviceFile, String productId, String aepProductId, String projectId);
}

Service實現類:
@Service
public class ImportExcelServiceImpl implements ImportExcelService {
private static final Logger log = LoggerFactory.getLogger(ImportExcelServiceImpl.class);

@Autowired
private AepApiUtil util;

@Autowired
private WlwDeviceRepository wlwDeviceRepository;

@Override
public ImportExcelResult excelToWlwDeviceService(MultipartFile wlwDeviceFile, String productId, String aepProductId, String projectId) {
ImportExcelResult importExcelResult = new ImportExcelResult(0, "導入成功");
//List<String> sList = new ArrayList<>();
if (wlwDeviceFile.isEmpty()) {
importExcelResult.setCode(100);
importExcelResult.setMessage("填寫模版信息不能為空");
return importExcelResult;
}
//1.將excel中的數據放入list中
List<AepDeviceDTO> aepDeviceDTOList = new ArrayList<>();
//解析Excel文件
try {
InputStream is = wlwDeviceFile.getInputStream();
int size = 0;
String imei = null;
//廠家名稱
String manufacturer = null;
//型號
String productType = null;
//設備名稱
String deviceName = null;
//自動訂閱
String autoObserver = null;
//設備類型
String deviceType = null;
StringBuilder megBuilder = new StringBuilder();
String filename = wlwDeviceFile.getOriginalFilename();
//1.根據Excel文件創建工作簿
Workbook wb = ParseExcelUtil.getWorkbook(is, filename);
//2.獲取Sheet
Sheet sheet = wb.getSheetAt(0);
if (sheet != null) {
WlwDevice wlwDevice = new WlwDevice();
//3.獲取Sheet中的每一行,和每一個單元格,數據從第二行開始
for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
log.info("處理到{}條記錄",rowNum);
//根據索引獲取每一個行
Row row = sheet.getRow(rowNum);
size = row.getLastCellNum();
//Aep的設備實體類
AepDeviceDTO deviceDTO = new AepDeviceDTO();
AepDeviceOther other = new AepDeviceOther();
Set<String> imeiMap = new HashSet<>();
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
Cell cell = row.getCell(cellNum);
if (null == cell) {
break;
}
//根據索引獲取每一個單元格 獲取每一個單元格的內容;
switch (cellNum) {
case 0:
manufacturer = cell.getStringCellValue();
break;
case 1:
productType = cell.getStringCellValue();
break;
case 2:
imei = cell.getStringCellValue();
if (StringUtils.isBlank(imei)) {
importExcelResult.setCode(101);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:IMEI號不能為空");
continue;
}
if (imei.trim().length() != 15) {
importExcelResult.setCode(102);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:IMEI號必須是15位");
continue;
}
deviceDTO.setImei(imei.trim());
wlwDevice.setImei(imei.trim());
break;
case 3:
deviceName = cell.getStringCellValue();
if (StringUtils.isBlank(deviceName)) {
importExcelResult.setCode(104);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:設備名稱不能為空");
continue;
}
deviceDTO.setDeviceName(deviceName.trim());
wlwDevice.setDeviceName(deviceName.trim());
break;
case 4:
autoObserver = cell.getStringCellValue();
if (StringUtils.isBlank(autoObserver)) {
importExcelResult.setCode(105);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:設備必須選擇是否自動訂閱");
continue;
}
//Aep的設備實體類的autoObserver pass平臺暫時不做自動訂閱和PSK,若做在這裡set
if (autoObserver.trim().hashCode() == 26159) {
other.setAutoObserver(0);
} else if (autoObserver.trim().hashCode() == 21542) {
other.setAutoObserver(1);
} else {
importExcelResult.setCode(106);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:設備必須選擇是否自動訂閱");
continue;
}
break;
case 5:
deviceName = cell.getStringCellValue();
break;
default:
break;
}
}
deviceDTO.setProductId(Long.valueOf(aepProductId));
deviceDTO.setOther(other);
deviceDTO.setOperator(String.valueOf(SecurityUtils.getCurrentUserId()));
aepDeviceDTOList.add(deviceDTO);
//2.遍歷list校驗是否有重覆的imei號
boolean add = imeiMap.add(imei);
if (!add) {
importExcelResult.setCode(108);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[")
.append(deviceName).append("],失敗原因:設備IMEI存在重覆數據,請檢查模板");
continue;
}
//導入aep系統的設備
AepCreateDeviceResponse aepDevice = util.createAepDevice(deviceDTO);
Thread.sleep(200);
System.out.println("調用aep介面:" + aepDevice.getResult());
if (aepDevice.getCode() != 0) {
importExcelResult.setCode(aepDevice.getCode());
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[")
.append(deviceName).append("],失敗原因:").append(aepDevice.getMsg());
continue;
} else {
importExcelResult.setCode(0);
importExcelResult.setMessage(aepDevice.getMsg());
//aep返回的結果參數
AepDevice result = aepDevice.getResult();
wlwDevice.setDeviceId(result.getDeviceId());
wlwDevice.setProductId(Long.valueOf(productId));
wlwDevice.setProjectId(Integer.valueOf(projectId));
wlwDevice.setAepProductId(Long.valueOf(result.getProductId()));
wlwDevice.setDeviceSn(result.getDeviceSn());
wlwDevice.setTenantId(result.getTenantId());
wlwDevice.setUpdatedDate(result.getUpdateTime() == null ? null : DateUtils.toZonedDateTime(result.getUpdateTime()));
wlwDevice.setNetStatus(result.getNetStatus());
wlwDevice.setUpdaterId(result.getOperator());
int insert = wlwDeviceRepository.insert(wlwDevice);
if (insert == 0) {
importExcelResult.setCode(109);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗原因:PasS系統導入錯誤").append(aepDevice.getResult().getDeviceName());
continue;
}
}
}
}
importExcelResult.setMessage(megBuilder.toString());
is.close();

} catch (Exception e) {
log.error("插入設備失敗", e);
importExcelResult.setCode(-1);
importExcelResult.setMessage("插入設備失敗");
}

return importExcelResult;
}
}  AepDeviceDTO實體類:
public class AepDeviceDTO {

/**
* 終端名稱
*/
private String deviceName;

/**
* 設備編號
*/
private String deviceSn;

/**
* IMEI號,全局唯一,根據產品的Endpoint必填,創建時可相同,則刪除原產品新建產品
*/
private String imei;

/**
* 操作者
*/
private String operator;

/**
* LWM2M協議必填參數,其他協議不填
* {
* autoObserver:0.自動訂閱 1.取消自動訂閱,必填;
* imsi:總長度不超過15位,使用0~9的數字,String類型,選填;
* pskValue:由大小寫字母加0-9數字組成的16位字元串,選填
* }
*/
private AepDeviceOther other;

/**
* 產品id
*/
private Long productId;

public String getDeviceName() {
return deviceName;
}

public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}

public String getDeviceSn() {
return deviceSn;
}

public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}

public String getImei() {
return imei;
}

public void setImei(String imei) {
this.imei = imei;
}

public String getOperator() {
return operator;
}

public void setOperator(String operator) {
this.operator = operator;
}

public AepDeviceOther getOther() {
return other;
}

public void setOther(AepDeviceOther other) {
this.other = other;
}

public Long getProductId() {
return productId;
}

public void setProductId(Long productId) {
this.productId = productId;
}

@Override
public String toString() {
return "AepDeviceDTO{" +
"deviceName='" + deviceName + '\'' +
", deviceSn='" + deviceSn + '\'' +
", imei='" + imei + '\'' +
", operator='" + operator + '\'' +
", other=" + other +
", productId=" + productId +
'}';
}
}  

AepDeviceOther實體類:
public class AepDeviceOther {

/**
* 0.自動訂閱 1.取消自動訂閱,必填;
*/
private Integer autoObserver;

/**
* 總長度不超過15位,使用0~9的數字,String類型,選填;
*/
private String imsi;

/**
* 由大小寫字母加0-9數字組成的16位字元串,選填
*/
private String pskValue;

public Integer getAutoObserver() {
return autoObserver;
}

public void setAutoObserver(Integer autoObserver) {
this.autoObserver = autoObserver;
}

public String getImsi() {
return imsi;
}

public void setImsi(String imsi) {
this.imsi = imsi;
}

public String getPskValue() {
return pskValue;
}

public void setPskValue(String pskValue) {
this.pskValue = pskValue;
}

@Override
public String toString() {
return "{" +
"autoObserver=" + autoObserver +
", imsi='" + imsi + '\'' +
", pskValue='" + pskValue + '\'' +
'}';
}
}

WlwDevice實體類:
public class WlwDevice implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private Integer id;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.create_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private ZonedDateTime createDate;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.updated_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private ZonedDateTime updatedDate;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.del_flag
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private Integer delFlag;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.creator_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String creatorId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.updater_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String updaterId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.device_name
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String deviceName;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.device_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String deviceId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.device_sn
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String deviceSn;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.imei
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String imei;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.imsi
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String imsi;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.product_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private Long productId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.aep_product_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
private Long aepProductId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.project_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private Integer projectId;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.remark
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String remark;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.last_up_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private ZonedDateTime lastUpTime;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.last_down_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private ZonedDateTime lastDownTime;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.device_status
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
private String deviceStatus;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.net_status
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
private Integer netStatus;

/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column wlw_device.tenant_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
private String tenantId;

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.id
*
* @return the value of wlw_device.id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public Integer getId() {
return id;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.id
*
* @param id the value for wlw_device.id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setId(Integer id) {
this.id = id;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.create_date
*
* @return the value of wlw_device.create_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public ZonedDateTime getCreateDate() {
return createDate;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.create_date
*
* @param createDate the value for wlw_device.create_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setCreateDate(ZonedDateTime createDate) {
this.createDate = createDate;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.updated_date
*
* @return the value of wlw_device.updated_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public ZonedDateTime getUpdatedDate() {
return updatedDate;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.updated_date
*
* @param updatedDate the value for wlw_device.updated_date
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setUpdatedDate(ZonedDateTime updatedDate) {
this.updatedDate = updatedDate;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.del_flag
*
* @return the value of wlw_device.del_flag
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public Integer getDelFlag() {
return delFlag;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.del_flag
*
* @param delFlag the value for wlw_device.del_flag
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.creator_id
*
* @return the value of wlw_device.creator_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getCreatorId() {
return creatorId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.creator_id
*
* @param creatorId the value for wlw_device.creator_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setCreatorId(String creatorId) {
this.creatorId = creatorId == null ? null : creatorId.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.updater_id
*
* @return the value of wlw_device.updater_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getUpdaterId() {
return updaterId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.updater_id
*
* @param updaterId the value for wlw_device.updater_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setUpdaterId(String updaterId) {
this.updaterId = updaterId == null ? null : updaterId.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.device_name
*
* @return the value of wlw_device.device_name
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getDeviceName() {
return deviceName;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.device_name
*
* @param deviceName the value for wlw_device.device_name
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setDeviceName(String deviceName) {
this.deviceName = deviceName == null ? null : deviceName.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.device_id
*
* @return the value of wlw_device.device_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getDeviceId() {
return deviceId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.device_id
*
* @param deviceId the value for wlw_device.device_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setDeviceId(String deviceId) {
this.deviceId = deviceId == null ? null : deviceId.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.device_sn
*
* @return the value of wlw_device.device_sn
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getDeviceSn() {
return deviceSn;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.device_sn
*
* @param deviceSn the value for wlw_device.device_sn
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn == null ? null : deviceSn.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.imei
*
* @return the value of wlw_device.imei
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getImei() {
return imei;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.imei
*
* @param imei the value for wlw_device.imei
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setImei(String imei) {
this.imei = imei == null ? null : imei.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.imsi
*
* @return the value of wlw_device.imsi
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getImsi() {
return imsi;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.imsi
*
* @param imsi the value for wlw_device.imsi
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setImsi(String imsi) {
this.imsi = imsi == null ? null : imsi.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.product_id
*
* @return the value of wlw_device.product_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public Long getProductId() {
return productId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.product_id
*
* @param productId the value for wlw_device.product_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setProductId(Long productId) {
this.productId = productId;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.aep_product_id
*
* @return the value of wlw_device.aep_product_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public Long getAepProductId() {
return aepProductId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.aep_product_id
*
* @param aepProductId the value for wlw_device.aep_product_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public void setAepProductId(Long aepProductId) {
this.aepProductId = aepProductId;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.project_id
*
* @return the value of wlw_device.project_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public Integer getProjectId() {
return projectId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.project_id
*
* @param projectId the value for wlw_device.project_id
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.remark
*
* @return the value of wlw_device.remark
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getRemark() {
return remark;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.remark
*
* @param remark the value for wlw_device.remark
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.last_up_time
*
* @return the value of wlw_device.last_up_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public ZonedDateTime getLastUpTime() {
return lastUpTime;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.last_up_time
*
* @param lastUpTime the value for wlw_device.last_up_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setLastUpTime(ZonedDateTime lastUpTime) {
this.lastUpTime = lastUpTime;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.last_down_time
*
* @return the value of wlw_device.last_down_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public ZonedDateTime getLastDownTime() {
return lastDownTime;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.last_down_time
*
* @param lastDownTime the value for wlw_device.last_down_time
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setLastDownTime(ZonedDateTime lastDownTime) {
this.lastDownTime = lastDownTime;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.device_status
*
* @return the value of wlw_device.device_status
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public String getDeviceStatus() {
return deviceStatus;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.device_status
*
* @param deviceStatus the value for wlw_device.device_status
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
public void setDeviceStatus(String deviceStatus) {
this.deviceStatus = deviceStatus == null ? null : deviceStatus.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.net_status
*
* @return the value of wlw_device.net_status
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public Integer getNetStatus() {
return netStatus;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.net_status
*
* @param netStatus the value for wlw_device.net_status
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public void setNetStatus(Integer netStatus) {
this.netStatus = netStatus;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column wlw_device.tenant_id
*
* @return the value of wlw_device.tenant_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public String getTenantId() {
return tenantId;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column wlw_device.tenant_id
*
* @param tenantId the value for wlw_device.tenant_id
*
* @mbg.generated Mon Dec 23 14:04:02 CST 2019
*/
public void setTenantId(String tenantId) {
this.tenantId = tenantId == null ? null : tenantId.trim();
}

/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table wlw_device
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
WlwDevice other = (WlwDevice) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
&& (this.getUpdatedDate() == null ? other.getUpdatedDate() == null : this.getUpdatedDate().equals(other.getUpdatedDate()))
&& (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getUpdaterId() == null ? other.getUpdaterId() == null : this.getUpdaterId().equals(other.getUpdaterId()))
&& (this.getDeviceName() == null ? other.getDeviceName() == null : this.getDeviceName().equals(other.getDeviceName()))
&& (this.getDeviceId() == null ? other.getDeviceId() == null : this.getDeviceId().equals(other.getDeviceId()))
&& (this.getDeviceSn() == null ? other.getDeviceSn() == null : this.getDeviceSn().equals(other.getDeviceSn()))
&& (this.getImei() == null ? other.getImei() == null : this.getImei().equals(other.getImei()))
&& (this.getImsi() == null ? other.getImsi() == null : this.getImsi().equals(other.getImsi()))
&& (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
&& (this.getAepProductId() == null ? other.getAepProductId() == null : this.getAepProductId().equals(other.getAepProductId()))
&& (this.getProjectId() == null ? other.getProjectId() == null : this.getProjectId().equals(other.getProjectId()))
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
&& (this.getLastUpTime() == null ? other.getLastUpTime() == null : this.getLastUpTime().equals(other.getLastUpTime()))
&& (this.getLastDownTime() == null ? other.getLastDownTime() == null : this.getLastDownTime().equals(other.getLastDownTime()))
&& (this.getDeviceStatus() == null ? other.getDeviceStatus() == null : this.getDeviceStatus().equals(other.getDeviceStatus()))
&& (this.getNetStatus() == null ? other.getNetStatus() == null : this.getNetStatus().equals(other.getNetStatus()))
&& (this.getTenantId() == null ? other.getTenantId() == null : this.getTenantId().equals(other.getTenantId()));
}

/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table wlw_device
*
* @mbg.generated Mon Dec 09 14:33:32 CST 2019
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
result = prime * result + ((getUpdatedDate() == null) ? 0 : getUpdatedDate().hashCode());
result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getUpdaterId() == null) ? 0 : getUpdaterId().hashCode());
result = prime * result + ((getDeviceName() == null) ? 0 : getDeviceName().hashCode());
result = prime * result + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode());
result = prime * result + ((getDeviceSn() == null) ? 0 : getDeviceSn().hashCode());
result = prime * result + ((getImei() == null) ? 0 : getImei().hashCode());
result = prime * result + ((getImsi() == null) ? 0 : getImsi().hashCode());
result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
result = prime * result + ((getAepProductId() == null) ? 0 : getAepProductId().hashCode());
result = prime * result + ((getProjectId() == null) ? 0 : getProjectId().hashCode());
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
result = prime * result + ((getLastUpTime() == null) ? 0 : getLastUpTime().hashCode());
result = prime * result + ((getLastDownTime() == null) ? 0 : getLastDownTime().hashCode());
result = prime * result + ((getDeviceStatus() == null) ? 0 : getDeviceStatus().hashCode());
result = prime * result + ((getNetStatus() == null) ? 0 : getNetStatus().hashCode());
result = prime * result + ((getTenantId() == null) ? 0 : getTenantId().hashCode());
return result;
}




您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1. 關聯 1.1 模型類關係 關係型資料庫的關係包括三種類型: ForeignKey:一對多,將欄位定義在多的一端中。 ManyToManyField:多對多,將欄位定義在任意一端中。 OneToOneField:一對一,將欄位定義在任意一端中。 1.1.1 一對多關係 #定義圖書模型類BookI ...
  • uwsgi -i 你的目錄/uwsgi.ini & 後臺開啟uwsgipkill -f uwsgi.ini 重啟uwsgi ...
  • 上面這張表格實際上是一個n行 6列的二維數組。 多維數組的語法: 註意:每一個中括弧表示一個維度。 習題 設計一個程式,可以保存n年的各科成績,可以對這些年的成績進行查詢。 測試用例:保存3年的成績,查詢第三年的生物成績。 ...
  • 很多人都礙於Python培訓班的高昂費用和有限的空餘時間都選擇自學Python,但是沒有老師幫助,顯得有些迷茫,不知應該從何處學起,也不知識看書學習還是應該看視頻學習。本就來談談這個話題。 ...
  • 一、安裝Docker 1、我是虛擬機裝的Centos7,linux 3.10 內核,docker官方說至少3.8以上,建議3.10以上(ubuntu下要linux內核3.8以上) root賬戶登錄,查看內核版本如下 uname -a 2、把yum包更新到最新 yum update (期間要選擇確認, ...
  • 一.常量 聲明常量可以方便代碼的修改,提高復用性. const int maxn=10000; const int N=10000+10; const double exp=1e-6; 同時,聲明常量也可以減少重覆運算,提高代碼速度,例子如下: string s; cin>>s; for(int i ...
  • 發現一個驗證字元串是否包含中文滴時候,一個比正則更好使滴方法,而且是golang 自帶滴驗證。 不需要自己寫正則驗證,代碼如下: package main import ( "fmt" "regexp" "unicode" ) func main() { s1 := "我是中國人hello word ...
  • 基本構架 所有的C程式都有一個 main 函數.其後包含在大括弧中的是 main 函數的內容. main函數是程式的入口,程式運行後,先進入 main 函數,然後一次執行 main 函數體中的語句. 這是一個例子: 簡單來說,寫在 main 中的內容會在程式啟動時執行.main 函數中的內容是程式的 ...
一周排行
    -Advertisement-
    Play Games
  • 1. 說明 /* Performs operations on System.String instances that contain file or directory path information. These operations are performed in a cross-pla ...
  • 視頻地址:【WebApi+Vue3從0到1搭建《許可權管理系統》系列視頻:搭建JWT系統鑒權-嗶哩嗶哩】 https://b23.tv/R6cOcDO qq群:801913255 一、在appsettings.json中設置鑒權屬性 /*jwt鑒權*/ "JwtSetting": { "Issuer" ...
  • 引言 集成測試可在包含應用支持基礎結構(如資料庫、文件系統和網路)的級別上確保應用組件功能正常。 ASP.NET Core 通過將單元測試框架與測試 Web 主機和記憶體中測試伺服器結合使用來支持集成測試。 簡介 集成測試與單元測試相比,能夠在更廣泛的級別上評估應用的組件,確認多個組件一起工作以生成預 ...
  • 在.NET Emit編程中,我們探討了運算操作指令的重要性和應用。這些指令包括各種數學運算、位操作和比較操作,能夠在動態生成的代碼中實現對數據的處理和操作。通過這些指令,開發人員可以靈活地進行算術運算、邏輯運算和比較操作,從而實現各種複雜的演算法和邏輯......本篇之後,將進入第七部分:實戰項目 ...
  • 前言 多表頭表格是一個常見的業務需求,然而WPF中卻沒有預設實現這個功能,得益於WPF強大的控制項模板設計,我們可以通過修改控制項模板的方式自己實現它。 一、需求分析 下圖為一個典型的統計表格,統計1-12月的數據。 此時我們有一個需求,需要將月份按季度劃分,以便能夠直觀地看到季度統計數據,以下為該需求 ...
  • 如何將 ASP.NET Core MVC 項目的視圖分離到另一個項目 在當下這個年代 SPA 已是主流,人們早已忘記了 MVC 以及 Razor 的故事。但是在某些場景下 SSR 還是有意想不到效果。比如某些靜態頁面,比如追求首屏載入速度的時候。最近在項目中回歸傳統效果還是不錯。 有的時候我們希望將 ...
  • System.AggregateException: 發生一個或多個錯誤。 > Microsoft.WebTools.Shared.Exceptions.WebToolsException: 生成失敗。檢查輸出視窗瞭解更多詳細信息。 內部異常堆棧跟蹤的結尾 > (內部異常 #0) Microsoft ...
  • 引言 在上一章節我們實戰了在Asp.Net Core中的項目實戰,這一章節講解一下如何測試Asp.Net Core的中間件。 TestServer 還記得我們在集成測試中提供的TestServer嗎? TestServer 是由 Microsoft.AspNetCore.TestHost 包提供的。 ...
  • 在發現結果為真的WHEN子句時,CASE表達式的真假值判斷會終止,剩餘的WHEN子句會被忽略: CASE WHEN col_1 IN ('a', 'b') THEN '第一' WHEN col_1 IN ('a') THEN '第二' ELSE '其他' END 註意: 統一各分支返回的數據類型. ...
  • 在C#編程世界中,語法的精妙之處往往體現在那些看似微小卻極具影響力的符號與結構之中。其中,“_ =” 這一組合突然出現還真不知道什麼意思。本文將深入剖析“_ =” 的含義、工作原理及其在實際編程中的廣泛應用,揭示其作為C#語法奇兵的重要角色。 一、下劃線 _:神秘的棄元符號 下劃線 _ 在C#中並非 ...