add jdbc
parent
4c6a87b354
commit
b32202b1c4
@ -0,0 +1,18 @@
|
||||
package com.rehome.mqttclienttemperature.datasource;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据源实体类
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DataSource {
|
||||
String id;
|
||||
String name;
|
||||
String url;
|
||||
String username;
|
||||
String password;
|
||||
String driver;
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.rehome.mqttclienttemperature.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 返回值包装类
|
||||
*/
|
||||
@Data
|
||||
public class ResponseDto {
|
||||
String msg;
|
||||
Object data;
|
||||
boolean success;
|
||||
public static ResponseDto apiSuccess(Object data) {
|
||||
ResponseDto dto = new ResponseDto();
|
||||
dto.setData(data);
|
||||
dto.setSuccess(true);
|
||||
dto.setMsg("接口访问成功");
|
||||
return dto;
|
||||
}
|
||||
|
||||
public static ResponseDto successWithMsg(String msg) {
|
||||
ResponseDto dto = new ResponseDto();
|
||||
dto.setData(null);
|
||||
dto.setSuccess(true);
|
||||
dto.setMsg(msg);
|
||||
return dto;
|
||||
}
|
||||
|
||||
public static ResponseDto successWithData(Object data) {
|
||||
ResponseDto dto = new ResponseDto();
|
||||
dto.setData(data);
|
||||
dto.setSuccess(true);
|
||||
return dto;
|
||||
}
|
||||
|
||||
public static ResponseDto fail(String msg) {
|
||||
ResponseDto dto = new ResponseDto();
|
||||
dto.setSuccess(false);
|
||||
dto.setMsg(msg);
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue