mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Fixed can not search [] bug
This commit is contained in:
@@ -9,6 +9,7 @@ import com.cfive.pinnacle.exception.TokenHasExpiredException;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
|
import org.springframework.jdbc.UncategorizedSQLException;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.DisabledException;
|
import org.springframework.security.authentication.DisabledException;
|
||||||
@@ -49,6 +50,9 @@ public class CustomExceptionHandler {
|
|||||||
if (e instanceof DataValidationFailedException) {
|
if (e instanceof DataValidationFailedException) {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DATA_VALIDATION_FAILED, e.getMessage(), null);
|
return ResponseResult.build(ResponseCode.DATABASE_DATA_VALIDATION_FAILED, e.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
if (e instanceof UncategorizedSQLException) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_EXECUTE_ERROR, "error", null);
|
||||||
|
}
|
||||||
|
|
||||||
log.debug(e.getMessage(), e);
|
log.debug(e.getMessage(), e);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const DATABASE_TIMEOUT_ERROR = 20035
|
|||||||
const DATABASE_CONNECT_ERROR = 20036
|
const DATABASE_CONNECT_ERROR = 20036
|
||||||
const DATABASE_DATA_TO_LONG = 20037
|
const DATABASE_DATA_TO_LONG = 20037
|
||||||
const DATABASE_DATA_VALIDATION_FAILED = 20038
|
const DATABASE_DATA_VALIDATION_FAILED = 20038
|
||||||
|
const DATABASE_EXECUTE_ERROR = 20039
|
||||||
|
|
||||||
const UNAUTHORIZED = 30010
|
const UNAUTHORIZED = 30010
|
||||||
const ACCESS_DENIED = 30030
|
const ACCESS_DENIED = 30030
|
||||||
@@ -73,6 +74,7 @@ export {
|
|||||||
DATABASE_CONNECT_ERROR,
|
DATABASE_CONNECT_ERROR,
|
||||||
DATABASE_DATA_TO_LONG,
|
DATABASE_DATA_TO_LONG,
|
||||||
DATABASE_DATA_VALIDATION_FAILED,
|
DATABASE_DATA_VALIDATION_FAILED,
|
||||||
|
DATABASE_EXECUTE_ERROR,
|
||||||
UNAUTHORIZED,
|
UNAUTHORIZED,
|
||||||
ACCESS_DENIED,
|
ACCESS_DENIED,
|
||||||
USER_DISABLE,
|
USER_DISABLE,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
ACCESS_DENIED,
|
ACCESS_DENIED,
|
||||||
DATABASE_DATA_TO_LONG,
|
DATABASE_DATA_TO_LONG,
|
||||||
DATABASE_DATA_VALIDATION_FAILED,
|
DATABASE_DATA_VALIDATION_FAILED,
|
||||||
|
DATABASE_EXECUTE_ERROR,
|
||||||
TOKEN_HAS_EXPIRED,
|
TOKEN_HAS_EXPIRED,
|
||||||
TOKEN_IS_ILLEGAL,
|
TOKEN_IS_ILLEGAL,
|
||||||
TOKEN_RENEW_SUCCESS,
|
TOKEN_RENEW_SUCCESS,
|
||||||
@@ -19,6 +20,19 @@ const service = axios.create({
|
|||||||
withCredentials: false
|
withCredentials: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
service.defaults.paramsSerializer = (params) => {
|
||||||
|
return Object.keys(params)
|
||||||
|
.filter((it) => {
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
|
return params.hasOwnProperty(it)
|
||||||
|
})
|
||||||
|
.reduce((pre, curr) => {
|
||||||
|
return params[curr] !== null
|
||||||
|
? (pre !== '' ? pre + '&' : '') + curr + '=' + encodeURIComponent(params[curr])
|
||||||
|
: pre
|
||||||
|
}, '')
|
||||||
|
}
|
||||||
|
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
async (config) => {
|
async (config) => {
|
||||||
let token = getToken()
|
let token = getToken()
|
||||||
@@ -83,6 +97,12 @@ service.interceptors.response.use(
|
|||||||
message: '<strong>数据验证失败</strong>'
|
message: '<strong>数据验证失败</strong>'
|
||||||
})
|
})
|
||||||
return await Promise.reject(response?.data)
|
return await Promise.reject(response?.data)
|
||||||
|
case DATABASE_EXECUTE_ERROR:
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>数据库执行出错</strong>'
|
||||||
|
})
|
||||||
|
return await Promise.reject(response?.data)
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user