修复异常

This commit is contained in:
aixianling
2022-07-14 11:51:29 +08:00
parent 7a22c233fe
commit 21102cdfe2
2 changed files with 4 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ module.exports = {
this.pool = mysql.createPool(dbConfig)
},
query,
list: ({table, search, con}) => {
list: ({table, search, con = ''}) => {
//列表查询
let total = 0, records = []
if (table) {
@@ -37,7 +37,7 @@ module.exports = {
query(`select 1 from ${table} where name like '%${con}%' ${sqlCon}`).then(res => {
return total = res.length
}),
query(`select * from ${table} where name like '%${con}%' ${sqlCon} limit ${(current-1)*size},${size||10}`).then(res => {
query(`select * from ${table} where name like '%${con}%' ${sqlCon} limit ${((current-1)||0)*size},${size||10}`).then(res => {
return records = res
})
]).then(() => {