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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package com.entity.view ;
import com.entity.DictionaryEntity ;
import com.baomidou.mybatisplus.annotations.TableName ;
import org.apache.commons.beanutils.BeanUtils ;
import java.lang.reflect.InvocationTargetException ;
import org.springframework.format.annotation.DateTimeFormat ;
import com.fasterxml.jackson.annotation.JsonFormat ;
import java.io.Serializable ;
import java.util.Date ;
/**
* 字典表
* 后端返回视图实体辅助类
* (通常后端关联的表或者自定义的字段需要返回使用)
*/
// 使用TableName注解指定该类对应的数据库表名为 "dictionary"
@TableName ( "dictionary" )
// DictionaryView类继承自DictionaryEntity类, 并实现了Serializable接口,
// 使得该类的对象可以被序列化和反序列化,方便在网络传输或存储中使用
public class DictionaryView extends DictionaryEntity implements Serializable {
// 序列化版本号,用于确保在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L ;
// 无参构造函数, 用于创建DictionaryView对象, 在不需要初始化特定属性时使用
public DictionaryView ( ) {
}
// 构造函数, 接受一个DictionaryEntity对象作为参数
// 通过BeanUtils.copyProperties方法将DictionaryEntity对象的属性值复制到当前DictionaryView对象中
// 这样可以方便地从Entity对象转换为View对象, 减少手动赋值的工作量
public DictionaryView ( DictionaryEntity dictionaryEntity ) {
try {
BeanUtils . copyProperties ( this , dictionaryEntity ) ;
} catch ( IllegalAccessException | InvocationTargetException e ) {
// 如果在复制属性过程中发生异常(例如属性访问权限问题或反射调用目标方法失败)
// 打印异常堆栈信息,以便开发人员调试和定位问题
e . printStackTrace ( ) ;
}
}
}