beetlsql3-dev
parent
1c6fe06648
commit
8ffe9d542a
@ -0,0 +1,30 @@
|
|||||||
|
package com.ibeetl.admin.core.convert;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import com.alibaba.excel.converters.Converter;
|
||||||
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||||
|
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum and date converter
|
||||||
|
* 只支持取枚举中的desc属性
|
||||||
|
*
|
||||||
|
* @author mlx
|
||||||
|
*/
|
||||||
|
public class EnumDescConverter implements Converter<Enum> {
|
||||||
|
@Override
|
||||||
|
public Class<Enum> supportJavaTypeKey() {
|
||||||
|
return Enum.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WriteCellData<?> convertToExcelData(Enum value, ExcelContentProperty contentProperty,
|
||||||
|
GlobalConfiguration globalConfiguration) throws Exception {
|
||||||
|
String text = defaultIfNull(ReflectUtil.getFieldValue(value, "desc"), "").toString();
|
||||||
|
WriteCellData<?> cellData = new WriteCellData<>(text);
|
||||||
|
return cellData;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.ibeetl.admin.core.convert;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import com.alibaba.excel.converters.Converter;
|
||||||
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||||
|
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum and date converter
|
||||||
|
* 只支持取枚举中的text属性
|
||||||
|
*
|
||||||
|
* @author mlx
|
||||||
|
*/
|
||||||
|
public class EnumTextConverter implements Converter<Enum> {
|
||||||
|
@Override
|
||||||
|
public Class<Enum> supportJavaTypeKey() {
|
||||||
|
return Enum.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WriteCellData<?> convertToExcelData(Enum value, ExcelContentProperty contentProperty,
|
||||||
|
GlobalConfiguration globalConfiguration) throws Exception {
|
||||||
|
String text = defaultIfNull(ReflectUtil.getFieldValue(value, "text"), "").toString();
|
||||||
|
WriteCellData<?> cellData = new WriteCellData<>(text);
|
||||||
|
return cellData;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.ibeetl.jlw.entity.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.ibeetl.admin.core.convert.EnumTextConverter;
|
||||||
|
import com.ibeetl.admin.core.entity.BaseEntity;
|
||||||
|
import com.ibeetl.jlw.enums.ChatLogSendTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述: <br>
|
||||||
|
*
|
||||||
|
* @author: mlx
|
||||||
|
* @description:
|
||||||
|
* @date: 2022/12/12 23:10
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class TeacherOpenCourseChatLogGroupInfoVO extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提问方式
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "提问方式", converter = EnumTextConverter.class)
|
||||||
|
private ChatLogSendTypeEnum chatLogSendType;
|
||||||
|
/**
|
||||||
|
* 次数
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "次数")
|
||||||
|
private Integer chatCount;
|
||||||
|
/**
|
||||||
|
* 参与人数
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "参与人数")
|
||||||
|
private Integer joinCount;
|
||||||
|
/**
|
||||||
|
* 平均得分
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "平均得分")
|
||||||
|
private BigDecimal avgScore;
|
||||||
|
}
|
Loading…
Reference in New Issue