去掉自定义导出注解column列

dep_wangsr
RuoYi 6 years ago committed by Limy
parent 83e1f92034
commit 15df606003

@ -224,14 +224,17 @@ public class HttpUtils
private static class TrustAnyTrustManager implements X509TrustManager private static class TrustAnyTrustManager implements X509TrustManager
{ {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) public void checkClientTrusted(X509Certificate[] chain, String authType)
{ {
} }
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) public void checkServerTrusted(X509Certificate[] chain, String authType)
{ {
} }
@Override
public X509Certificate[] getAcceptedIssuers() public X509Certificate[] getAcceptedIssuers()
{ {
return new X509Certificate[] {}; return new X509Certificate[] {};
@ -240,6 +243,7 @@ public class HttpUtils
private static class TrustAnyHostnameVerifier implements HostnameVerifier private static class TrustAnyHostnameVerifier implements HostnameVerifier
{ {
@Override
public boolean verify(String hostname, SSLSession session) public boolean verify(String hostname, SSLSession session)
{ {
return true; return true;

@ -73,13 +73,12 @@ public class ExcelUtil<T>
// 有数据时才处理 // 有数据时才处理
Field[] allFields = clazz.getDeclaredFields(); // 得到类的所有field. Field[] allFields = clazz.getDeclaredFields(); // 得到类的所有field.
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>(); // 定义一个map用于存放列的序号和field. Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>(); // 定义一个map用于存放列的序号和field.
for (Field field : allFields) for (int col = 0; col < allFields.length; col++)
{ {
Field field = allFields[col];
// 将有注解的field存放到map中. // 将有注解的field存放到map中.
if (field.isAnnotationPresent(Excel.class)) if (field.isAnnotationPresent(Excel.class))
{ {
Excel attr = field.getAnnotation(Excel.class);
int col = getExcelCol(attr.column());// 获得列号
field.setAccessible(true);// 设置类的私有字段属性可访问. field.setAccessible(true);// 设置类的私有字段属性可访问.
fieldsMap.put(col, field); fieldsMap.put(col, field);
} }
@ -215,8 +214,7 @@ public class ExcelUtil<T>
{ {
Field field = fields.get(i); Field field = fields.get(i);
Excel attr = field.getAnnotation(Excel.class); Excel attr = field.getAnnotation(Excel.class);
int col = getExcelCol(attr.column()); // 获得列号 cell = row.createCell(i); // 创建列
cell = row.createCell(col); // 创建列
cell.setCellType(HSSFCell.CELL_TYPE_STRING); // 设置列中写入内容为String类型 cell.setCellType(HSSFCell.CELL_TYPE_STRING); // 设置列中写入内容为String类型
HSSFCellStyle cellStyle = workbook.createCellStyle(); HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
@ -247,12 +245,12 @@ public class ExcelUtil<T>
// 如果设置了提示信息则鼠标放上去提示. // 如果设置了提示信息则鼠标放上去提示.
if (!attr.prompt().trim().equals("")) if (!attr.prompt().trim().equals(""))
{ {
setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, col, col); // 这里默认设了2-101列提示. setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, i, i); // 这里默认设了2-101列提示.
} }
// 如果设置了combo属性则本列只能选择不能输入 // 如果设置了combo属性则本列只能选择不能输入
if (attr.combo().length > 0) if (attr.combo().length > 0)
{ {
setHSSFValidation(sheet, attr.combo(), 1, 100, col, col); // 这里默认设了2-101列只能选择不能输入. setHSSFValidation(sheet, attr.combo(), 1, 100, i, i); // 这里默认设了2-101列只能选择不能输入.
} }
} }
@ -276,12 +274,14 @@ public class ExcelUtil<T>
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport()) if (attr.isExport())
{ {
cell = row.createCell(getExcelCol(attr.column()));// 创建cell cell = row.createCell(j);// 创建cell
cell.setCellStyle(cs); cell.setCellStyle(cs);
try try
{ {
if (String.valueOf(field.get(vo)).length() > 10) if (String.valueOf(field.get(vo)).length() > 10)
{
throw new Exception("长度超过10位就不用转数字了"); throw new Exception("长度超过10位就不用转数字了");
}
// 如果可以转成数字则导出为数字类型 // 如果可以转成数字则导出为数字类型
BigDecimal bc = new BigDecimal(String.valueOf(field.get(vo))); BigDecimal bc = new BigDecimal(String.valueOf(field.get(vo)));
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
@ -329,18 +329,18 @@ public class ExcelUtil<T>
* *
* @param col * @param col
*/ */
public static int getExcelCol(String col) // public static int getExcelCol(String col)
{ // {
col = col.toUpperCase(); // col = col.toUpperCase();
// 从-1开始计算,字母重1开始运算。这种总数下来算数正好相同。 // // 从-1开始计算,字母重1开始运算。这种总数下来算数正好相同。
int count = -1; // int count = -1;
char[] cs = col.toCharArray(); // char[] cs = col.toCharArray();
for (int i = 0; i < cs.length; i++) // for (int i = 0; i < cs.length; i++)
{ // {
count += (cs[i] - 64) * Math.pow(26, cs.length - 1 - i); // count += (cs[i] - 64) * Math.pow(26, cs.length - 1 - i);
} // }
return count; // return count;
} // }
/** /**
* *

@ -19,11 +19,6 @@ public @interface Excel
*/ */
public abstract String name(); public abstract String name();
/**
*
*/
public abstract String column();
/** /**
* *
*/ */

@ -15,31 +15,31 @@ public class Job extends BaseEntity implements Serializable
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 任务ID */ /** 任务ID */
@Excel(name = "任务序号", column = "A") @Excel(name = "任务序号")
private Long jobId; private Long jobId;
/** 任务名称 */ /** 任务名称 */
@Excel(name = "任务名称", column = "B") @Excel(name = "任务名称")
private String jobName; private String jobName;
/** 任务组名 */ /** 任务组名 */
@Excel(name = "任务组名", column = "C") @Excel(name = "任务组名")
private String jobGroup; private String jobGroup;
/** 任务方法 */ /** 任务方法 */
@Excel(name = "任务方法", column = "D") @Excel(name = "任务方法")
private String methodName; private String methodName;
/** 方法参数 */ /** 方法参数 */
@Excel(name = "方法参数", column = "E") @Excel(name = "方法参数")
private String params; private String params;
/** cron执行表达式 */ /** cron执行表达式 */
@Excel(name = "执行表达式 ", column = "F") @Excel(name = "执行表达式 ")
private String cronExpression; private String cronExpression;
/** 任务状态0正常 1暂停 */ /** 任务状态0正常 1暂停 */
@Excel(name = "任务状态", column = "G") @Excel(name = "任务状态")
private String status; private String status;
public Long getJobId() public Long getJobId()

@ -13,35 +13,35 @@ public class JobLog extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@Excel(name = "日志序号", column = "A") @Excel(name = "日志序号")
private Long jobLogId; private Long jobLogId;
/** 任务名称 */ /** 任务名称 */
@Excel(name = "任务名称", column = "B") @Excel(name = "任务名称")
private String jobName; private String jobName;
/** 任务组名 */ /** 任务组名 */
@Excel(name = "任务组名", column = "C") @Excel(name = "任务组名")
private String jobGroup; private String jobGroup;
/** 任务方法 */ /** 任务方法 */
@Excel(name = "任务方法", column = "D") @Excel(name = "任务方法")
private String methodName; private String methodName;
/** 方法参数 */ /** 方法参数 */
@Excel(name = "方法参数", column = "E") @Excel(name = "方法参数")
private String params; private String params;
/** 日志信息 */ /** 日志信息 */
@Excel(name = "日志信息", column = "F") @Excel(name = "日志信息")
private String jobMessage; private String jobMessage;
/** 执行状态0正常 1失败 */ /** 执行状态0正常 1失败 */
@Excel(name = "执行状态", column = "G") @Excel(name = "执行状态")
private String status; private String status;
/** 异常信息 */ /** 异常信息 */
@Excel(name = "异常信息", column = "H") @Excel(name = "异常信息")
private String exceptionInfo; private String exceptionInfo;
public Long getJobLogId() public Long getJobLogId()

@ -13,31 +13,31 @@ public class Logininfor extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@Excel(name = "序号", column = "A") @Excel(name = "序号")
private Integer infoId; private Integer infoId;
/** 用户账号 */ /** 用户账号 */
@Excel(name = "用户账号", column = "B") @Excel(name = "用户账号")
private String loginName; private String loginName;
/** 登录状态 0成功 1失败 */ /** 登录状态 0成功 1失败 */
@Excel(name = "登录状态", column = "C") @Excel(name = "登录状态")
private String status; private String status;
/** 登录IP地址 */ /** 登录IP地址 */
@Excel(name = "登录地址", column = "D") @Excel(name = "登录地址")
private String ipaddr; private String ipaddr;
/** 登录地点 */ /** 登录地点 */
@Excel(name = "登录地点", column = "E") @Excel(name = "登录地点")
private String loginLocation; private String loginLocation;
/** 浏览器类型 */ /** 浏览器类型 */
@Excel(name = "浏览器", column = "F") @Excel(name = "浏览器")
private String browser; private String browser;
/** 操作系统 */ /** 操作系统 */
@Excel(name = "操作系统 ", column = "G") @Excel(name = "操作系统 ")
private String os; private String os;
/** 提示消息 */ /** 提示消息 */
@Excel(name = "提示消息", column = "H") @Excel(name = "提示消息")
private String msg; private String msg;
/** 访问时间 */ /** 访问时间 */
@Excel(name = "访问时间", column = "I") @Excel(name = "访问时间")
private Date loginTime; private Date loginTime;
public Integer getInfoId() public Integer getInfoId()

@ -15,59 +15,59 @@ public class OperLog extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 日志主键 */ /** 日志主键 */
@Excel(name = "操作序号", column = "A") @Excel(name = "操作序号")
private Integer operId; private Integer operId;
/** 操作模块 */ /** 操作模块 */
@Excel(name = "操作模块", column = "B") @Excel(name = "操作模块")
private String title; private String title;
/** 操作类型 */ /** 操作类型 */
@Excel(name = "操作类型", column = "C") @Excel(name = "操作类型")
private String action; private String action;
/** 请求方法 */ /** 请求方法 */
@Excel(name = "请求方法", column = "D") @Excel(name = "请求方法")
private String method; private String method;
/** 来源渠道 */ /** 来源渠道 */
@Excel(name = "来源渠道", column = "E") @Excel(name = "来源渠道")
private String channel; private String channel;
/** 操作人员 */ /** 操作人员 */
@Excel(name = "操作人员", column = "F") @Excel(name = "操作人员")
private String operName; private String operName;
/** 部门名称 */ /** 部门名称 */
@Excel(name = "部门名称", column = "G") @Excel(name = "部门名称")
private String deptName; private String deptName;
/** 请求url */ /** 请求url */
@Excel(name = "请求地址", column = "H") @Excel(name = "请求地址")
private String operUrl; private String operUrl;
/** 操作地址 */ /** 操作地址 */
@Excel(name = "操作地址", column = "I") @Excel(name = "操作地址")
private String operIp; private String operIp;
/** 操作地点 */ /** 操作地点 */
@Excel(name = "操作地点", column = "J") @Excel(name = "操作地点")
private String operLocation; private String operLocation;
/** 请求参数 */ /** 请求参数 */
@Excel(name = "请求参数", column = "K") @Excel(name = "请求参数")
private String operParam; private String operParam;
/** 状态0正常 1异常 */ /** 状态0正常 1异常 */
@Excel(name = "状态", column = "L") @Excel(name = "状态")
private String status; private String status;
/** 错误消息 */ /** 错误消息 */
@Excel(name = "错误消息", column = "N") @Excel(name = "错误消息")
private String errorMsg; private String errorMsg;
/** 操作时间 */ /** 操作时间 */
@Excel(name = "操作时间", column = "M") @Excel(name = "操作时间")
private Date operTime; private Date operTime;
public Integer getOperId() public Integer getOperId()

@ -13,26 +13,25 @@ public class Config extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 参数主键 */ /** 参数主键 */
@Excel(name = "参数主键", column = "A") @Excel(name = "参数主键")
private Integer configId; private Integer configId;
/** 参数名称 */ /** 参数名称 */
@Excel(name = "参数名称", column = "B") @Excel(name = "参数名称")
private String configName; private String configName;
/** 参数键名 */ /** 参数键名 */
@Excel(name = "参数键名", column = "C") @Excel(name = "参数键名")
private String configKey; private String configKey;
/** 参数键值 */ /** 参数键值 */
@Excel(name = "参数键值", column = "D") @Excel(name = "参数键值")
private String configValue; private String configValue;
/** 系统内置Y是 N否 */ /** 系统内置Y是 N否 */
@Excel(name = "系统内置", column = "E") @Excel(name = "系统内置")
private String configType; private String configType;
public Integer getConfigId() public Integer getConfigId()
{ {
return configId; return configId;

@ -13,35 +13,35 @@ public class DictData extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典编码 */ /** 字典编码 */
@Excel(name = "字典编码", column = "A") @Excel(name = "字典编码")
private Long dictCode; private Long dictCode;
/** 字典排序 */ /** 字典排序 */
@Excel(name = "字典排序", column = "B") @Excel(name = "字典排序")
private Long dictSort; private Long dictSort;
/** 字典标签 */ /** 字典标签 */
@Excel(name = "字典标签", column = "C") @Excel(name = "字典标签")
private String dictLabel; private String dictLabel;
/** 字典键值 */ /** 字典键值 */
@Excel(name = "字典键值", column = "D") @Excel(name = "字典键值")
private String dictValue; private String dictValue;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型", column = "E") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 字典样式 */ /** 字典样式 */
@Excel(name = "字典样式", column = "F") @Excel(name = "字典样式")
private String cssClass; private String cssClass;
/** 是否默认Y是 N否 */ /** 是否默认Y是 N否 */
@Excel(name = "是否默认", column = "G") @Excel(name = "是否默认")
private String isDefault; private String isDefault;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", column = "H") @Excel(name = "状态")
private String status; private String status;
public Long getDictCode() public Long getDictCode()

@ -13,19 +13,19 @@ public class DictType extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典主键 */ /** 字典主键 */
@Excel(name = "字典主键", column = "A") @Excel(name = "字典主键")
private Long dictId; private Long dictId;
/** 字典名称 */ /** 字典名称 */
@Excel(name = "字典名称", column = "B") @Excel(name = "字典名称")
private String dictName; private String dictName;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型 ", column = "C") @Excel(name = "字典类型 ")
private String dictType; private String dictType;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", column = "D") @Excel(name = "状态")
private String status; private String status;
public Long getDictId() public Long getDictId()

@ -13,23 +13,23 @@ public class Post extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 岗位序号 */ /** 岗位序号 */
@Excel(name = "岗位序号", column = "A") @Excel(name = "岗位序号")
private Long postId; private Long postId;
/** 岗位编码 */ /** 岗位编码 */
@Excel(name = "岗位编码", column = "B") @Excel(name = "岗位编码")
private String postCode; private String postCode;
/** 岗位名称 */ /** 岗位名称 */
@Excel(name = "岗位名称", column = "C") @Excel(name = "岗位名称")
private String postName; private String postName;
/** 岗位排序 */ /** 岗位排序 */
@Excel(name = "岗位排序", column = "D") @Excel(name = "岗位排序")
private String postSort; private String postSort;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", column = "E") @Excel(name = "状态")
private String status; private String status;
/** 用户是否存在此岗位标识 默认不存在 */ /** 用户是否存在此岗位标识 默认不存在 */

@ -15,23 +15,23 @@ public class Role extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 角色ID */ /** 角色ID */
@Excel(name = "角色序号", column = "A") @Excel(name = "角色序号")
private Long roleId; private Long roleId;
/** 角色名称 */ /** 角色名称 */
@Excel(name = "角色名称", column = "B") @Excel(name = "角色名称")
private String roleName; private String roleName;
/** 角色权限 */ /** 角色权限 */
@Excel(name = "角色权限", column = "C") @Excel(name = "角色权限")
private String roleKey; private String roleKey;
/** 角色排序 */ /** 角色排序 */
@Excel(name = "角色排序", column = "D") @Excel(name = "角色排序")
private String roleSort; private String roleSort;
/** 角色状态0正常 1停用 */ /** 角色状态0正常 1停用 */
@Excel(name = "角色状态", column = "E") @Excel(name = "角色状态")
private String status; private String status;
/** 用户是否存在此角色标识 默认不存在 */ /** 用户是否存在此角色标识 默认不存在 */

@ -18,7 +18,7 @@ public class User extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /** 用户ID */
@Excel(name = "用户序号", column = "A") @Excel(name = "用户序号")
private Long userId; private Long userId;
/** 部门ID */ /** 部门ID */
@ -28,23 +28,23 @@ public class User extends BaseEntity
private Long parentId; private Long parentId;
/** 登录名称 */ /** 登录名称 */
@Excel(name = "登录名称", column = "B") @Excel(name = "登录名称")
private String loginName; private String loginName;
/** 用户名称 */ /** 用户名称 */
@Excel(name = "用户名称", column = "C") @Excel(name = "用户名称")
private String userName; private String userName;
/** 用户邮箱 */ /** 用户邮箱 */
@Excel(name = "用户邮箱", column = "D") @Excel(name = "用户邮箱")
private String email; private String email;
/** 手机号码 */ /** 手机号码 */
@Excel(name = "手机号码", column = "E") @Excel(name = "手机号码")
private String phonenumber; private String phonenumber;
/** 用户性别 */ /** 用户性别 */
@Excel(name = "用户性别", column = "F") @Excel(name = "用户性别")
private String sex; private String sex;
/** 用户头像 */ /** 用户头像 */
@ -57,18 +57,18 @@ public class User extends BaseEntity
private String salt; private String salt;
/** 帐号状态0正常 1停用 */ /** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态", column = "G") @Excel(name = "帐号状态")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 最后登陆IP */ /** 最后登陆IP */
@Excel(name = "最后登陆IP", column = "H") @Excel(name = "最后登陆IP")
private String loginIp; private String loginIp;
/** 最后登陆时间 */ /** 最后登陆时间 */
@Excel(name = "最后登陆时间", column = "I") @Excel(name = "最后登陆时间")
private Date loginDate; private Date loginDate;
/** 部门对象 */ /** 部门对象 */

Loading…
Cancel
Save