|
@@ -13,6 +13,7 @@ class LookuserService extends CrudService {
|
|
|
super(ctx, 'lookuser');
|
|
|
this.model = this.ctx.model.Lookuser;
|
|
|
this.rmodel = this.ctx.model.Lookrecord;
|
|
|
+ this.umodel = this.ctx.model.Roomuser;
|
|
|
}
|
|
|
|
|
|
async create(data) {
|
|
@@ -76,6 +77,41 @@ class LookuserService extends CrudService {
|
|
|
const res = await lookuser.save();
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ async query({ skip, limit, ...info }) {
|
|
|
+ const total = await this.model.count(info);
|
|
|
+ const lusers = await this.model
|
|
|
+ .find(info)
|
|
|
+ .skip(Number(skip))
|
|
|
+ .limit(Number(limit));
|
|
|
+ const data = [];
|
|
|
+ for (const _luser of lusers) {
|
|
|
+ const luser = _.cloneDeep(JSON.parse(JSON.stringify(_luser)));
|
|
|
+ const user = await this.umodel.findById(_luser.userid);
|
|
|
+ if (user) {
|
|
|
+ luser.idnumber = user.number;
|
|
|
+ luser.isjc = user.isjc;
|
|
|
+ luser.isxf = user.isxf;
|
|
|
+ luser.address = user.address;
|
|
|
+ luser.age = user.age;
|
|
|
+ luser.gender = user.gender;
|
|
|
+ if (user.hosname) {
|
|
|
+ luser.hosname = user.hosname;
|
|
|
+ }
|
|
|
+ if (user.deptname) {
|
|
|
+ luser.deptname = user.deptname;
|
|
|
+ }
|
|
|
+ if (user.level) {
|
|
|
+ luser.level = user.level;
|
|
|
+ }
|
|
|
+ if (user.major) {
|
|
|
+ luser.major = user.major;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.push(luser);
|
|
|
+ }
|
|
|
+ return { data, total };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = LookuserService;
|