luojun 2 лет назад
Родитель
Сommit
9c0917c3a6

+ 5 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysUserController.java

@@ -485,8 +485,12 @@ public class SysUserController extends BaseController {
     @PostMapping("/export")
     public void export(SysUser user, HttpServletResponse response) {
         List<UserExport> list=null;
+        Set<String> excludeColumnFiledNames = new HashSet<String>();
+
         //如果导出模板
         if(user.getTemplate()!=null&&user.getTemplate()){
+            excludeColumnFiledNames.add("lastIp");
+            excludeColumnFiledNames.add("lastTime");
             list = new ArrayList<>();
         }else{
             list= userService.down(user);
@@ -513,7 +517,7 @@ public class SysUserController extends BaseController {
             response.setContentType("application/octet-stream;charset=UTF-8");
             response.setCharacterEncoding("utf-8");
             // 数据导出
-            EasyExcel.write(response.getOutputStream(), UserExport.class)
+            EasyExcel.write(response.getOutputStream(), UserExport.class).excludeColumnFiledNames(excludeColumnFiledNames)
                     .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("用户数据").doWrite(list);
         } catch (Exception e) {
             // 重置response

+ 10 - 10
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/UserExport.java

@@ -18,25 +18,25 @@ import java.util.Date;
 @HeadRowHeight(16) //表头行高
 @ContentRowHeight(16) //数据行高
 public class UserExport {
-    @ExcelProperty(value = "序号", index = 1)
+    @ExcelProperty(value = "序号", index = 0)
     @TableField(exist = false)
     private String xh;
-    @ExcelProperty(value = "用户账号", index = 2)
+    @ExcelProperty(value = "用户账号", index = 1)
     private String username;
-    @ExcelProperty(value = "用户姓名", index = 3)
+    @ExcelProperty(value = "用户姓名", index = 2)
     private String name;
-    @ExcelProperty(value = "所属机构", index = 4)
+    @ExcelProperty(value = "所属机构", index = 3)
     private String orgName;
-    @ExcelProperty(value = "用户角色", index = 5)
+    @ExcelProperty(value = "用户角色", index = 4)
     private String roleNames;
-    @ExcelProperty(value = "手机号码", index = 6)
+    @ExcelProperty(value = "手机号码", index = 5)
     private String phone;
-    @ExcelProperty(value = "状态", index = 7, converter = UserStatusConverter.class)
+    @ExcelProperty(value = "状态", index = 6, converter = UserStatusConverter.class)
     private String isLock;
-    @ExcelProperty(value = "是否管理人员", index = 8, converter = UserManagerConverter.class)
+    @ExcelProperty(value = "是否管理人员", index = 7, converter = UserManagerConverter.class)
     private String isManager;
-    @ExcelProperty(value = "登录IP", index = 9)
+    @ExcelProperty(value = "登录IP", index = 8)
     private String lastIp;
-    @ExcelProperty(value = "登录时间", index = 10)
+    @ExcelProperty(value = "登录时间", index = 9)
     private Date lastTime;
 }

+ 4 - 1
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -615,7 +615,7 @@
         SELECT
         #         h.user_id AS is_manager,
         GROUP_CONCAT(sr.role_name) role_names,
-        CONCAT(",",GROUP_CONCAT( sr.id ),",") as roleIds,
+        CONCAT(',',GROUP_CONCAT( sr.id ),',') as roleIds,
         u.id,
         u.dept_id,
         u.is_lock,
@@ -683,6 +683,9 @@
         <if test="info.roleId != null and info.roleId != ''">
             AND sr.id =#{info.roleId}
         </if>
+        <if test="info.onlyManager ==true">
+            AND u.is_manage ='Y'
+        </if>
         <if test="info.params.beginTime != null and info.params.beginTime != ''">
             <!-- 开始时间检索 -->
             AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{info.params.beginTime},'%y%m%d')