|
@@ -40,7 +40,19 @@ class UserService extends CrudService {
|
|
|
|
|
|
// 重写修改方法
|
|
// 重写修改方法
|
|
async update({ id }, data) {
|
|
async update({ id }, data) {
|
|
- const { name, phone, passwd, openid, role, menus, remark, uid, deptid, deptname, pid } = data;
|
|
|
|
|
|
+ const {
|
|
|
|
+ name,
|
|
|
|
+ phone,
|
|
|
|
+ passwd,
|
|
|
|
+ openid,
|
|
|
|
+ role,
|
|
|
|
+ menus,
|
|
|
|
+ remark,
|
|
|
|
+ uid,
|
|
|
|
+ deptid,
|
|
|
|
+ deptname,
|
|
|
|
+ pid,
|
|
|
|
+ } = data;
|
|
const user = await this.model.findById(id, '+passwd');
|
|
const user = await this.model.findById(id, '+passwd');
|
|
if (name) {
|
|
if (name) {
|
|
user.name = name;
|
|
user.name = name;
|
|
@@ -141,12 +153,28 @@ class UserService extends CrudService {
|
|
}
|
|
}
|
|
|
|
|
|
async finduserlist({ skip, limit, ...info }) {
|
|
async finduserlist({ skip, limit, ...info }) {
|
|
- const query = { ...info, $or: [{ role: '4' }, { role: '5' }, { role: '6' }] };
|
|
|
|
|
|
+ const query = {
|
|
|
|
+ ...info,
|
|
|
|
+ $or: [{ role: '4' }, { role: '5' }, { role: '6' }],
|
|
|
|
+ };
|
|
const total = await this.model.count(query);
|
|
const total = await this.model.count(query);
|
|
- const data = await this.model.find(query).skip(Number(skip)).limit(Number(limit));
|
|
|
|
|
|
+ const data = await this.model
|
|
|
|
+ .find(query)
|
|
|
|
+ .skip(Number(skip))
|
|
|
|
+ .limit(Number(limit));
|
|
return { data, total };
|
|
return { data, total };
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async businessuser({ pid, skip, limit }) {
|
|
|
|
+ assert(pid, '数据错误,缺少pid');
|
|
|
|
+ const query = { pid, code: { $regex: /^.{9}$/ } };
|
|
|
|
+ const total = await this.model.count(query);
|
|
|
|
+ const data = await this.model
|
|
|
|
+ .find(query)
|
|
|
|
+ .skip(Number(skip))
|
|
|
|
+ .limit(Number(limit));
|
|
|
|
+ return { data, total };
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = UserService;
|
|
module.exports = UserService;
|