fix():格式规范修改

boot3.0
dongzeliang 2025-02-27 12:31:55 +08:00
parent a3538fde09
commit e24bd88c16
30 changed files with 181 additions and 80 deletions

View File

@ -30,7 +30,7 @@ public class SpringDocConfig {
} }
@Bean @Bean
public OpenAPI springShopOpenAPI() { public OpenAPI springShopOpenApi() {
return new OpenAPI() return new OpenAPI()
.info(info()) .info(info())
.externalDocs(externalDocumentation()); .externalDocs(externalDocumentation());

View File

@ -6,6 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/**
* mybatis-plus
*
* @author dongzeliang
*/
@Configuration @Configuration
public class MybatisPlusConfig { public class MybatisPlusConfig {

View File

@ -1,6 +1,7 @@
package com.muyu.common.core.constant; package com.muyu.common.core.constant;
/** /**
*
* @author dongzeliang * @author dongzeliang
* @version 1.0 * @version 1.0
* @description: * @description:

View File

@ -1,6 +1,7 @@
package com.muyu.common.core.constant; package com.muyu.common.core.constant;
/** /**
* HTTP
* @author dongzeliang * @author dongzeliang
* @version 1.0 * @version 1.0
* @description: HTTP * @description: HTTP

View File

@ -0,0 +1,62 @@
package com.muyu.common.core.constant;
/**
*
* @author dongzeliang
* @version 1.0
* @description:
* @date 2025/2/27 11:55
*/
public class SplitConstants {
/**
*
*/
public static final String NULL_STR = "";
/**
*
*/
public static final String EMPTY_STR = " ";
/**
* 线
*/
public static final char UNDERLINE = '_';
/**
* 线
*/
public static final String UNDERLINE_STR = "_";
/**
*
*/
public static final String COMMA_STR = ",";
/**
*
*/
public static final String POINT_STR = ".";
/**
*
*/
public static final String ADDITION_STR = "+";
/**
* /
*/
public static final String SUBTRACTION_STR = "-";
/**
*
*/
public static final String EQUAL_STR = "=";
/**
* \@
*/
public static final String ANTE_STR = "@";
}

View File

@ -2,6 +2,8 @@ package com.muyu.common.core.exception.auth;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -15,6 +17,6 @@ public class NotPermissionException extends RuntimeException {
} }
public NotPermissionException (String[] permissions) { public NotPermissionException (String[] permissions) {
super(StringUtils.join(permissions, ",")); super(StringUtils.join(permissions, COMMA_STR));
} }
} }

View File

@ -2,6 +2,8 @@ package com.muyu.common.core.exception.auth;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -15,6 +17,6 @@ public class NotRoleException extends RuntimeException {
} }
public NotRoleException (String[] roles) { public NotRoleException (String[] roles) {
super(StringUtils.join(roles, ",")); super(StringUtils.join(roles, COMMA_STR));
} }
} }

View File

