Commit 741a18f2 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 6b65fc09 6920bfb4
package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
......@@ -42,17 +27,11 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
......@@ -73,13 +52,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
*/
@Override
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){
String fileName = "新权限-用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<SysUserPermission> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
try (ServletOutputStream out = response.getOutputStream()){
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
......@@ -87,7 +64,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; ) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
......@@ -99,34 +76,24 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
......
......@@ -36,44 +36,26 @@
<sql id="sysUserPermission_where">
<if test="sysUserPermission != null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME = #{sysUserPermission.empName}
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND a.EMP_DEPT = #{sysUserPermission.empDept}
AND a.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%')
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME = #{sysUserPermission.name}
AND a.NAME like concat('%',#{sysUserPermission.name},'%')
</if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code}
</if>
<if test="sysUserPermission.isContains != null and sysUserPermission.isContains.trim() != ''">
AND a.IS_CONTAINS = #{sysUserPermission.isContains}
</if>
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
<if test="sysUserPermission.deleteFlag != null and sysUserPermission.deleteFlag.trim() != ''">
AND a.DELETE_FLAG = #{sysUserPermission.deleteFlag}
</if>
<if test="sysUserPermission.createBy != null and sysUserPermission.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserPermission.createBy}
</if>
<if test="sysUserPermission.updateBy != null and sysUserPermission.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysUserPermission.updateBy}
</if>
<if test="sysUserPermission.createName != null and sysUserPermission.createName.trim() != ''">
AND a.CREATE_NAME = #{sysUserPermission.createName}
</if>
<if test="sysUserPermission.updateTime != null">
AND a.UPDATE_TIME = #{sysUserPermission.updateTime}
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
......@@ -82,8 +64,9 @@
<include refid="Base_Column_List"/>
FROM sys_user_permission a
<where>
1=1
1=1 AND a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment