Parcourir la source

去掉自定义导出注解column列

RuoYi il y a 6 ans
Parent
commit
d891a2ee2b

+ 4 - 0
src/main/java/com/ruoyi/common/utils/http/HttpUtils.java

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

+ 20 - 20
src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

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

+ 0 - 5
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Excel.java

@@ -19,11 +19,6 @@ public @interface Excel
      */
     public abstract String name();
 
-    /**
-     * 配置列的名称
-     */
-    public abstract String column();
-
     /**
      * 提示信息
      */

+ 7 - 7
src/main/java/com/ruoyi/project/monitor/job/domain/Job.java

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

+ 8 - 8
src/main/java/com/ruoyi/project/monitor/job/domain/JobLog.java

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

+ 9 - 9
src/main/java/com/ruoyi/project/monitor/logininfor/domain/Logininfor.java

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

+ 28 - 28
src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java

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

+ 9 - 10
src/main/java/com/ruoyi/project/system/config/domain/Config.java

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

+ 8 - 8
src/main/java/com/ruoyi/project/system/dict/domain/DictData.java

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

+ 4 - 4
src/main/java/com/ruoyi/project/system/dict/domain/DictType.java

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

+ 5 - 5
src/main/java/com/ruoyi/project/system/post/domain/Post.java

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

+ 5 - 5
src/main/java/com/ruoyi/project/system/role/domain/Role.java

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

+ 9 - 9
src/main/java/com/ruoyi/project/system/user/domain/User.java

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