You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sys22/baseSys/userSys/realization/test/连表查询.js

21 lines
610 B

/**
* 数据操作的方法封装
* */
const {init, exec, sql, transaction} = require('mysqls')
const config = require("../config/default.config");
init({
host: config.DATABASE_INIT.host,
user: config.DATABASE_INIT.user,
password: config.DATABASE_INIT.password,
database: config.DATABASE_INIT.database,
port: config.DATABASE_INIT.port,
})
let sqlstring = sql.field('authority_id').table('user_relation_authority').where({role_id:4}).select()
let SQQ = sql.query(`SELECT * from user_authority where id in (${sqlstring})`)
console.log(SQQ)
exec(SQQ).then(res => {
console.log(res)
})