Преглед изворни кода

住户信息导出功能修复

xgb пре 2 недеља
родитељ
комит
5f22286984

+ 4 - 2
fs-admin/src/main/java/com/fs/admin/controller/CompanyAdminController.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -45,10 +47,10 @@ public class CompanyAdminController extends BaseController {
     @Log(title = "导出租户列表", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('admin:company:list')")
     @GetMapping("/export")
-    public AjaxResult export(TenantInfo tenantInfo) {
+    public void export(HttpServletResponse response, TenantInfo tenantInfo) throws IOException {
         List<TenantInfo> list = tenantInfoService.selectTenantInfoList(tenantInfo);
         ExcelUtil<TenantInfo> util = new ExcelUtil<>(TenantInfo.class);
-        return util.exportExcel(list, "租户列表数据");
+        util.exportExcel(response, list, "租户列表数据");
     }
 
     /**

+ 9 - 51
fs-service/src/main/java/com/fs/tenant/domain/TenantInfo.java

@@ -4,93 +4,52 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.util.Date;
 
-/**
- * 租户基础信息表
- * @TableName tenant_info
- */
 @Data
 @TableName(value ="tenant_info")
 public class TenantInfo {
-    /**
-     * 租户唯一ID
-     */
     @TableId(type = IdType.AUTO)
     private Long id;
 
-    /**
-     * 租户编码(唯一,如企业简称/编号)
-     */
+    @Excel(name = "租户编码")
     private String tenantCode;
 
-    /**
-     * 租户名称
-     */
+    @Excel(name = "租户名称")
     private String tenantName;
 
-    /**
-     * 状态:1-启用,0-禁用
-     */
+    @Excel(name = "状态", readConverterExp = "1=启用,0=禁用")
     private Integer status;
 
-    /**
-     * 租户有效期
-     */
+    @Excel(name = "到期时间", dateFormat = "yyyy-MM-dd")
     private Date expireTime;
 
-    /**
-     * 数据库ip
-     */
     private String dbIp;
 
-    /**
-     * 数据库端口
-     */
     private String dbPort;
 
-    /**
-     * 数据库连接地址
-     */
     private String dbUrl;
 
-    /**
-     * 数据库帐号
-     */
     private String dbAccount;
 
-    /**
-     * 数据库密码
-     */
     private String dbPwd;
 
-    /**
-     * 数据库名称
-     */
+    @Excel(name = "数据库名称")
     private String dbName;
 
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
-    /**
-     * 更新时间
-     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
-    /**
-     * 联系电话
-     */
+    @Excel(name = "联系电话")
     private String contactPhone;
 
-    /**
-     * 联系人
-     */
+    @Excel(name = "联系人")
     private String contactName;
 
     private Integer companyNum;
@@ -99,6 +58,5 @@ public class TenantInfo {
 
     private String feePlanCode;
 
-
     private String billingMode;
 }