适配postgres数据库

This commit is contained in:
leesam
2024-04-10 22:16:56 +08:00
parent 16b7e4a7ef
commit 53199b32f6
4 changed files with 35 additions and 8 deletions

View File

@@ -10,7 +10,8 @@ import java.util.List;
@Repository
public interface UserApiKeyMapper {
@SelectKey(statement = "SELECT LAST_INSERT_ID() AS id", keyProperty = "id", before = false, resultType = Integer.class)
@SelectKey(databaseId = "postgresql", statement = "SELECT currval('wvp_user_api_key_id_seq'::regclass) AS id", keyProperty = "id", before = false, resultType = Integer.class)
@SelectKey(databaseId = "mysql", statement = "SELECT LAST_INSERT_ID() AS id", keyProperty = "id", before = false, resultType = Integer.class)
@Insert("INSERT INTO wvp_user_api_key (user_id, app, api_key, expired_at, remark, enable, create_time, update_time) VALUES" +
"(#{userId}, #{app}, #{apiKey}, #{expiredAt}, #{remark}, #{enable}, #{createTime}, #{updateTime})")
int add(UserApiKey userApiKey);

View File

@@ -38,7 +38,7 @@ public class UserApiKey implements Serializable {
* 过期时间null=永不过期)
*/
@Schema(description = "过期时间null=永不过期)")
private String expiredAt;
private long expiredAt;
/**
* 备注信息
@@ -101,11 +101,11 @@ public class UserApiKey implements Serializable {
this.apiKey = apiKey;
}
public String getExpiredAt() {
public long getExpiredAt() {
return expiredAt;
}
public void setExpiredAt(String expiredAt) {
public void setExpiredAt(long expiredAt) {
this.expiredAt = expiredAt;
}