明树Git Lab

Commit 5eb6d71d authored by zhangqi's avatar zhangqi

userinfo add include

parent eb45c129
...@@ -140,12 +140,24 @@ async function getUserInfo(req, res, next) { ...@@ -140,12 +140,24 @@ async function getUserInfo(req, res, next) {
where: query, where: query,
// raw: true, // raw: true,
attributes: { exclude: ['password', 'salt'] }, attributes: { exclude: ['password', 'salt'] },
include: [{ include: [
{
model: DB.Role, model: DB.Role,
as: 'roles', as: 'roles',
// where: { del: 0 }, // where: { del: 0 },
// attributes: ['id'] // attributes: ['id']
}] },{
model: DB.Depart,
as: 'departs',
// attributes: ["id"],
// through: { attributes: [] },
}, {
model: DB.Position,
as: 'positions',
// attributes: ["id"],
// through: { attributes: [] },
}
]
}); });
return res.sendData(ret); return res.sendData(ret);
} catch (error) { } catch (error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment