contract-file.service.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient } from '@angular/common/http';
  3. import { BaseResponse } from 'app/entity/baseResponse';
  4. import { Result } from 'app/entity/Result';
  5. import { ContractFile } from 'app/entity/contract-management/contract-file';
  6. @Injectable({
  7. providedIn: 'root'
  8. })
  9. /**
  10. * 合同主表
  11. */
  12. export class ContractFileService {
  13. constructor(private http:HttpClient) { }
  14. //分页查询
  15. async getList(body: any): Promise<BaseResponse<Result<any>>> {
  16. return await this.http
  17. .get<BaseResponse<Result<any>>>('contract.file/contractFile/list', { params: body })
  18. .toPromise();
  19. }
  20. //分页查询
  21. async getPageList(body: any): Promise<BaseResponse<Result<any>>> {
  22. return await this.http
  23. .get<BaseResponse<Result<any>>>('contract.file/contractFile/getPageList', { params: body })
  24. .toPromise();
  25. }
  26. //新增
  27. async add(body: ContractFile): Promise<BaseResponse<any>> {
  28. return await this.http.post<BaseResponse<any>>('contract.file/contractFile/add', body).toPromise();
  29. }
  30. //主表和子表数据一起保存
  31. async saveMainAndChild(body: ContractFile): Promise<BaseResponse<any>> {
  32. return await this.http.post<BaseResponse<any>>('contract.file/contractFile/saveMainAndChild', body).toPromise();
  33. }
  34. //根据id查询
  35. async queryById(id: string): Promise<BaseResponse<any>> {
  36. return await this.http
  37. .get<BaseResponse<any>>('contract.file/contractFile/queryById', { params: { id: id } })
  38. .toPromise();
  39. }
  40. //根据主表id查询主子表数据
  41. async queryMainAndChildById(id: string): Promise<BaseResponse<any>> {
  42. return await this.http
  43. .get<BaseResponse<any>>('contract.file/contractFile/queryMainAndChildById', { params: { id: id } })
  44. .toPromise();
  45. }
  46. //删除
  47. async delete(body:any):Promise<BaseResponse<any>>{
  48. return await this.http.delete<BaseResponse<any>>('contract.file/contractFile/delete',{params:body}).toPromise();
  49. }
  50. //主表与子表一起删除
  51. async deleteMainAndChild(id:any):Promise<BaseResponse<any>>{
  52. return await this.http.delete<BaseResponse<any>>('contract.file/contractFile/deleteMainAndChild',{params:{id:id}}).toPromise();
  53. }
  54. //修改
  55. async update(body: ContractFile): Promise<BaseResponse<any>> {
  56. return await this.http.put<BaseResponse<any>>('contract.file/contractFile/edit', body).toPromise();
  57. }
  58. //主表和子表一起修改
  59. async updateMainAndChild(body: ContractFile): Promise<BaseResponse<any>> {
  60. return await this.http.put<BaseResponse<any>>('contract.file/contractFile/updateMainAndChild', body).toPromise();
  61. }
  62. }