1. Error list
1.1. Out of range value for column “xx” at row x
- Explanation: Column 'xx' at row 'x' is out of range
- Reason: When creating a table, the type is bigint and the length is 20, as follows
字段的值超过其可输入的范围了
- Solution: Modify the value to the length set by the column
1.2. Incorrect datetime value:“for column 数据库名
.表名
.字段
” at row 1
- Explanation: The xx column in the xx table of the xx database is an incorrect date value.
- Reason: The following settings default to NULL, then the default is '0000-00-00 00:00:00'
- Solution: The value filled in
“0000-00-00 00:00:00”
will not report an error
1.3. Cannot deserialize value of type java.util.Date
from String “2023-05-29T18:02:02.000Z”: expected format “yyyy-MM-dd HH:mm:ss”;
- Explanation: What is expected is
yyyy-MM-dd HH:mm:ss
the format, and what is obtained isyyyy-MM-ddTHH:mm:ss.000Z
- Reason: the value passed from the front and back ends, and the parameter passed to the calling interface is incorrect
- Solution: The time can be transferred to the backend through the filter,
见附录二的 2.1
1.4. Operand should contain 1 column
- Explanation: Two tables are jointly searched, and the query result in the operated data has no column value
- Reason: This part is not yet understood
- Reference: reason
1.5 Subquery returns more than 1 row
- Explanation: Two tables are jointly searched, and the subquery returns multiple pieces of data
- Reason: the sql can only return one piece of data
- Reference: A table (tree structure) joint query, returns the tree structure.
附录二 2.2
1.6 Error querying database. Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘xxx.updata_time’ in ‘order clause’\r\n### The error may exist in file
- Elaboration: The column "borrow.updata_time" could not be found
- Reason: update_time is written wrong
1.7 class java.lang.String cannot be cast to class java.util.Date (java.lang.String and java.util.Date are in module java.base of loader ‘bootstrap’)
- Explanation: Converting String to Date type is not allowed
- Reason: The front end uses the component el-data-picker to implement the function of filtering time. The time type passed in when passing parameters is 'String', but it is converted to 'Date' when receiving in the back end
- Solution: Change the front and back ends to the same String type
1.8 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘[borrow_state] LIKE ‘%21%’)’ at line 1\r\n### The error may exist in org/springblade/modules/archiveAdvantage/mapper/ArchiveBorrowRelateMapper.java (best guess)\r\n### The error may involve defaultParameterMap\r\
- Explanation: SQL syntax error
- Reason: Type error when passing parameters
1.9 Failed to process,Error SQL
- Explanation: SQL confusion
- Reason: More or less useless fields are written
1.10 nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘param’ not found. Available parameters are [page, params, param1, param2]"
- Explanation: param not found
- Reason: When using sql statement, param.xxx is used. However undefined
- 解决:加上即可 @Param(“param”)
nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2"
1.11 nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
- Explanation: Expected one result, found two
- Reason: The method getOne to obtain the list in the later stage only allows one return value
1.12
2. Appendix
2.1. Date format conversion
// 1. 先放在js文件,路径为:@/utils/date.js
export function dateFormat(date, format) {
format = format || 'yyyy-MM-dd hh:mm:ss'
if (date !== 'Invalid Date') {
let o = {
'M+': date.getMonth() + 1, //month
'd+': date.getDate(), //day
'h+': date.getHours(), //hour
'm+': date.getMinutes(), //minute
's+': date.getSeconds(), //second
'q+': Math.floor((date.getMonth() + 3) / 3), //quarter
S: date.getMilliseconds(), //millisecond
}
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
)
for (let k in o)
if (new RegExp('(' + k + ')').test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length === 1
? o[k]
: ('00' + o[k]).substr(('' + o[k]).length)
)
return format
}
return ''
}
// 2. 在vue文件中使用
import {
dateFormat } from '@/utils/date'
methods: {
submit(){
let time = dateFormat(要处理的时间)
}
2.2 A table self-connected query, get the list of children and the name of the parent
– 1. SELECT
sort.*,( SELECT ca.catamanage_name FROM admin_archive_attach_sort ca WHERE ca.id = sort.parent_id ) AS parentName
FROM
admin_archive_attach_sort sort
WHERE
sort.id = '166134770833992499 4'– 2. SELECT
sort
.*,
ca.catamanage_name parentName
FROM
admin_archive_attach_sort sort
LEFT JOIN admin_archive_attach_sort ca ON sort.parent_id = ca.id
WHERE
sort.id = '1661347708339924994'