mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-29 08:05:04 +08:00
28 lines
540 B
Java
28 lines
540 B
Java
package love.sola.netsupport.enums;
|
|
|
|
import javax.persistence.AttributeConverter;
|
|
import javax.persistence.Converter;
|
|
|
|
/**
|
|
* @author Sola {@literal <dev@sola.love>}
|
|
*/
|
|
@Converter
|
|
public class ISPConverter implements AttributeConverter<ISP, Integer> {
|
|
|
|
@Override
|
|
public Integer convertToDatabaseColumn(ISP attribute) {
|
|
if (attribute == null) {
|
|
return null;
|
|
}
|
|
return attribute.id;
|
|
}
|
|
|
|
@Override
|
|
public ISP convertToEntityAttribute(Integer dbData) {
|
|
if (dbData == null) {
|
|
return null;
|
|
}
|
|
return ISP.fromId(dbData);
|
|
}
|
|
|
|
} |