优化代码
This commit is contained in:
parent
81bbc157c4
commit
afba71dfcf
@ -41,8 +41,7 @@ public class DictUtils
|
|||||||
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
||||||
if (StringUtils.isNotNull(cacheObj))
|
if (StringUtils.isNotNull(cacheObj))
|
||||||
{
|
{
|
||||||
List<SysDictData> dictDatas = StringUtils.cast(cacheObj);
|
return StringUtils.cast(cacheObj);
|
||||||
return dictDatas;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -92,7 +91,7 @@ public class DictUtils
|
|||||||
{
|
{
|
||||||
if (value.equals(dict.getDictValue()))
|
if (value.equals(dict.getDictValue()))
|
||||||
{
|
{
|
||||||
propertyString.append(dict.getDictLabel() + separator);
|
propertyString.append(dict.getDictLabel()).append(separator);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +131,7 @@ public class DictUtils
|
|||||||
{
|
{
|
||||||
if (label.equals(dict.getDictLabel()))
|
if (label.equals(dict.getDictLabel()))
|
||||||
{
|
{
|
||||||
propertyString.append(dict.getDictValue() + separator);
|
propertyString.append(dict.getDictValue()).append(separator);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class ExceptionUtil
|
|||||||
{
|
{
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(sw, true));
|
e.printStackTrace(new PrintWriter(sw, true));
|
||||||
String str = sw.toString();
|
return sw.toString();
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRootErrorMessage(Exception e)
|
public static String getRootErrorMessage(Exception e)
|
||||||
|
@ -99,9 +99,8 @@ public class ServletUtils
|
|||||||
*
|
*
|
||||||
* @param response 渲染对象
|
* @param response 渲染对象
|
||||||
* @param string 待渲染的字符串
|
* @param string 待渲染的字符串
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public static String renderString(HttpServletResponse response, String string)
|
public static void renderString(HttpServletResponse response, String string)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -114,7 +113,6 @@ public class ServletUtils
|
|||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,13 +123,13 @@ public class ServletUtils
|
|||||||
public static boolean isAjaxRequest(HttpServletRequest request)
|
public static boolean isAjaxRequest(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
String accept = request.getHeader("accept");
|
String accept = request.getHeader("accept");
|
||||||
if (accept != null && accept.indexOf("application/json") != -1)
|
if (accept != null && accept.contains("application/json"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String xRequestedWith = request.getHeader("X-Requested-With");
|
String xRequestedWith = request.getHeader("X-Requested-With");
|
||||||
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
|
if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -143,10 +141,6 @@ public class ServletUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
String ajax = request.getParameter("__ajax");
|
String ajax = request.getParameter("__ajax");
|
||||||
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
|
return StringUtils.inStringIgnoreCase(ajax, "json", "xml");
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.ruoyi.common.utils.file;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
@ -15,7 +16,7 @@ import com.ruoyi.framework.config.RuoYiConfig;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传工具类
|
* 文件上传工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class FileUploadUtils
|
public class FileUploadUtils
|
||||||
@ -89,7 +90,7 @@ public class FileUploadUtils
|
|||||||
*
|
*
|
||||||
* @param baseDir 相对应用的基目录
|
* @param baseDir 相对应用的基目录
|
||||||
* @param file 上传的文件
|
* @param file 上传的文件
|
||||||
* @param extension 上传文件类型
|
* @param allowedExtension 上传文件类型
|
||||||
* @return 返回上传成功的文件名
|
* @return 返回上传成功的文件名
|
||||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||||
* @throws FileNameLengthLimitExceededException 文件名太长
|
* @throws FileNameLengthLimitExceededException 文件名太长
|
||||||
@ -100,7 +101,7 @@ public class FileUploadUtils
|
|||||||
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
||||||
InvalidExtensionException
|
InvalidExtensionException
|
||||||
{
|
{
|
||||||
int fileNamelength = file.getOriginalFilename().length();
|
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
|
||||||
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
||||||
{
|
{
|
||||||
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||||
@ -112,8 +113,7 @@ public class FileUploadUtils
|
|||||||
|
|
||||||
File desc = getAbsoluteFile(baseDir, fileName);
|
File desc = getAbsoluteFile(baseDir, fileName);
|
||||||
file.transferTo(desc);
|
file.transferTo(desc);
|
||||||
String pathFileName = getPathFileName(baseDir, fileName);
|
return getPathFileName(baseDir, fileName);
|
||||||
return pathFileName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,8 +145,7 @@ public class FileUploadUtils
|
|||||||
{
|
{
|
||||||
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
||||||
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
||||||
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
|
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
|
||||||
return pathFileName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,7 +160,7 @@ public class FileUploadUtils
|
|||||||
throws FileSizeLimitExceededException, InvalidExtensionException
|
throws FileSizeLimitExceededException, InvalidExtensionException
|
||||||
{
|
{
|
||||||
long size = file.getSize();
|
long size = file.getSize();
|
||||||
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
|
if (size > DEFAULT_MAX_SIZE)
|
||||||
{
|
{
|
||||||
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
|
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
|
||||||
}
|
}
|
||||||
@ -219,7 +218,7 @@ public class FileUploadUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件名的后缀
|
* 获取文件名的后缀
|
||||||
*
|
*
|
||||||
* @param file 表单文件
|
* @param file 表单文件
|
||||||
* @return 后缀名
|
* @return 后缀名
|
||||||
*/
|
*/
|
||||||
@ -228,8 +227,8 @@ public class FileUploadUtils
|
|||||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||||
if (StringUtils.isEmpty(extension))
|
if (StringUtils.isEmpty(extension))
|
||||||
{
|
{
|
||||||
extension = MimeTypeUtils.getExtension(file.getContentType());
|
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
|
||||||
}
|
}
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class ImageUtils
|
|||||||
/**
|
/**
|
||||||
* 读取文件为字节数据
|
* 读取文件为字节数据
|
||||||
*
|
*
|
||||||
* @param key 地址
|
* @param url 地址
|
||||||
* @return 字节数据
|
* @return 字节数据
|
||||||
*/
|
*/
|
||||||
public static byte[] readFile(String url)
|
public static byte[] readFile(String url)
|
||||||
|
@ -4,7 +4,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.StandardCharsets;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -25,7 +25,7 @@ public class HttpHelper
|
|||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
try (InputStream inputStream = request.getInputStream())
|
try (InputStream inputStream = request.getInputStream())
|
||||||
{
|
{
|
||||||
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
|
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||||
String line = "";
|
String line = "";
|
||||||
while ((line = reader.readLine()) != null)
|
while ((line = reader.readLine()) != null)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@ import java.net.ConnectException;
|
|||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import javax.net.ssl.HostnameVerifier;
|
import javax.net.ssl.HostnameVerifier;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
@ -130,9 +131,8 @@ public class HttpUtils
|
|||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String urlNameString = url;
|
log.info("sendPost - {}", url);
|
||||||
log.info("sendPost - {}", urlNameString);
|
URL realUrl = new URL(url);
|
||||||
URL realUrl = new URL(urlNameString);
|
|
||||||
URLConnection conn = realUrl.openConnection();
|
URLConnection conn = realUrl.openConnection();
|
||||||
conn.setRequestProperty("accept", "*/*");
|
conn.setRequestProperty("accept", "*/*");
|
||||||
conn.setRequestProperty("connection", "Keep-Alive");
|
conn.setRequestProperty("connection", "Keep-Alive");
|
||||||
@ -144,7 +144,7 @@ public class HttpUtils
|
|||||||
out = new PrintWriter(conn.getOutputStream());
|
out = new PrintWriter(conn.getOutputStream());
|
||||||
out.print(param);
|
out.print(param);
|
||||||
out.flush();
|
out.flush();
|
||||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
||||||
String line;
|
String line;
|
||||||
while ((line = in.readLine()) != null)
|
while ((line = in.readLine()) != null)
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ public class HttpUtils
|
|||||||
{
|
{
|
||||||
if (ret != null && !"".equals(ret.trim()))
|
if (ret != null && !"".equals(ret.trim()))
|
||||||
{
|
{
|
||||||
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
|
result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("recv - {}", result);
|
log.info("recv - {}", result);
|
||||||
|
@ -25,7 +25,6 @@ public class AddressUtils
|
|||||||
|
|
||||||
public static String getRealAddressByIP(String ip)
|
public static String getRealAddressByIP(String ip)
|
||||||
{
|
{
|
||||||
String address = UNKNOWN;
|
|
||||||
// 内网不查询
|
// 内网不查询
|
||||||
if (IpUtils.internalIp(ip))
|
if (IpUtils.internalIp(ip))
|
||||||
{
|
{
|
||||||
@ -51,6 +50,6 @@ public class AddressUtils
|
|||||||
log.error("获取地理位置异常 {}", ip);
|
log.error("获取地理位置异常 {}", ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return address;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1121,7 @@ public class ExcelUtil<T>
|
|||||||
if (StringUtils.isNotEmpty(excel.targetAttr()))
|
if (StringUtils.isNotEmpty(excel.targetAttr()))
|
||||||
{
|
{
|
||||||
String target = excel.targetAttr();
|
String target = excel.targetAttr();
|
||||||
if (target.indexOf(".") > -1)
|
if (target.contains("."))
|
||||||
{
|
{
|
||||||
String[] targets = target.split("[.]");
|
String[] targets = target.split("[.]");
|
||||||
for (String name : targets)
|
for (String name : targets)
|
||||||
@ -1216,7 +1216,7 @@ public class ExcelUtil<T>
|
|||||||
for (Object[] os : this.fields)
|
for (Object[] os : this.fields)
|
||||||
{
|
{
|
||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
maxHeight = maxHeight > excel.height() ? maxHeight : excel.height();
|
maxHeight = Math.max(maxHeight, excel.height());
|
||||||
}
|
}
|
||||||
return (short) (maxHeight * 20);
|
return (short) (maxHeight * 20);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.common.utils.sign;
|
package com.ruoyi.common.utils.sign;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -55,7 +56,7 @@ public class Md5Utils
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
|
return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -50,9 +50,9 @@ public class SqlUtil
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
|
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
|
||||||
for (int i = 0; i < sqlKeywords.length; i++)
|
for (String sqlKeyword : sqlKeywords)
|
||||||
{
|
{
|
||||||
if (StringUtils.indexOfIgnoreCase(value, sqlKeywords[i]) > -1)
|
if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1)
|
||||||
{
|
{
|
||||||
throw new UtilException("参数存在SQL注入风险");
|
throw new UtilException("参数存在SQL注入风险");
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class LoginBody
|
|||||||
/**
|
/**
|
||||||
* 唯一标识
|
* 唯一标识
|
||||||
*/
|
*/
|
||||||
private String uuid = "";
|
private String uuid;
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ public class SysRegisterService
|
|||||||
*/
|
*/
|
||||||
public void validateCaptcha(String username, String code, String uuid)
|
public void validateCaptcha(String username, String code, String uuid)
|
||||||
{
|
{
|
||||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
|
||||||
String captcha = redisCache.getCacheObject(verifyKey);
|
String captcha = redisCache.getCacheObject(verifyKey);
|
||||||
redisCache.deleteObject(verifyKey);
|
redisCache.deleteObject(verifyKey);
|
||||||
if (captcha == null)
|
if (captcha == null)
|
||||||
|
@ -29,7 +29,7 @@ public interface ISysLogininforService
|
|||||||
* 批量删除系统登录日志
|
* 批量删除系统登录日志
|
||||||
*
|
*
|
||||||
* @param infoIds 需要删除的登录日志ID
|
* @param infoIds 需要删除的登录日志ID
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteLogininforByIds(Long[] infoIds);
|
public int deleteLogininforByIds(Long[] infoIds);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService
|
|||||||
* 批量删除系统登录日志
|
* 批量删除系统登录日志
|
||||||
*
|
*
|
||||||
* @param infoIds 需要删除的登录日志ID
|
* @param infoIds 需要删除的登录日志ID
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteLogininforByIds(Long[] infoIds)
|
public int deleteLogininforByIds(Long[] infoIds)
|
||||||
|
@ -61,7 +61,6 @@ public interface ISysConfigService
|
|||||||
* 批量删除参数信息
|
* 批量删除参数信息
|
||||||
*
|
*
|
||||||
* @param configIds 需要删除的参数ID
|
* @param configIds 需要删除的参数ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
public void deleteConfigByIds(Long[] configIds);
|
public void deleteConfigByIds(Long[] configIds);
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ public interface ISysDictDataService
|
|||||||
* 批量删除字典数据信息
|
* 批量删除字典数据信息
|
||||||
*
|
*
|
||||||
* @param dictCodes 需要删除的字典数据ID
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
public void deleteDictDataByIds(Long[] dictCodes);
|
public void deleteDictDataByIds(Long[] dictCodes);
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ public interface ISysDictTypeService
|
|||||||
* 批量删除字典信息
|
* 批量删除字典信息
|
||||||
*
|
*
|
||||||
* @param dictIds 需要删除的字典ID
|
* @param dictIds 需要删除的字典ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
public void deleteDictTypeByIds(Long[] dictIds);
|
public void deleteDictTypeByIds(Long[] dictIds);
|
||||||
|
|
||||||
|
@ -78,7 +78,6 @@ public interface ISysPostService
|
|||||||
*
|
*
|
||||||
* @param postIds 需要删除的岗位ID
|
* @param postIds 需要删除的岗位ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws Exception 异常
|
|
||||||
*/
|
*/
|
||||||
public int deletePostByIds(Long[] postIds);
|
public int deletePostByIds(Long[] postIds);
|
||||||
|
|
||||||
|
@ -143,7 +143,6 @@ public class SysConfigServiceImpl implements ISysConfigService
|
|||||||
* 批量删除参数信息
|
* 批量删除参数信息
|
||||||
*
|
*
|
||||||
* @param configIds 需要删除的参数ID
|
* @param configIds 需要删除的参数ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteConfigByIds(Long[] configIds)
|
public void deleteConfigByIds(Long[] configIds)
|
||||||
|
@ -63,9 +63,8 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
{
|
{
|
||||||
tempList.add(dept.getDeptId());
|
tempList.add(dept.getDeptId());
|
||||||
}
|
}
|
||||||
for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext();)
|
for (SysDept dept : depts)
|
||||||
{
|
{
|
||||||
SysDept dept = (SysDept) iterator.next();
|
|
||||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||||
if (!tempList.contains(dept.getParentId()))
|
if (!tempList.contains(dept.getParentId()))
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
|||||||
* 批量删除字典数据信息
|
* 批量删除字典数据信息
|
||||||
*
|
*
|
||||||
* @param dictCodes 需要删除的字典数据ID
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictDataByIds(Long[] dictCodes)
|
public void deleteDictDataByIds(Long[] dictCodes)
|
||||||
|
@ -115,7 +115,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|||||||
* 批量删除字典类型信息
|
* 批量删除字典类型信息
|
||||||
*
|
*
|
||||||
* @param dictIds 需要删除的字典ID
|
* @param dictIds 需要删除的字典ID
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictTypeByIds(Long[] dictIds)
|
public void deleteDictTypeByIds(Long[] dictIds)
|
||||||
|
@ -498,7 +498,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
*/
|
*/
|
||||||
private boolean hasChild(List<SysMenu> list, SysMenu t)
|
private boolean hasChild(List<SysMenu> list, SysMenu t)
|
||||||
{
|
{
|
||||||
return getChildList(list, t).size() > 0 ? true : false;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,6 @@ public class SysPostServiceImpl implements ISysPostService
|
|||||||
*
|
*
|
||||||
* @param postIds 需要删除的岗位ID
|
* @param postIds 需要删除的岗位ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws Exception 异常
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePostByIds(Long[] postIds)
|
public int deletePostByIds(Long[] postIds)
|
||||||
|
@ -151,8 +151,7 @@ public class GenUtils
|
|||||||
{
|
{
|
||||||
int lastIndex = packageName.lastIndexOf(".");
|
int lastIndex = packageName.lastIndexOf(".");
|
||||||
int nameLength = packageName.length();
|
int nameLength = packageName.length();
|
||||||
String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength);
|
return StringUtils.substring(packageName, lastIndex + 1, nameLength);
|
||||||
return moduleName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,8 +164,7 @@ public class GenUtils
|
|||||||
{
|
{
|
||||||
int lastIndex = tableName.lastIndexOf("_");
|
int lastIndex = tableName.lastIndexOf("_");
|
||||||
int nameLength = tableName.length();
|
int nameLength = tableName.length();
|
||||||
String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength);
|
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
|
||||||
return businessName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,4 +253,4 @@ public class GenUtils
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置模板变量信息
|
* 设置模板变量信息
|
||||||
*
|
*
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static VelocityContext prepareContext(GenTable genTable)
|
public static VelocityContext prepareContext(GenTable genTable)
|
||||||
@ -119,9 +119,10 @@ public class VelocityUtils
|
|||||||
context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
||||||
context.put("subImportList", getImportList(genTable.getSubTable()));
|
context.put("subImportList", getImportList(genTable.getSubTable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取模板信息
|
* 获取模板信息
|
||||||
*
|
*
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getTemplateList(String tplCategory)
|
public static List<String> getTemplateList(String tplCategory)
|
||||||
@ -220,15 +221,14 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取包前缀
|
* 获取包前缀
|
||||||
*
|
*
|
||||||
* @param packageName 包名称
|
* @param packageName 包名称
|
||||||
* @return 包前缀名称
|
* @return 包前缀名称
|
||||||
*/
|
*/
|
||||||
public static String getPackagePrefix(String packageName)
|
public static String getPackagePrefix(String packageName)
|
||||||
{
|
{
|
||||||
int lastIndex = packageName.lastIndexOf(".");
|
int lastIndex = packageName.lastIndexOf(".");
|
||||||
String basePackage = StringUtils.substring(packageName, 0, lastIndex);
|
return StringUtils.substring(packageName, 0, lastIndex);
|
||||||
return basePackage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,7 +285,7 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取权限前缀
|
* 获取权限前缀
|
||||||
*
|
*
|
||||||
* @param moduleName 模块名称
|
* @param moduleName 模块名称
|
||||||
* @param businessName 业务名称
|
* @param businessName 业务名称
|
||||||
* @return 返回权限前缀
|
* @return 返回权限前缀
|
||||||
@ -297,8 +297,8 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取上级菜单ID字段
|
* 获取上级菜单ID字段
|
||||||
*
|
*
|
||||||
* @param options 生成其他选项
|
* @param paramsObj 生成其他选项
|
||||||
* @return 上级菜单ID字段
|
* @return 上级菜单ID字段
|
||||||
*/
|
*/
|
||||||
public static String getParentMenuId(JSONObject paramsObj)
|
public static String getParentMenuId(JSONObject paramsObj)
|
||||||
@ -313,8 +313,8 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取树编码
|
* 获取树编码
|
||||||
*
|
*
|
||||||
* @param options 生成其他选项
|
* @param paramsObj 生成其他选项
|
||||||
* @return 树编码
|
* @return 树编码
|
||||||
*/
|
*/
|
||||||
public static String getTreecode(JSONObject paramsObj)
|
public static String getTreecode(JSONObject paramsObj)
|
||||||
@ -328,8 +328,8 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取树父编码
|
* 获取树父编码
|
||||||
*
|
*
|
||||||
* @param options 生成其他选项
|
* @param paramsObj 生成其他选项
|
||||||
* @return 树父编码
|
* @return 树父编码
|
||||||
*/
|
*/
|
||||||
public static String getTreeParentCode(JSONObject paramsObj)
|
public static String getTreeParentCode(JSONObject paramsObj)
|
||||||
@ -343,8 +343,8 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取树名称
|
* 获取树名称
|
||||||
*
|
*
|
||||||
* @param options 生成其他选项
|
* @param paramsObj 生成其他选项
|
||||||
* @return 树名称
|
* @return 树名称
|
||||||
*/
|
*/
|
||||||
public static String getTreeName(JSONObject paramsObj)
|
public static String getTreeName(JSONObject paramsObj)
|
||||||
@ -358,7 +358,7 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取需要在哪一列上面显示展开按钮
|
* 获取需要在哪一列上面显示展开按钮
|
||||||
*
|
*
|
||||||
* @param genTable 业务表对象
|
* @param genTable 业务表对象
|
||||||
* @return 展开按钮列序号
|
* @return 展开按钮列序号
|
||||||
*/
|
*/
|
||||||
@ -382,4 +382,4 @@ public class VelocityUtils
|
|||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user