compleViewModel.js 812 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Created by Zhong on 2017/12/22.
  3. */
  4. let rationRepositoryModel = require('../../ration_repository/models/repository_map').Model;
  5. class CompleViewModel {
  6. async getRationLib(rationRepId, callback){
  7. try{
  8. let rationLib = await rationRepositoryModel.find({ID: rationRepId, $or: [{deleted: null}, {deleted: false}]});
  9. callback(0, rationLib);
  10. }
  11. catch(err) {
  12. callback(err, null);
  13. }
  14. }
  15. async getRationLibs(compilationId, callback){
  16. try{
  17. let rationLibs = await rationRepositoryModel.find({compilationId: compilationId, $or: [{deleted: null}, {deleted: false}]});
  18. callback(0, rationLibs);
  19. }
  20. catch(err) {
  21. callback(err, null);
  22. }
  23. }
  24. }
  25. export default CompleViewModel;