ctr_contract_collection.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package contract
  2. import (
  3. "context"
  4. model "dashoo.cn/micro/app/model/contract"
  5. service "dashoo.cn/micro/app/service/contract"
  6. "dashoo.cn/common_definition/comm_def"
  7. "github.com/gogf/gf/frame/g"
  8. )
  9. type CtrContractCollection struct{}
  10. // Swagger:CtrContractCollection 合同回款 查询合同回款
  11. func (c *CtrContractCollection) List(ctx context.Context, req *model.CtrContractCollectionListReq, rsp *comm_def.CommonMsg) error {
  12. g.Log().Infof("CtrContractCollection.List request %#v ", *req)
  13. s, err := service.NewCtrContractCollectionService(ctx)
  14. if err != nil {
  15. return err
  16. }
  17. total, ent, err := s.List(ctx, req)
  18. //_, err, code, msg := myerrors.CheckError(err)
  19. if err != nil {
  20. return err
  21. }
  22. if ent == nil {
  23. ent = []*model.CtrContractCollectionListRsp{}
  24. }
  25. //rsp.Code = code
  26. //rsp.Msg = msg
  27. rsp.Data = map[string]interface{}{
  28. "total": total,
  29. "list": ent,
  30. }
  31. return nil
  32. }
  33. // Swagger:CtrContractCollection 合同回款 添加合同回款
  34. func (c *CtrContractCollection) Add(ctx context.Context, req *model.CtrContractCollectionAddReq, rsp *comm_def.CommonMsg) error {
  35. g.Log().Infof("CtrContractCollection.Add request %#v ", *req)
  36. s, err := service.NewCtrContractCollectionService(ctx)
  37. if err != nil {
  38. return err
  39. }
  40. id, err := s.Add(ctx, req)
  41. //_, err, code, msg := myerrors.CheckError(err)
  42. if err != nil {
  43. return err
  44. }
  45. //rsp.Code = code
  46. //rsp.Msg = msg
  47. rsp.Data = id
  48. return nil
  49. }
  50. // Swagger:CtrContractCollection 合同回款 更新合同回款
  51. func (c *CtrContractCollection) Update(ctx context.Context, req *model.CtrContractCollectionUpdateReq, rsp *comm_def.CommonMsg) error {
  52. g.Log().Infof("CtrContractCollection.Update request %#v ", *req)
  53. s, err := service.NewCtrContractCollectionService(ctx)
  54. if err != nil {
  55. return err
  56. }
  57. err = s.Update(ctx, req)
  58. //_, err, code, msg := myerrors.CheckError(err)
  59. if err != nil {
  60. return err
  61. }
  62. //rsp.Code = code
  63. //rsp.Msg = msg
  64. return nil
  65. }
  66. // Swagger:CtrContractCollection 合同回款 删除合同回款
  67. func (c *CtrContractCollection) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error {
  68. g.Log().Infof("CtrContractCollection.Delete request %#v ", *req)
  69. s, err := service.NewCtrContractCollectionService(ctx)
  70. if err != nil {
  71. return err
  72. }
  73. err = s.Delete(ctx, req.Id)
  74. //_, err, code, msg := myerrors.CheckError(err)
  75. if err != nil {
  76. return err
  77. }
  78. //rsp.Code = code
  79. //rsp.Msg = msg
  80. return nil
  81. }