zhangqian
2023-08-07 6f52e069fe72b4e37b0712a7e097e3af97bbc25e
收款计划兼容其他模块
10个文件已修改
199 ■■■■■ 已修改文件
api/v1/serviceCollectionPlan.go 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/serviceCollectionPlan.go 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.sum 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceCollectionPlan.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceCollectionPlan.go 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/serviceCollectionPlan.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceCollectionPlan.go
@@ -1,6 +1,7 @@
package v1
import (
    "aps_crm/constvar"
    "aps_crm/model/request"
    "aps_crm/model/response"
    "aps_crm/pkg/contextx"
@@ -13,8 +14,8 @@
type ServiceCollectionPlanApi struct{}
// Add
// @Tags        服务合同收款计划管理
// @Summary    添加服务合同收款计划
// @Tags        收款计划管理
// @Summary    添加收款计划
// @Produce    application/json
// @Param        object    body        request.AddServiceCollectionPlan    true    "查询参数"
// @Success    200        {object}    contextx.Response{}
@@ -24,6 +25,20 @@
    ctx, ok := contextx.NewContext(c, &params)
    if !ok {
        return
    }
    for _, plan := range params.List {
        if plan.SourceType == 0 ||
            plan.SourceId == 0 ||
            plan.CollectionType == 0 ||
            plan.CollectionDate.IsZero() ||
            plan.Amount.IsZero() ||
            plan.Percent.IsZero() ||
            plan.PrincipalId == 0 {
            ctx.Fail(ecode.ParamsErr)
            return
        }
        plan.Status = constvar.CollectionStatusUnCollected
    }
    errCode := service.NewServiceCollectionPlanService().AddServiceCollectionPlan(params.List)
@@ -36,8 +51,8 @@
}
// Delete
// @Tags        服务合同收款计划管理
// @Summary    删除服务合同收款计划
// @Tags        收款计划管理
// @Summary    删除收款计划
// @Produce    application/json
// @Param        id    path        int    true    "查询参数"
// @Success    200    {object}    contextx.Response{}
@@ -59,8 +74,8 @@
}
// Update
// @Tags        服务合同收款计划管理
// @Summary    更新服务合同收款计划
// @Tags        收款计划管理
// @Summary    更新收款计划
// @Produce    application/json
// @Param        object    body        request.UpdateServiceCollectionPlan    true    "查询参数"
// @Success    200        {object}    contextx.Response{}
@@ -86,8 +101,8 @@
}
// List
// @Tags        服务合同收款计划管理
// @Summary    获取服务合同收款计划列表
// @Tags        收款计划管理
// @Summary    获取收款计划列表
// @Produce    application/json
// @Param        object    query        request.GetServiceCollectionPlanList    true    "参数"
// @Success    200    {object}    response.ListResponse{data=[]model.ServiceCollectionPlan}
constvar/serviceCollectionPlan.go
@@ -1,4 +1,5 @@
package constvar
type ServiceCollectionPlanQueryClass string
const (
@@ -8,5 +9,12 @@
type ServiceCollectionPlanKeywordType string
const (
    ServiceCollectionPlanKeywordCustomerName   ServiceCollectionPlanKeywordType = ""
    ServiceCollectionPlanKeywordCustomerName ServiceCollectionPlanKeywordType = ""
)
type CollectionStatus int
const (
    CollectionStatusUnCollected CollectionStatus = 1 //待收款
    CollectionStatusCollected   CollectionStatus = 2 //已收款
)
docs/docs.go
@@ -6693,9 +6693,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "添加服务合同收款计划",
                "summary": "添加收款计划",
                "parameters": [
                    {
                        "description": "查询参数",
@@ -6723,9 +6723,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "删除服务合同收款计划",
                "summary": "删除收款计划",
                "parameters": [
                    {
                        "type": "integer",
@@ -6751,9 +6751,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "获取服务合同收款计划列表",
                "summary": "获取收款计划列表",
                "parameters": [
                    {
                        "type": "integer",
@@ -6793,9 +6793,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "更新服务合同收款计划",
                "summary": "更新收款计划",
                "parameters": [
                    {
                        "description": "查询参数",
@@ -10444,8 +10444,12 @@
                    "description": "备注",
                    "type": "string"
                },
                "serviceContractId": {
                    "description": "服务合同id",
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                },
                "status": {
@@ -14648,8 +14652,12 @@
                    "description": "备注",
                    "type": "string"
                },
                "serviceContractId": {
                    "description": "服务合同id",
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                },
                "status": {
docs/swagger.json
@@ -6681,9 +6681,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "添加服务合同收款计划",
                "summary": "添加收款计划",
                "parameters": [
                    {
                        "description": "查询参数",
@@ -6711,9 +6711,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "删除服务合同收款计划",
                "summary": "删除收款计划",
                "parameters": [
                    {
                        "type": "integer",
@@ -6739,9 +6739,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "获取服务合同收款计划列表",
                "summary": "获取收款计划列表",
                "parameters": [
                    {
                        "type": "integer",
@@ -6781,9 +6781,9 @@
                    "application/json"
                ],
                "tags": [
                    "服务合同收款计划管理"
                    "收款计划管理"
                ],
                "summary": "更新服务合同收款计划",
                "summary": "更新收款计划",
                "parameters": [
                    {
                        "description": "查询参数",
@@ -10432,8 +10432,12 @@
                    "description": "备注",
                    "type": "string"
                },
                "serviceContractId": {
                    "description": "服务合同id",
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                },
                "status": {
@@ -14636,8 +14640,12 @@
                    "description": "备注",
                    "type": "string"
                },
                "serviceContractId": {
                    "description": "服务合同id",
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                },
                "status": {
docs/swagger.yaml
@@ -1166,8 +1166,11 @@
      remark:
        description: 备注
        type: string
      serviceContractId:
        description: 服务合同id
      sourceId:
        description: 源单id
        type: integer
      sourceType:
        description: 源单类型(1销售明细2服务合同3销售发票)
        type: integer
      status:
        description: 状态(1未收2已收)
@@ -4012,8 +4015,11 @@
      remark:
        description: 备注
        type: string
      serviceContractId:
        description: 服务合同id
      sourceId:
        description: 源单id
        type: integer
      sourceType:
        description: 源单类型(1销售明细2服务合同3销售发票)
        type: integer
      status:
        description: 状态(1未收2已收)
@@ -9104,9 +9110,9 @@
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 添加服务合同收款计划
      summary: 添加收款计划
      tags:
      - 服务合同收款计划管理
      - 收款计划管理
  /api/serviceCollectionPlan/delete/{id}:
    delete:
      parameters:
@@ -9122,9 +9128,9 @@
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 删除服务合同收款计划
      summary: 删除收款计划
      tags:
      - 服务合同收款计划管理
      - 收款计划管理
  /api/serviceCollectionPlan/list:
    get:
      parameters:
@@ -9146,9 +9152,9 @@
                    $ref: '#/definitions/model.ServiceCollectionPlan'
                  type: array
              type: object
      summary: 获取服务合同收款计划列表
      summary: 获取收款计划列表
      tags:
      - 服务合同收款计划管理
      - 收款计划管理
  /api/serviceCollectionPlan/update:
    put:
      parameters:
@@ -9165,9 +9171,9 @@
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 更新服务合同收款计划
      summary: 更新收款计划
      tags:
      - 服务合同收款计划管理
      - 收款计划管理
  /api/serviceContract/add:
    post:
      parameters:
go.mod
@@ -31,6 +31,7 @@
    gorm.io/driver/mysql v1.5.1
    gorm.io/gorm v1.25.1
    moul.io/zapgorm2 v1.3.0
    github.com/shopspring/decimal v1.3.1
)
require (
@@ -96,6 +97,7 @@
    github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
    github.com/rogpeppe/go-internal v1.10.0 // indirect
    github.com/shirou/gopsutil/v3 v3.22.5 // indirect
    github.com/shopspring/decimal v1.3.1 // indirect
    github.com/spf13/afero v1.9.5 // indirect
    github.com/spf13/cast v1.5.1 // indirect
    github.com/spf13/jwalterweatherman v1.1.0 // indirect
go.sum
@@ -50,6 +50,8 @@
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible h1:Ft+KeWIJxFP76LqgJbvtOA1qBIoC8vGkTV3QeCOeJC4=
github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
@@ -165,6 +167,7 @@
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
@@ -259,6 +262,8 @@
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
@@ -379,6 +384,7 @@
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/microsoft/go-mssqldb v1.1.0 h1:jsV+tpvcPTbNNKW0o3kiCD69kOHICsfjZ2VcVu2lKYc=
github.com/microsoft/go-mssqldb v1.1.0/go.mod h1:LzkFdl4z2Ck+Hi+ycGOTbL56VEfgoyA2DvYejrNGbRk=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
@@ -396,6 +402,7 @@
github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E=
github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ=
@@ -435,6 +442,8 @@
github.com/shirou/gopsutil/v3 v3.22.5/go.mod h1:so9G9VzeHt/hsd0YwqprnjHnfARAUktauykSbr+y2gA=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/songzhibin97/gkit v1.2.11 h1:O8+l6eLMrZ2yNbT6Vohc6ggWnH5zt4P8/3ZEkf8jUL4=
@@ -580,6 +589,7 @@
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
@@ -925,6 +935,7 @@
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
model/request/serviceCollectionPlan.go
@@ -5,7 +5,7 @@
)
type AddServiceCollectionPlan struct {
    List []*model.ServiceCollectionPlan
    List []*model.ServiceCollectionPlan `json:"list" binding:"required"`
}
type UpdateServiceCollectionPlan struct {
model/serviceCollectionPlan.go
@@ -5,27 +5,30 @@
    "aps_crm/pkg/mysqlx"
    "errors"
    "fmt"
    "github.com/shopspring/decimal"
    "gorm.io/gorm"
    "time"
)
type (
    // ServiceCollectionPlan 服务合同收款计划
    // ServiceCollectionPlan 收款计划
    ServiceCollectionPlan struct {
        Id                int     `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        CollectionType    int     `gorm:"collection_type" json:"collectionType"`        // 类型(1 计划收款日期 2 项目状态)
        ServiceContractId int     `gorm:"service_contract_id" json:"serviceContractId"` // 服务合同id
        PrincipalId       int     `gorm:"principal_id" json:"principalId"`              // 收款负责人ID
        Term              int     `gorm:"term" json:"term"`                             // 期次
        Percent           float64 `gorm:"percent" json:"percent"`                       // 比例
        Amount            float64 `gorm:"amount" json:"amount"`                         // 金额
        MoneyType         string  `gorm:"money_type" json:"moneyType"`                  // 币种
        CollectionDate    string  `gorm:"collection_date" json:"collectionDate"`        // 计划收款日期
        Remark            string  `gorm:"remark" json:"remark"`                         // 备注
        Status            int     `gorm:"status" json:"status"`                         // 状态(1未收2已收)
        FileId            int     `gorm:"file_id" json:"fileId"`                        // 附件id
        Id             int                       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        CollectionType int                       `gorm:"collection_type" json:"collectionType"` // 类型(1 计划收款日期 2 项目状态)
        SourceType     int                       `gorm:"source_type" json:"sourceType"`         // 源单类型(1销售明细2服务合同3销售发票)
        SourceId       int                       `gorm:"source_id" json:"sourceId"`             // 源单id
        PrincipalId    int                       `gorm:"principal_id" json:"principalId"`       // 收款负责人ID
        Term           int                       `gorm:"term" json:"term"`                      // 期次
        Percent        decimal.Decimal           `gorm:"percent" json:"percent"`                // 比例
        Amount         decimal.Decimal           `gorm:"amount" json:"amount"`                  // 金额
        MoneyType      string                    `gorm:"money_type" json:"moneyType"`           // 币种
        CollectionDate time.Time                 `gorm:"collection_date" json:"collectionDate"` // 计划收款日期
        Remark         string                    `gorm:"remark" json:"remark"`                  // 备注
        Status         constvar.CollectionStatus `gorm:"status" json:"status"`                  // 状态(1未收2已收)
        FileId         int                       `gorm:"file_id" json:"fileId"`                 // 附件id
    }
    // ServiceCollectionPlanSearch 服务合同收款计划搜索条件
    // ServiceCollectionPlanSearch 收款计划搜索条件
    ServiceCollectionPlanSearch struct {
        ServiceCollectionPlan
        Orm         *gorm.DB
@@ -38,7 +41,7 @@
)
func (ServiceCollectionPlan) TableName() string {
    return "service_collection_plan"
    return "collection_plan"
}
func NewServiceCollectionPlanSearch() *ServiceCollectionPlanSearch {
@@ -53,8 +56,8 @@
        db = db.Where("id = ?", slf.Id)
    }
    if slf.ServiceContractId != 0 {
        db = db.Where("service_contract_id = ?", slf.ServiceContractId)
    if slf.SourceId != 0 {
        db = db.Where("source_id = ?", slf.SourceId)
    }
    return db
@@ -97,8 +100,8 @@
    return slf
}
func (slf *ServiceCollectionPlanSearch) SetServiceContractId(id int) *ServiceCollectionPlanSearch {
    slf.ServiceContractId = id
func (slf *ServiceCollectionPlanSearch) SetSourceId(id int) *ServiceCollectionPlanSearch {
    slf.SourceId = id
    return slf
}
service/serviceCollectionPlan.go
@@ -17,9 +17,9 @@
    if len(serviceCollectionPlan) == 0 {
        return ecode.ParamsErr
    }
    contractId := serviceCollectionPlan[0].ServiceContractId
    sourceId := serviceCollectionPlan[0].SourceId
    err := model.WithTransaction(func(db *gorm.DB) error {
        err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetServiceContractId(contractId).Delete()
        err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetSourceId(sourceId).Delete()
        if err != nil {
            return err
        }
@@ -45,8 +45,8 @@
    return ecode.OK
}
func (ServiceCollectionPlanService) GetServiceCollectionPlanList(contractId int) ([]*model.ServiceCollectionPlan, int64, int) {
    list, total, err := model.NewServiceCollectionPlanSearch().SetServiceContractId(contractId).Find()
func (ServiceCollectionPlanService) GetServiceCollectionPlanList(sourceId int) ([]*model.ServiceCollectionPlan, int64, int) {
    list, total, err := model.NewServiceCollectionPlanSearch().SetSourceId(sourceId).Find()
    if err != nil {
        return nil, 0, ecode.DBErr
    }