@ -11,6 +11,8 @@ import java.text.NumberFormat;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -266,7 +268,7 @@ public class Convert {
* @return * @return
*/ */
public static Integer[] toIntArray (String str) { public static Integer[] toIntArray (String str) {
return toIntArray(",", str); return toIntArray(COMMA_STR, str);
} }
/** /**
@ -277,7 +279,7 @@ public class Convert {
* @return * @return
*/ */
public static Long[] toLongArray (String str) { public static Long[] toLongArray (String str) {
return toLongArray(",", str); return toLongArray(COMMA_STR, str);
} }
/** /**
* Long<br> * Long<br>
@ -287,7 +289,7 @@ public class Convert {
* @return * @return
*/ */
public static List<Long> toLongList (String str) { public static List<Long> toLongList (String str) {
return List.of(toLongArray(",", str)); return List.of(toLongArray(COMMA_STR, str));
} }
/** /**
@ -340,7 +342,7 @@ public class Convert {
* @return * @return
*/ */
public static String[] toStrArray (String str) { public static String[] toStrArray (String str) {
return toStrArray(",", str); return toStrArray(COMMA_STR, str);
} }
/** /**

View File

@ -26,6 +26,7 @@ import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import static com.muyu.common.core.constant.HttpConstants.*; import static com.muyu.common.core.constant.HttpConstants.*;
import static com.muyu.common.core.constant.SplitConstants.*;
import static org.springframework.http.HttpHeaders.ACCEPT; import static org.springframework.http.HttpHeaders.ACCEPT;
/** /**
@ -98,7 +99,7 @@ public class ServletUtils {
public static Map<String, String> getParamMap (ServletRequest request) { public static Map<String, String> getParamMap (ServletRequest request) {
Map<String, String> params = new HashMap<>(16); Map<String, String> params = new HashMap<>(16);
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) { for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); params.put(entry.getKey(), StringUtils.join(entry.getValue(), COMMA_STR));
} }
return params; return params;
} }

View File

@ -8,21 +8,14 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
* @author muyu * @author muyu
*/ */
public class StringUtils extends org.apache.commons.lang3.StringUtils { public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*/
private static final String NULLSTR = "";
/**
* 线
*/
private static final char SEPARATOR = '_';
/** /**
* *
@ -108,7 +101,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @return true false * @return true false
*/ */
public static boolean isEmpty (String str) { public static boolean isEmpty (String str) {
return isNull(str) || NULLSTR.equals(str.trim()); return isNull(str) || NULL_STR.equals(str.trim());
} }
/** /**
@ -172,7 +165,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/ */
public static String substring (final String str, int start) { public static String substring (final String str, int start) {
if (str == null) { if (str == null) {
return NULLSTR; return NULL_STR;
} }
if (start < 0) { if (start < 0) {
@ -183,7 +176,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
start = 0; start = 0;
} }
if (start > str.length()) { if (start > str.length()) {
return NULLSTR; return NULL_STR;
} }
return str.substring(start); return str.substring(start);
@ -200,7 +193,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/ */
public static String substring (final String str, int start, int end) { public static String substring (final String str, int start, int end) {
if (str == null) { if (str == null) {
return NULLSTR; return NULL_STR;
} }
if (end < 0) { if (end < 0) {
@ -215,7 +208,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
} }
if (start > end) { if (start > end) {
return NULLSTR; return NULL_STR;
} }
if (start < 0) { if (start < 0) {
@ -331,9 +324,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
} }
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) { if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
sb.append(SEPARATOR); sb.append(UNDERLINE);
} else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) { } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
sb.append(SEPARATOR); sb.append(UNDERLINE);
} }
sb.append(Character.toLowerCase(c)); sb.append(Character.toLowerCase(c));
} }
@ -373,12 +366,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
if (name == null || name.isEmpty()) { if (name == null || name.isEmpty()) {
// 没必要转换 // 没必要转换
return ""; return "";
} else if (!name.contains("_")) { } else if (!name.contains(UNDERLINE_STR)) {
// 不含下划线,仅将首字母大写 // 不含下划线,仅将首字母大写
return name.substring(0, 1).toUpperCase() + name.substring(1); return name.substring(0, 1).toUpperCase() + name.substring(1);
} }
// 用下划线将原始字符串分割 // 用下划线将原始字符串分割
String[] camels = name.split("_"); String[] camels = name.split(UNDERLINE_STR);
for (String camel : camels) { for (String camel : camels) {
// 跳过原始字符串中开头、结尾的下换线或双重下划线 // 跳过原始字符串中开头、结尾的下换线或双重下划线
if (camel.isEmpty()) { if (camel.isEmpty()) {
@ -399,7 +392,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
if (s == null) { if (s == null) {
return null; return null;
} }
if (s.indexOf(SEPARATOR) == -1) { if (s.indexOf(UNDERLINE) == -1) {
return s; return s;
} }
s = s.toLowerCase(); s = s.toLowerCase();
@ -408,7 +401,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
for (int i = 0 ; i < s.length() ; i++) { for (int i = 0 ; i < s.length() ; i++) {
char c = s.charAt(i); char c = s.charAt(i);
if (c == SEPARATOR) { if (c == UNDERLINE) {
upperCase = true; upperCase = true;
} else if (upperCase) { } else if (upperCase) {
sb.append(Character.toUpperCase(c)); sb.append(Character.toUpperCase(c));

View File

@ -10,6 +10,8 @@ import java.io.*;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -124,7 +126,7 @@ public class FileUtils {
if (agent.contains("MSIE")) { if (agent.contains("MSIE")) {
// IE浏览器 // IE浏览器
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8); filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
filename = filename.replace("+", " "); filename = filename.replace(ADDITION_STR, EMPTY_STR);
} else if (agent.contains("Firefox")) { } else if (agent.contains("Firefox")) {
// 火狐浏览器 // 火狐浏览器
filename = new String(fileName.getBytes(), StandardCharsets.ISO_8859_1); filename = new String(fileName.getBytes(), StandardCharsets.ISO_8859_1);

View File

@ -7,6 +7,8 @@ import jakarta.servlet.http.HttpServletRequest;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* IP * IP
* *
@ -17,7 +19,7 @@ public class IpUtils {
// 匹配 ip // 匹配 ip
public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")";
// 匹配网段 // 匹配网段
public final static String REGX_IP_SEG = "(" + REGX_IP + "-" + REGX_IP + ")"; public final static String REGX_IP_SEG = "(" + REGX_IP + SUBTRACTION_STR + REGX_IP + ")";
public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))"; public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))";
/** /**
@ -221,8 +223,8 @@ public class IpUtils {
*/ */
public static String getMultistageReverseProxyIp (String ip) { public static String getMultistageReverseProxyIp (String ip) {
// 多级反向代理检测 // 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0) { if (ip != null && ip.indexOf(COMMA_STR) > 0) {
final String[] ips = ip.trim().split(","); final String[] ips = ip.trim().split(COMMA_STR);
for (String subIp : ips) { for (String subIp : ips) {
if (!isUnknown(subIp)) { if (!isUnknown(subIp)) {
ip = subIp; ip = subIp;

View File

@ -37,6 +37,9 @@ import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.muyu.common.core.constant.SplitConstants.*;
import static com.muyu.common.core.constant.SplitConstants.UNDERLINE_STR;
/** /**
* Excel * Excel
* *
@ -44,7 +47,7 @@ import java.util.stream.Collectors;
*/ */
public class ExcelUtil<T> { public class ExcelUtil<T> {
public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
public static final String[] FORMULA_STR = {"=", "-", "+", "@"}; public static final String[] FORMULA_STR = {EQUAL_STR, SUBTRACTION_STR, ADDITION_STR, ANTE_STR};
/** /**
* Excel sheet65536 * Excel sheet65536
*/ */
@ -148,9 +151,9 @@ public class ExcelUtil<T> {
*/ */
public static String convertByExp (String propertyValue, String converterExp, String separator) { public static String convertByExp (String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder(); StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(","); String[] convertSource = converterExp.split(COMMA_STR);
for (String item : convertSource) { for (String item : convertSource) {
String[] itemArray = item.split("="); String[] itemArray = item.split(EQUAL_STR);
if (StringUtils.containsAny(propertyValue, separator)) { if (StringUtils.containsAny(propertyValue, separator)) {
for (String value : propertyValue.split(separator)) { for (String value : propertyValue.split(separator)) {
if (itemArray[0].equals(value)) { if (itemArray[0].equals(value)) {
@ -178,9 +181,9 @@ public class ExcelUtil<T> {
*/ */
public static String reverseByExp (String propertyValue, String converterExp, String separator) { public static String reverseByExp (String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder(); StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(","); String[] convertSource = converterExp.split(COMMA_STR);
for (String item : convertSource) { for (String item : convertSource) {
String[] itemArray = item.split("="); String[] itemArray = item.split(EQUAL_STR);
if (StringUtils.containsAny(propertyValue, separator)) { if (StringUtils.containsAny(propertyValue, separator)) {
for (String value : propertyValue.split(separator)) { for (String value : propertyValue.split(separator)) {
if (itemArray[1].equals(value)) { if (itemArray[1].equals(value)) {
@ -852,7 +855,7 @@ public class ExcelUtil<T> {
* @param endCol * @param endCol
*/ */
public void setXssfValidationWithHidden(Sheet sheet, String[] textList, String promptContent, int firstRow, int endRow, int firstCol, int endCol) { public void setXssfValidationWithHidden(Sheet sheet, String[] textList, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
String hideSheetName = "combo_" + firstCol + "_" + endCol; String hideSheetName = "combo_" + firstCol + UNDERLINE_STR + endCol;
// 用于存储 下拉菜单数据 // 用于存储 下拉菜单数据
Sheet hideSheet = wb.createSheet(hideSheetName); Sheet hideSheet = wb.createSheet(hideSheetName);
for (int i = 0 ; i < textList.length ; i++) { for (int i = 0 ; i < textList.length ; i++) {

View File

@ -12,7 +12,7 @@ public class IdUtils {
* @return UUID * @return UUID
*/ */
public static String randomUuid() { public static String randomUuid() {
return UUID.randomUUID().toString(); return UUID.randomUuid().toString();
} }
/** /**
@ -21,7 +21,7 @@ public class IdUtils {
* @return UUID线 * @return UUID线
*/ */
public static String simpleUuid() { public static String simpleUuid() {
return UUID.randomUUID().toString(true); return UUID.randomUuid().toString(true);
} }
/** /**
@ -30,7 +30,7 @@ public class IdUtils {
* @return UUID * @return UUID
*/ */
public static String fastUuid() { public static String fastUuid() {
return UUID.fastUUID().toString(); return UUID.fastUuid().toString();
} }
/** /**
@ -39,6 +39,6 @@ public class IdUtils {
* @return UUID线 * @return UUID线
*/ */
public static String fastSimpleUuid() { public static String fastSimpleUuid() {
return UUID.fastUUID().toString(true); return UUID.fastUuid().toString(true);
} }
} }

View File

@ -8,6 +8,8 @@ import java.security.SecureRandom;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* universally unique identifierUUID * universally unique identifierUUID
* *
@ -59,8 +61,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* *
* @return {@code UUID} * @return {@code UUID}
*/ */
public static UUID fastUUID () { public static UUID fastUuid() {
return randomUUID(false); return randomUuid(false);
} }
/** /**
@ -68,8 +70,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* *
* @return {@code UUID} * @return {@code UUID}
*/ */
public static UUID randomUUID () { public static UUID randomUuid() {
return randomUUID(true); return randomUuid(true);
} }
/** /**
@ -79,7 +81,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* *
* @return {@code UUID} * @return {@code UUID}
*/ */
public static UUID randomUUID (boolean isSecure) { public static UUID randomUuid(boolean isSecure) {
final Random ng = isSecure ? Holder.numberGenerator : getRandom(); final Random ng = isSecure ? Holder.numberGenerator : getRandom();
byte[] randomBytes = new byte[16]; byte[] randomBytes = new byte[16];
@ -131,7 +133,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* @throws IllegalArgumentException name {@link #toString} * @throws IllegalArgumentException name {@link #toString}
*/ */
public static UUID fromString (String name) { public static UUID fromString (String name) {
String[] components = name.split("-"); String[] components = name.split(SUBTRACTION_STR);
if (components.length != 5) { if (components.length != 5) {
throw new IllegalArgumentException("Invalid UUID string: " + name); throw new IllegalArgumentException("Invalid UUID string: " + name);
} }

View File

@ -6,6 +6,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -45,7 +47,7 @@ public class PageReq {
if (StringUtils.isEmpty(orderByColumn)) { if (StringUtils.isEmpty(orderByColumn)) {
return ""; return "";
} }
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; return StringUtils.toUnderScoreCase(orderByColumn) + EMPTY_STR + isAsc;
} }
public void setIsAsc (String isAsc) { public void setIsAsc (String isAsc) {

View File

@ -30,6 +30,8 @@ import jakarta.servlet.http.HttpServletResponse;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -167,19 +169,19 @@ public class LogAspect {
* *
*/ */
private String argsArrayToString (Object[] paramsArray, String[] excludeParamNames) { private String argsArrayToString (Object[] paramsArray, String[] excludeParamNames) {
String params = ""; StringBuilder params = new StringBuilder();
if (paramsArray != null && paramsArray.length > 0) { if (paramsArray != null && paramsArray.length > 0) {
for (Object o : paramsArray) { for (Object o : paramsArray) {
if (StringUtils.isNotNull(o) && !isFilterObject(o)) { if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
try { try {
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames)); String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
params += jsonObj.toString() + " "; params.append(jsonObj).append(EMPTY_STR);
} catch (Exception e) { } catch (Exception e) {
} }
} }
} }
} }
return params.trim(); return params.toString().trim();
} }
/** /**

View File

@ -19,6 +19,8 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* Token * Token
* *
@ -127,7 +129,7 @@ public class AuthLogic {
* @param requiresPermissions * @param requiresPermissions
*/ */
public void checkPermi (RequiresPermissions requiresPermissions) { public void checkPermi (RequiresPermissions requiresPermissions) {
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), ",")); SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), COMMA_STR));
if (requiresPermissions.logical() == Logical.AND) { if (requiresPermissions.logical() == Logical.AND) {
checkPermiAnd(requiresPermissions.value()); checkPermiAnd(requiresPermissions.value());
} else { } else {

View File

@ -4,13 +4,15 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
import java.util.Random; import java.util.Random;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
* @author muyu * @author muyu
*/ */
public class KaptchaTextCreator extends DefaultTextCreator { public class KaptchaTextCreator extends DefaultTextCreator {
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(COMMA_STR);
@Override @Override
public String getText () { public String getText () {
@ -34,25 +36,25 @@ public class KaptchaTextCreator extends DefaultTextCreator {
} else { } else {
result = x + y; result = x + y;
suChinese.append(CNUMBERS[x]); suChinese.append(CNUMBERS[x]);
suChinese.append("+"); suChinese.append(ADDITION_STR);
suChinese.append(CNUMBERS[y]); suChinese.append(CNUMBERS[y]);
} }
} else if (randomoperands == 2) { } else if (randomoperands == 2) {
if (x >= y) { if (x >= y) {
result = x - y; result = x - y;
suChinese.append(CNUMBERS[x]); suChinese.append(CNUMBERS[x]);
suChinese.append("-"); suChinese.append(SUBTRACTION_STR);
suChinese.append(CNUMBERS[y]); suChinese.append(CNUMBERS[y]);
} else { } else {
result = y - x; result = y - x;
suChinese.append(CNUMBERS[y]); suChinese.append(CNUMBERS[y]);
suChinese.append("-"); suChinese.append(SUBTRACTION_STR);
suChinese.append(CNUMBERS[x]); suChinese.append(CNUMBERS[x]);
} }
} else { } else {
result = x + y; result = x + y;
suChinese.append(CNUMBERS[x]); suChinese.append(CNUMBERS[x]);
suChinese.append("+"); suChinese.append(ADDITION_STR);
suChinese.append(CNUMBERS[y]); suChinese.append(CNUMBERS[y]);
} }
suChinese.append("=?@" + result); suChinese.append("=?@" + result);

View File

@ -22,6 +22,8 @@ import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -64,8 +66,8 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
// 生成验证码 // 生成验证码
if ("math".equals(captchaType)) { if ("math".equals(captchaType)) {
String capText = captchaProducerMath.createText(); String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@")); capStr = capText.substring(0, capText.lastIndexOf(ANTE_STR));
code = capText.substring(capText.lastIndexOf("@") + 1); code = capText.substring(capText.lastIndexOf(ANTE_STR) + 1);
image = captchaProducerMath.createImage(capStr); image = captchaProducerMath.createImage(capStr);
} else if ("char".equals(captchaType)) { } else if ("char".equals(captchaType)) {
capStr = code = captchaProducer.createText(); capStr = code = captchaProducer.createText();

View File

@ -10,6 +10,9 @@ import lombok.experimental.SuperBuilder;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import static com.muyu.common.core.constant.SplitConstants.*;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* gen_table_column * gen_table_column
* *
@ -343,11 +346,11 @@ public class GenTableColumn extends BaseEntity {
String remarks = StringUtils.substringBetween(this.columnComment, "", ""); String remarks = StringUtils.substringBetween(this.columnComment, "", "");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(remarks)) { if (StringUtils.isNotEmpty(remarks)) {
for (String value : remarks.split(" ")) { for (String value : remarks.split(EMPTY_STR)) {
if (StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {
Object startStr = value.subSequence(0, 1); Object startStr = value.subSequence(0, 1);
String endStr = value.substring(1); String endStr = value.substring(1);
sb.append(startStr).append("=").append(endStr).append(","); sb.append(startStr).append(EQUAL_STR).append(endStr).append(COMMA_STR);
} }
} }
return sb.deleteCharAt(sb.length() - 1).toString(); return sb.deleteCharAt(sb.length() - 1).toString();

View File

@ -9,6 +9,8 @@ import org.apache.commons.lang3.RegExUtils;
import java.util.Arrays; import java.util.Arrays;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -54,7 +56,7 @@ public class GenUtils {
column.setHtmlType(GenConstants.HTML_INPUT); column.setHtmlType(GenConstants.HTML_INPUT);
// 如果是浮点型 统一用BigDecimal // 如果是浮点型 统一用BigDecimal
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), COMMA_STR);
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
column.setJavaType(GenConstants.TYPE_BIGDECIMAL); column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
} }
@ -131,7 +133,7 @@ public class GenUtils {
* @return * @return
*/ */
public static String getModuleName (String packageName) { public static String getModuleName (String packageName) {
int lastIndex = packageName.lastIndexOf("."); int lastIndex = packageName.lastIndexOf(POINT_STR);
int nameLength = packageName.length(); int nameLength = packageName.length();
return StringUtils.substring(packageName, lastIndex + 1, nameLength); return StringUtils.substring(packageName, lastIndex + 1, nameLength);
} }
@ -144,7 +146,7 @@ public class GenUtils {
* @return * @return
*/ */
public static String getBusinessName (String tableName) { public static String getBusinessName (String tableName) {
int lastIndex = tableName.lastIndexOf("_"); int lastIndex = tableName.lastIndexOf(UNDERLINE_STR);
int nameLength = tableName.length(); int nameLength = tableName.length();
return StringUtils.substring(tableName, lastIndex + 1, nameLength); return StringUtils.substring(tableName, lastIndex + 1, nameLength);
} }
@ -160,7 +162,7 @@ public class GenUtils {
boolean autoRemovePre = GenConfig.getAutoRemovePre(); boolean autoRemovePre = GenConfig.getAutoRemovePre();
String tablePrefix = GenConfig.getTablePrefix(); String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
String[] searchList = StringUtils.split(tablePrefix, ","); String[] searchList = StringUtils.split(tablePrefix, COMMA_STR);
tableName = replaceFirst(tableName, searchList); tableName = replaceFirst(tableName, searchList);
} }
return StringUtils.convertToCamelCase(tableName); return StringUtils.convertToCamelCase(tableName);

View File

@ -459,7 +459,7 @@ export default {
this.form = response.data; this.form = response.data;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(COMMA_STR);
#end #end
#end #end
this.open = true; this.open = true;
@ -472,7 +472,7 @@ export default {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(COMMA_STR);
#end #end
#end #end
if (this.form.${pkColumn.javaField} != null) { if (this.form.${pkColumn.javaField} != null) {

View File

@ -510,7 +510,7 @@ export default {
this.form = response.data; this.form = response.data;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(COMMA_STR);
#end #end
#end #end
#if($table.sub) #if($table.sub)
@ -526,7 +526,7 @@ export default {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(COMMA_STR);
#end #end
#end #end
#if($table.sub) #if($table.sub)

View File

@ -426,7 +426,7 @@ async function handleUpdate(row) {
form.value = response.data; form.value = response.data;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(COMMA_STR);
#end #end
#end #end
open.value = true; open.value = true;
@ -440,7 +440,7 @@ function submitForm() {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(COMMA_STR);
#end #end
#end #end
if (form.value.${pkColumn.javaField} != null) { if (form.value.${pkColumn.javaField} != null) {

View File

@ -491,7 +491,7 @@ function handleUpdate(row) {
form.value = response.data; form.value = response.data;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(COMMA_STR);
#end #end
#end #end
#if($table.sub) #if($table.sub)
@ -508,7 +508,7 @@ function submitForm() {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(COMMA_STR);
#end #end
#end #end
#if($table.sub) #if($table.sub)

View File

@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -52,7 +54,7 @@ public class SysDeptController extends BaseController {
@GetMapping("/list/exclude/{deptId}") @GetMapping("/list/exclude/{deptId}")
public Result<List<SysDept>> excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) { public Result<List<SysDept>> excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> deptList = deptService.queryList(SysDeptPageQueryModel.builder().build()); List<SysDept> deptList = deptService.queryList(SysDeptPageQueryModel.builder().build());
deptList.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId)); deptList.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), COMMA_STR), deptId));
return success(deptList); return success(deptList);
} }

View File

@ -25,6 +25,8 @@ import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -103,7 +105,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
Set<String> permsSet = new HashSet<>(); Set<String> permsSet = new HashSet<>();
for (String perm : perms) { for (String perm : perms) {
if (StringUtils.isNotEmpty(perm)) { if (StringUtils.isNotEmpty(perm)) {
permsSet.addAll(Arrays.asList(perm.trim().split(","))); permsSet.addAll(Arrays.asList(perm.trim().split(COMMA_STR)));
} }
} }
return permsSet; return permsSet;
@ -122,7 +124,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
Set<String> permsSet = new HashSet<>(); Set<String> permsSet = new HashSet<>();
for (String perm : perms) { for (String perm : perms) {
if (StringUtils.isNotEmpty(perm)) { if (StringUtils.isNotEmpty(perm)) {
permsSet.addAll(Arrays.asList(perm.trim().split(","))); permsSet.addAll(Arrays.asList(perm.trim().split(COMMA_STR)));
} }
} }
return permsSet; return permsSet;

View File

@ -29,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -109,7 +111,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
Set<String> permsSet = new HashSet<>(); Set<String> permsSet = new HashSet<>();
for (SysRole perm : perms) { for (SysRole perm : perms) {
if (StringUtils.isNotNull(perm)) { if (StringUtils.isNotNull(perm)) {
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(COMMA_STR)));
} }
} }
return permsSet; return permsSet;

View File

@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.muyu.common.core.constant.SplitConstants.*;
/** /**
* *
* *
@ -140,7 +142,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(COMMA_STR));
} }
/** /**
@ -156,7 +158,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); return list.stream().map(SysPost::getPostName).collect(Collectors.joining(COMMA_STR));
} }
/** /**