You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

73 lines
1.9 KiB

package app.entities.db;
import app.utils.SteamIDConverter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;
import java.sql.ResultSet;
import java.sql.SQLException;
/*
CREATE TABLE `bot_admins` (
`id` int(11) NOT NULL,
`vk_id` int(11) NOT NULL,
`discord_id` bigint(20) NOT NULL,
`discord_name` text NOT NULL,
`steam3` text NOT NULL,
`permition` int(11) NOT NULL COMMENT 'ADMIN = 10 MODDER = 5'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
*/
@Data
@Entity
@Table(name = "bot_admins", schema = "tf2_facti13")
public class AdminInfo {
@JsonIgnore
@Id
@Column(name = "id")
int id;
@Column(name = "vk_id", nullable = false)
int vk_id;
@Column(name = "discord_id", nullable = false)
long discord_id;
@Column(name = "discord_name", nullable = false)
String discord_name;
@Column(name = "steam3", nullable = false)
@JsonIgnore
String steam3;
String steam_url;
@JsonIgnore
@Column(name = "permition", nullable = false)
int permition;
public AdminInfo(Object[] obj) {
id = (int) obj[0];
vk_id = (int) obj[1];
discord_id = (long) obj[2];
discord_name = (String) obj[3];
steam3 = (String) obj[4];
permition = (int) obj[5];
steam_url = SteamIDConverter.getSteamID(steam3).community_url;
}
public AdminInfo(ResultSet resultSet) throws SQLException {
id = resultSet.getInt("id");
vk_id = resultSet.getInt("vk_id");
discord_id = resultSet.getLong("discord_id");
discord_name = resultSet.getString("discord_name");
steam3 = resultSet.getString("steam3");
permition = resultSet.getInt("permition");
steam_url = SteamIDConverter.getSteamID(steam3).community_url;
}
public AdminInfo() {
}
}