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

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

功能描述:做的是物聯網的項目,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("[email protected]@@--------");
} 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;
}




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

更多相關文章
  • 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 函數中的內容是程式的 ...
一周排行
  • 《ASP.NET MVC 企業級實戰》 [作者] (中) 鄒瓊俊[出版] 清華大學出版社[版次] 2017年04月 第1版[印次] 2019年08月 第6次 印刷[定價] 89.00元 【第01章】 (P021) 只有在 Lambda 有一個輸入參數時,括弧才是可選的,否則括弧是必需的。 使用空括弧 ...
  • 上一篇(https://www.cnblogs.com/meowv/p/12971041.html)使用HtmlAgilityPack抓取壁紙數據成功將圖片存入資料庫,本篇繼續來完成一個全網各大平臺的熱點新聞數據的抓取。 同樣的,可以先預覽一下我個人博客中的成品:https://meowv.com/ ...
  • 前言 請了一天假後回公司,同事跟我說使用Newtonsoft.json序列化TreeView對象的時候出現報錯; 啊!什麼?這個類庫不是能夠序列化所有東西嗎?真的很懵逼,也是我第一次使用這個類庫出現問題! 問題異常 異常信息 : Newtonsoft.Json.JsonSerializationEx ...
  • 簡單瞭解下麵詞語的意思 節點:二叉樹中每個元素都稱為節點 葉子節點(簡稱:葉子):度為0的節點,葉子節點就是樹中最底段的節點,葉子節點沒有子節點,也叫終端結點 分枝節點:度不為0的結點 節點的度:二叉樹的度代表某個節點的孩子或者說直接後繼的個數,簡單說就是一個節點擁有的子樹數 樹的度: 樹中最大的結 ...
  • C# 中的LINQ 提供了兩種操作方式,查詢表達式和查詢操作符,所有的查詢表達式都有對應的查操作符類替代,查詢表達式有點“類” SQL,在代碼中寫SQL,總覺得不夠“優雅”,使用查詢操作符就顯得“優雅”很多, 本系列就來對所有的LINQ 標準操作符進行一個全面的總結,這些操作符和我上篇文章總結的Rx ...
  • 在Startup ConfigureServices 註冊本地化所需要的服務AddLocalization和 Configure<RequestLocalizationOptions> public void ConfigureServices(IServiceCollection services ...
  • 為什麼需要持久化,以及Redis持久化的RDB方式在這篇文章講的已經很透徹了,足以弔打面試官了。而且此篇內容需要RDB文章的內容支持,所以建議先看下:看完這篇還不懂Redis的RDB持久化,你們來打我! 一、什麼是AOF 它也是Redis持久化的重要手段之一,aof->Append Only Fil ...
  • 先上圖: @IT程式猿 微博網友評論: @迢書:前同事的,親眼見過 @AvenGeeker:Bug 404 @科技州:這是要逼死強迫症 @小島一瞥:哈哈哈哈哈我老家的車 最後小編整理了一套技術資料不僅能精準消除技術盲點、累計面試經驗,更可以攻剋JVM、Spring、分散式、微服務等技術難題。 海量電 ...
  • 概括來說,分三步: 1,首先找到是哪個進程的CPU占有率飆到了100%。 2,根據進程號pid,定位到是哪個線程,找到對應線程的tid。 3,導出對應線程的dump日誌文件,分析日誌文件定位具體代碼。 要解決這個問題,你應該具備以下技能: 1,linux的top命令。 2,jvm監控工具jps。 3 ...
  • 寫在最後 程式員為何害怕【別人的代碼】呢?這讓我想起一個段子。 寫這段代碼時 只有上帝和我知道他是幹嘛的 現在 只有上帝知道了 別人的代碼,似乎總意味著冗長、晦澀、凌亂,給人一種不想靠近的感覺。搞笑的是,對於一些程式員而言,即使是自己的代碼,在一段時間之後自己再拿來看,也成了【別人的代碼】... 作 ...