package com.bocloud.ims.entity.middleware;

import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 数据库用户类
 * 
 * @author weiwei
 *
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("rds_user")
public class RdsUser extends GenericEntity {

	@PK(PKStrategy.AUTO)
	private Long id;// ID
	@Column("username")
	private String username;// 用户名
	@Column("password")
	private String password;// 密码
	@Column("host")
	private String host;// 主机
	@Column("rds_id")
	private Long rdsId;// 数据库服务ID
	@Column("dbs")
	private String dbs;// 数据库实例ID集合
	@Column("permission")
	private String permission;
	@Column("privileges")
    private String privileges;
	@Column("vendor_id")
    private Long vendorId;
	@IgnoreAll
	private String newPassword;// 密码
	@IgnoreAll
	private List<RdsDb> grantDbs;
	@IgnoreAll
	private List<RdsDb> revokeDbs;
	@IgnoreAll
	private Long userId;

	/**
	 * 
	 * @param username
	 * @param password
	 * @param host
	 * @param rdsId
	 */
	public RdsUser(String username, String password, String host, Long rdsId) {
		super();
		this.username = username;
		this.password = password;
		this.host = host;
		this.rdsId = rdsId;
	}
}
