|
@@ -6,6 +6,7 @@ import { OrderDetail } from '../entity/OrderDetail.entity';
|
|
|
import { Good } from '../entity/Good.entity';
|
|
|
import { Specs } from '../entity/Specs.entity';
|
|
|
import { User } from '../entity/User.entity';
|
|
|
+import _ = require('lodash');
|
|
|
type modelType = ReturnModelType<typeof OrderDetail>;
|
|
|
@Provide()
|
|
|
export class OrderDetailService extends BaseService<modelType> {
|
|
@@ -54,4 +55,22 @@ export class OrderDetailService extends BaseService<modelType> {
|
|
|
}
|
|
|
return { list, total };
|
|
|
}
|
|
|
+ // 详情
|
|
|
+ async detail(id) {
|
|
|
+ const res = await this.model.findById(id).lean();
|
|
|
+ let arr;
|
|
|
+ const info: any = {};
|
|
|
+ arr = await this.goodModel.findById(res.good).lean();
|
|
|
+ info.good_name = arr.name;
|
|
|
+ info.good_file = info.file[0];
|
|
|
+ arr = await this.specModel.findById(res.spec).lean();
|
|
|
+ info.spec_name = arr.name;
|
|
|
+ info.spec_file = arr.file[0];
|
|
|
+ arr = await this.userModel.findById(res.user).lean();
|
|
|
+ info.user_name = arr.name;
|
|
|
+ arr = await this.userModel.findById(res.supplier).lean();
|
|
|
+ info.supplier_name = arr.name;
|
|
|
+ const result = _.assign(info, res);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|