後端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
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...