liujiandao
2023-10-24 6aa75c2a266a2522ae713b13dc702b5ad0a08f87
编码规则需求功能开发
49个文件已修改
1573 ■■■■■ 已修改文件
api/v1/client.go 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/code.go 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/contract.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/followRecord.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/masterOrder.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/quotation.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/saleChance.go 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesDetails.go 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesLeads.go 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesRefund.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesReturn.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceContract.go 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceFollowup.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceOrder.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/subOrder.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/const.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/client.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/contract.go 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/followRecord.go 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/masterOrder.go 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/quotation.go 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/client.go 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/contract.go 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/followRecord.go 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/masterOrder.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/quotation.go 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/saleChance.go 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesDetails.go 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesLeads.go 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesRefund.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesReturn.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceContract.go 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceFollowup.go 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/serviceOrder.go 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/subOrder.go 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/saleChance.go 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesDetails.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesLeads.go 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesRefund.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesReturn.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceContract.go 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceFollowup.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/serviceOrder.go 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/subOrder.go 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/util.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/index.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/client.go
@@ -41,25 +41,20 @@
        return
    }
    //CreatorId, b := c.Get("claims")
    //if !b {
    //    ctx.Fail(ecode.JWTParseErr)
    //    return
    //}
    //
    //client.CreatorId = CreatorId.(int)
    count, err := model.NewClientSearch(nil).SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    errCode = clientService.AddClient(client, params.SalesLeadsId)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(client.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewClientSearch(nil).SetId(client.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/code.go
@@ -2,6 +2,8 @@
import (
    "aps_crm/conf"
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/model/request"
    "aps_crm/model/response"
    "aps_crm/pkg/contextx"
@@ -71,3 +73,64 @@
        Count: list.Total,
    })
}
// GetAutoCode
//
// @Tags        编码
// @Summary    获取自动编码
// @Produce    application/json
// @Param        object    body        code.CodeStandard    true    "参数"
// @Success    200    {object}    response.ListResponse
//
//    @Router        /api/code/getAutoCode [post]
func (ca *CodeApi) GetAutoCode(c *gin.Context) {
    var params code.CodeStandard
    ctx, ok := contextx.NewContext(c, &params)
    if !ok {
        return
    }
    var (
        id  = 0
        err error
    )
    switch constvar.CodeStandardType(params.Type) {
    case constvar.CodeStandardTypeSaleKey:
        id, err = model.NewSaleChanceSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeSaleLead:
        id, err = model.NewSalesLeadsSearch(nil).MaxAutoIncr()
    case constvar.CodeStandardTypeCustom:
        id, err = model.NewClientSearch(nil).MaxAutoIncr()
    case constvar.CodeStandardTypeFollowRecord:
        id, err = model.NewFollowRecordSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeQuotation:
        id, err = model.NewQuotationSearch(nil).MaxAutoIncr()
    case constvar.CodeStandardTypeSaleTotalOrder:
        id, err = model.NewMasterOrderSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeSaleSuborder:
        id, err = model.NewSubOrderSearch(nil).MaxAutoIncr()
    case constvar.CodeStandardTypeSaleDetail:
        id, err = model.NewSalesDetailsSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeSaleReturnGoods:
        id, err = model.NewSalesReturnSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeSaleRefund:
        id, err = model.NewSalesRefundSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeContract:
        id, err = model.NewContractSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeServerContract:
        id, err = model.NewServiceContractSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeCustomServer:
        id, err = model.NewServiceOrderSearch().MaxAutoIncr()
    case constvar.CodeStandardTypeServerFollow:
        id, err = model.NewServiceFollowupSearch().MaxAutoIncr()
    default:
        ctx.FailWithMsg(ecode.UnknownErr, "编码规则不存在")
        return
    }
    if err != nil {
        logx.Errorf("GetAutoCode err: %v", err.Error())
        ctx.FailWithMsg(ecode.UnknownErr, "获取最大值失败")
        return
    }
    autoCode := model.GetAutoCode(id, &params)
    ctx.OkWithDetailed(autoCode)
}
api/v1/contract.go
@@ -35,6 +35,16 @@
        return
    }
    count, err := model.NewContractSearch().SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if contract.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -46,14 +56,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(contract.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewContractSearch().SetId(contract.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/followRecord.go
@@ -36,6 +36,16 @@
        return
    }
    count, err := model.NewFollowRecordSearch().SetNumber(followRecord.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if followRecord.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -47,13 +57,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.FollowRecord.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(followRecord.Id, &params.FollowRecord.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewFollowRecordSearch().SetId(followRecord.Id).UpdateMap(m)
    }
    ctx.Ok()
api/v1/masterOrder.go
@@ -34,6 +34,16 @@
        return
    }
    count, err := model.NewMasterOrderSearch().SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if masterOrder.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -45,14 +55,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(masterOrder.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewMasterOrderSearch().SetId(masterOrder.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/quotation.go
@@ -34,6 +34,16 @@
        return
    }
    count, err := model.NewQuotationSearch(nil).SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if quotation.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -45,14 +55,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(quotation.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewQuotationSearch(nil).SetId(quotation.Id).Updates(m)
    }
    ctx.Ok()
api/v1/saleChance.go
@@ -33,16 +33,15 @@
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method != 1 {
        count, err := model.NewSaleChanceSearch().SetNumber(saleChance.Number).Count()
        if err != nil {
            ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
            return
        }
        if count > 0 {
            ctx.FailWithMsg(ecode.UnknownErr, "销售机会编码已存在")
            return
        }
    count, err := model.NewSaleChanceSearch().SetNumber(saleChance.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "销售机会编码已存在")
        return
    }
    if saleChance.MemberId == 0 {
@@ -56,14 +55,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(saleChance.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSaleChanceSearch().SetId(saleChance.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/salesDetails.go
@@ -35,6 +35,16 @@
        return
    }
    count, err := model.NewSalesDetailsSearch().SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if salesDetails.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -46,14 +56,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(salesDetails.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSalesDetailsSearch().SetId(salesDetails.Id).UpdateByMap(m)
    }
    ctx.OkWithDetailed(salesDetails)
@@ -156,6 +158,7 @@
    salesDetailsModel.LogisticNumber = salesDetails.LogisticNumber
    salesDetailsModel.LogisticCost = salesDetails.LogisticCost
    salesDetailsModel.CodeStandID = salesDetails.CodeStandID
    salesDetailsModel.DeliverType = salesDetails.DeliverType
    return ecode.OK, salesDetailsModel
}
api/v1/salesLeads.go
@@ -40,18 +40,20 @@
        ctx.Fail(errCode)
        return
    }
    count, err := model.NewSalesLeadsSearch(nil).SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    errCode = salesLeadsService.AddSalesLeads(&salesLeads)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(salesLeads.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSalesLeadsSearch(nil).SetId(salesLeads.Id).UpdateMap(m)
    }
    ctx.Ok()
api/v1/salesRefund.go
@@ -36,6 +36,16 @@
        return
    }
    count, err := model.NewSalesRefundSearch().SetNumber(salesRefund.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if salesRefund.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -47,14 +57,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.SalesRefund.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(salesRefund.Id, &params.SalesRefund.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSalesRefundSearch().SetId(salesRefund.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/salesReturn.go
@@ -37,6 +37,16 @@
        return
    }
    count, err := model.NewSalesReturnSearch().SetNumber(salesReturn.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if salesReturn.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -48,14 +58,6 @@
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.SalesReturn.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(salesReturn.Id, &params.SalesReturn.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSalesReturnSearch().SetId(salesReturn.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/serviceContract.go
@@ -35,6 +35,16 @@
        return
    }
    count, err := model.NewServiceContractSearch().SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if params.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -48,40 +58,8 @@
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(serviceContract.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewServiceContractSearch().SetId(serviceContract.Id).UpdateByMap(m)
    }
    ctx.Ok()
}
//// Delete
////
////    @Tags        ServiceContract
////    @Summary    删除服务合同
////    @Produce    application/json
////    @Param        object    body        request.DeleteServiceContract true    "查询参数"
////    @Success    200    {object}    contextx.Response{}
////    @Router        /api/serviceContract/delete [delete]
//func (s *ServiceContractApi) Delete(c *gin.Context) {
//    var params request.DeleteServiceContract
//    ctx, ok := contextx.NewContext(c, &params)
//    if !ok {
//        return
//    }
//
//    errCode := serviceContractService.DeleteServiceContract(params.Ids)
//    if errCode != ecode.OK {
//        ctx.Fail(errCode)
//        return
//    }
//
//    ctx.Ok()
//}
// BatchDelete
// @Tags    ServiceContract
api/v1/serviceFollowup.go
@@ -40,17 +40,20 @@
        return
    }
    count, err := model.NewServiceFollowupSearch().SetNumber(serviceFollowup.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    errCode = serviceFollowupService.AddServiceFollowup(&serviceFollowup)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(serviceFollowup.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/serviceOrder.go
@@ -42,17 +42,20 @@
        return
    }
    count, err := model.NewServiceOrderSearch().SetNumber(serviceOrder.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    errCode := service.NewServiceOrderService().AddServiceOrder(serviceOrder)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(serviceOrder.Id, &params.CodeRule)
        m := map[string]interface{}{
            "service_number": autoCode,
        }
        _ = model.NewServiceOrderSearch().SetId(serviceOrder.Id).UpdateByMap(m)
    }
    ctx.Ok()
api/v1/subOrder.go
@@ -34,6 +34,16 @@
        return
    }
    count, err := model.NewSubOrderSearch(nil).SetNumber(params.Number).Count()
    if err != nil {
        ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
        return
    }
    if count > 0 {
        ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
        return
    }
    if subOrder.MemberId == 0 {
        userInfo := utils.GetUserInfo(c)
        if userInfo.UserType == constvar.UserTypeSub {
@@ -47,13 +57,6 @@
        return
    }
    if params.CodeRule.Method == 1 {
        autoCode := model.GetAutoCode(subOrder.Id, &params.CodeRule)
        m := map[string]interface{}{
            "number": autoCode,
        }
        _ = model.NewSubOrderSearch(nil).SetId(subOrder.Id).UpdateByMap(m)
    }
    ctx.Ok()
}
constvar/const.go
@@ -137,24 +137,26 @@
type CodeStandardType string
const (
    CodeStandardTypeSaleLead       CodeStandardType = "销售线索编码"
    CodeStandardTypeCustom         CodeStandardType = "客户编码"
    CodeStandardTypeContact        CodeStandardType = "联系人编码"
    CodeStandardTypeFollowRecord   CodeStandardType = "跟进记录编码"
    CodeStandardTypeSaleKey        CodeStandardType = "销售机会编码"
    CodeStandardTypeQuotation      CodeStandardType = "报价编码"
    CodeStandardTypeSaleTotalOrder CodeStandardType = "销售总单编码"
    CodeStandardTypeSaleSuborder   CodeStandardType = "销售子单编码"
    CodeStandardTypeSaleRefund     CodeStandardType = "销售退款编码"
    CodeStandardTypeContract       CodeStandardType = "合同编码"
    CodeStandardTypeServerContract CodeStandardType = "服务合同编码"
    CodeStandardTypeServerFollow   CodeStandardType = "服务回访编码"
    CodeStandardTypeSaleLead        CodeStandardType = "销售线索编码"
    CodeStandardTypeCustom          CodeStandardType = "客户编码"
    CodeStandardTypeFollowRecord    CodeStandardType = "跟进记录编码"
    CodeStandardTypeSaleKey         CodeStandardType = "销售机会编码"
    CodeStandardTypeQuotation       CodeStandardType = "报价编码"
    CodeStandardTypeSaleTotalOrder  CodeStandardType = "销售总单编码"
    CodeStandardTypeSaleSuborder    CodeStandardType = "销售子单编码"
    CodeStandardTypeSaleRefund      CodeStandardType = "销售退款编码"
    CodeStandardTypeContract        CodeStandardType = "合同编码"
    CodeStandardTypeServerContract  CodeStandardType = "服务合同编码"
    CodeStandardTypeServerFollow    CodeStandardType = "服务回访编码"
    CodeStandardTypeCustomServer    CodeStandardType = "客户服务编码"
    CodeStandardTypeSaleInvoice     CodeStandardType = "销售发票编码"
    CodeStandardTypeSaleDetail      CodeStandardType = "销售明细编码"
    CodeStandardTypeSaleReturnGoods CodeStandardType = "销售退货编码"
)
func (t CodeStandardType) Valid() bool {
    if t != CodeStandardTypeSaleLead &&
        t != CodeStandardTypeCustom &&
        t != CodeStandardTypeContact &&
        t != CodeStandardTypeFollowRecord &&
        t != CodeStandardTypeSaleKey &&
        t != CodeStandardTypeQuotation &&
@@ -163,6 +165,10 @@
        t != CodeStandardTypeSaleRefund &&
        t != CodeStandardTypeContract &&
        t != CodeStandardTypeServerContract &&
        t != CodeStandardTypeCustomServer &&
        t != CodeStandardTypeSaleInvoice &&
        t != CodeStandardTypeSaleDetail &&
        t != CodeStandardTypeSaleReturnGoods &&
        t != CodeStandardTypeServerFollow {
        return false
    }
docs/docs.go
@@ -1199,6 +1199,36 @@
                }
            }
        },
        "/api/code/getAutoCode": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "编码"
                ],
                "summary": "获取自动编码",
                "parameters": [
                    {
                        "description": "参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/code.CodeStandard"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/code/getCodeList": {
            "get": {
                "produces": [
@@ -12048,8 +12078,16 @@
                "solutions": {
                    "type": "string"
                },
                "status": {
                    "description": "状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.Status"
                        }
                    ]
                },
                "status_id": {
                    "$ref": "#/definitions/model.Status"
                    "type": "integer"
                },
                "threats": {
                    "type": "string"
@@ -12133,6 +12171,9 @@
                },
                "creatorName": {
                    "type": "string"
                },
                "deliverType": {
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -13296,9 +13337,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -13502,9 +13540,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -13773,9 +13808,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -13895,9 +13927,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14133,9 +14162,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14266,15 +14292,16 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
                },
                "conditions": {
                    "type": "string"
                },
                "deliverType": {
                    "description": "交付类型:1.一次发货,2.多次发货",
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -14325,9 +14352,6 @@
            "properties": {
                "city_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14452,9 +14476,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14563,9 +14584,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14660,9 +14678,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14727,9 +14742,6 @@
                "clientId": {
                    "description": "客户id",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14885,9 +14897,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -15265,9 +15274,6 @@
                },
                "client_status_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "type": "string"
@@ -15846,15 +15852,16 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
                },
                "conditions": {
                    "type": "string"
                },
                "deliverType": {
                    "description": "交付类型:1.一次发货,2.多次发货",
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -15914,9 +15921,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -15965,9 +15969,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16167,9 +16168,6 @@
                "client_type_id": {
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16459,9 +16457,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16865,9 +16860,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17048,9 +17040,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -17413,9 +17402,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17589,9 +17575,6 @@
            "properties": {
                "city_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -17846,9 +17829,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17978,9 +17958,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -18076,9 +18053,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -18146,9 +18120,6 @@
                "clientId": {
                    "description": "客户id",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -18343,9 +18314,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
docs/swagger.json
@@ -1187,6 +1187,36 @@
                }
            }
        },
        "/api/code/getAutoCode": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "编码"
                ],
                "summary": "获取自动编码",
                "parameters": [
                    {
                        "description": "参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/code.CodeStandard"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/code/getCodeList": {
            "get": {
                "produces": [
@@ -12036,8 +12066,16 @@
                "solutions": {
                    "type": "string"
                },
                "status": {
                    "description": "状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.Status"
                        }
                    ]
                },
                "status_id": {
                    "$ref": "#/definitions/model.Status"
                    "type": "integer"
                },
                "threats": {
                    "type": "string"
@@ -12121,6 +12159,9 @@
                },
                "creatorName": {
                    "type": "string"
                },
                "deliverType": {
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -13284,9 +13325,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -13490,9 +13528,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -13761,9 +13796,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -13883,9 +13915,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14121,9 +14150,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14254,15 +14280,16 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
                },
                "conditions": {
                    "type": "string"
                },
                "deliverType": {
                    "description": "交付类型:1.一次发货,2.多次发货",
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -14313,9 +14340,6 @@
            "properties": {
                "city_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14440,9 +14464,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14551,9 +14572,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14648,9 +14666,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -14715,9 +14730,6 @@
                "clientId": {
                    "description": "客户id",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -14873,9 +14885,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -15253,9 +15262,6 @@
                },
                "client_status_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "type": "string"
@@ -15834,15 +15840,16 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
                },
                "conditions": {
                    "type": "string"
                },
                "deliverType": {
                    "description": "交付类型:1.一次发货,2.多次发货",
                    "type": "integer"
                },
                "deliveryDate": {
                    "type": "string"
@@ -15902,9 +15909,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -15953,9 +15957,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16155,9 +16156,6 @@
                "client_type_id": {
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16447,9 +16445,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -16853,9 +16848,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17036,9 +17028,6 @@
            "properties": {
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -17401,9 +17390,6 @@
                "client_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17577,9 +17563,6 @@
            "properties": {
                "city_id": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -17834,9 +17817,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -17966,9 +17946,6 @@
                    "description": "客户类型ID",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -18064,9 +18041,6 @@
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
                    "type": "string"
@@ -18134,9 +18108,6 @@
                "clientId": {
                    "description": "客户id",
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
@@ -18331,9 +18302,6 @@
            "properties": {
                "clientId": {
                    "type": "integer"
                },
                "codeRule": {
                    "$ref": "#/definitions/code.CodeStandard"
                },
                "codeStandID": {
                    "description": "编码id",
docs/swagger.yaml
@@ -1373,8 +1373,12 @@
        type: integer
      solutions:
        type: string
      status:
        allOf:
        - $ref: '#/definitions/model.Status'
        description: 状态
      status_id:
        $ref: '#/definitions/model.Status'
        type: integer
      threats:
        type: string
      whether_established:
@@ -1431,6 +1435,8 @@
        type: integer
      creatorName:
        type: string
      deliverType:
        type: integer
      deliveryDate:
        type: string
      id:
@@ -2212,8 +2218,6 @@
      client_type_id:
        description: 客户类型ID
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2360,8 +2364,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2538,8 +2540,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2618,8 +2618,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2773,8 +2771,6 @@
        type: integer
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2861,13 +2857,14 @@
        type: string
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
      conditions:
        type: string
      deliverType:
        description: 交付类型:1.一次发货,2.多次发货
        type: integer
      deliveryDate:
        type: string
      logisticCompany:
@@ -2901,8 +2898,6 @@
    properties:
      city_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -2984,8 +2979,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -3061,8 +3054,6 @@
      client_type_id:
        description: 客户类型ID
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -3131,8 +3122,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -3178,8 +3167,6 @@
      clientId:
        description: 客户id
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -3289,8 +3276,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -3546,8 +3531,6 @@
        type: integer
      client_status_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        type: string
      contact_id:
@@ -3966,13 +3949,14 @@
        type: string
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
      conditions:
        type: string
      deliverType:
        description: 交付类型:1.一次发货,2.多次发货
        type: integer
      deliveryDate:
        type: string
      logisticCompany:
@@ -4009,8 +3993,6 @@
        type: integer
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -4046,8 +4028,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -4183,8 +4163,6 @@
      client_type_id:
        description: 客户类型ID
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -4387,8 +4365,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -4657,8 +4633,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -4778,8 +4752,6 @@
    properties:
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5016,8 +4988,6 @@
        type: integer
      client_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5135,8 +5105,6 @@
    properties:
      city_id:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5305,8 +5273,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5396,8 +5362,6 @@
      client_type_id:
        description: 客户类型ID
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5466,8 +5430,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5515,8 +5477,6 @@
      clientId:
        description: 客户id
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -5652,8 +5612,6 @@
    properties:
      clientId:
        type: integer
      codeRule:
        $ref: '#/definitions/code.CodeStandard'
      codeStandID:
        description: 编码id
        type: string
@@ -7025,6 +6983,25 @@
      summary: 更新客户类型
      tags:
      - ClientType
  /api/code/getAutoCode:
    post:
      parameters:
      - description: 参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/code.CodeStandard'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.ListResponse'
      summary: 获取自动编码
      tags:
      - 编码
  /api/code/getCodeList:
    get:
      parameters:
model/client.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/constvar"
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
    "time"
)
@@ -196,6 +197,30 @@
    return db.Updates(data).Error
}
func (slf *ClientSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *ClientSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *ClientSearch) SetPage(page, size int) *ClientSearch {
    slf.PageNum, slf.PageSize = page, size
    return slf
model/contract.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -50,6 +51,9 @@
    if slf.Id != 0 {
        db = db.Where("id = ?", slf.Id)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -123,6 +127,30 @@
    return records, total, err
}
func (slf *ContractSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *ContractSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *ContractSearch) SetId(id int) *ContractSearch {
    slf.Id = id
    return slf
@@ -146,6 +174,12 @@
    slf.Orm = slf.Orm.Where("id in (?)", ids)
    return slf
}
func (slf *ContractSearch) SetNumber(number string) *ContractSearch {
    slf.Number = number
    return slf
}
func (slf *ContractSearch) UpdateByMap(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
model/followRecord.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -61,6 +62,9 @@
    }
    if slf.ClientId != 0 {
        db = db.Where("client_id = ?", slf.ClientId)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -130,12 +134,6 @@
    return records, total, err
}
func (slf *FollowRecordSearch) Count() (int64, error) {
    var count int64
    err := slf.build().Count(&count).Error
    return count, err
}
func (slf *FollowRecordSearch) Page(page, pageSize int) ([]*FollowRecord, int64, error) {
    var records = make([]*FollowRecord, 0)
    var count int64
@@ -160,6 +158,30 @@
func (slf *FollowRecordSearch) Delete() error {
    var db = slf.build()
    return db.Delete(&slf.FollowRecord).Error
}
func (slf *FollowRecordSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *FollowRecordSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *FollowRecordSearch) SetId(id int) *FollowRecordSearch {
@@ -199,3 +221,8 @@
    slf.Orm = tx
    return slf
}
func (slf *FollowRecordSearch) SetNumber(number string) *FollowRecordSearch {
    slf.Number = number
    return slf
}
model/masterOrder.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -47,6 +48,9 @@
    var db = slf.Orm.Model(&MasterOrder{})
    if slf.Id != 0 {
        db = db.Where("id = ?", slf.Id)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -112,6 +116,30 @@
    return records, total, err
}
func (slf *MasterOrderSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *MasterOrderSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *MasterOrderSearch) SetId(id int) *MasterOrderSearch {
    slf.Id = id
    return slf
@@ -136,6 +164,11 @@
    return slf
}
func (slf *MasterOrderSearch) SetNumber(number string) *MasterOrderSearch {
    slf.Number = number
    return slf
}
func (slf *MasterOrderSearch) UpdateByMap(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
model/quotation.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -58,6 +59,9 @@
    var db = slf.Orm.Model(&Quotation{})
    if slf.Id != 0 {
        db = db.Where("id = ?", slf.Id)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -128,6 +132,30 @@
    return records, total, err
}
func (slf *QuotationSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *QuotationSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *QuotationSearch) SetId(id int) *QuotationSearch {
    slf.Id = id
    return slf
@@ -152,6 +180,11 @@
    slf.SearchMap = searchMap
    return slf
}
func (slf *QuotationSearch) SetNumber(number string) *QuotationSearch {
    slf.Number = number
    return slf
}
func (slf *QuotationSearch) SetIds(ids []int) *QuotationSearch {
    slf.Orm = slf.Orm.Where("id in (?)", ids)
    return slf
model/request/client.go
@@ -1,29 +1,26 @@
package request
import "aps_crm/proto/code"
type AddClient struct {
    Client
}
type Client struct {
    Name              string            `json:"name"`                // 公司名称
    Number            string            `json:"number"`              // 公司编号
    ClientStatusId    int               `json:"client_status_id"`    // 客户状态ID
    ClientTypeId      int               `json:"client_type_id"`      // 客户类型ID
    ClientOriginId    int               `json:"client_origin_id"`    // 客户来源ID
    ClientLevelId     int               `json:"client_level_id"`     // 客户等级ID
    MemberId          int               `json:"member_id"`           // 销售负责人ID
    ServiceMemberId   int               `json:"service_member_id"`   // 服务负责人ID
    DetailAddress     string            `json:"detail_address"`      // 详细地址
    Remark            string            `json:"remark"`              // 备注
    NextVisitTime     string            `json:"next_visit_time"`     // 下次回访时间
    LatestServiceTime string            `json:"latest_service_time"` // 最晚服务时间
    Contact           Contact           `json:"contact"`
    SalesLeadsId      int               `json:"sales_leads_id"` // 销售线索ID
    ContactId         int               `json:"contact_id"`     // 联系人ID
    CodeStandID       string            `json:"codeStandID"`    //编码id
    CodeRule          code.CodeStandard `json:"codeRule"`
    Name              string  `json:"name"`                // 公司名称
    Number            string  `json:"number"`              // 公司编号
    ClientStatusId    int     `json:"client_status_id"`    // 客户状态ID
    ClientTypeId      int     `json:"client_type_id"`      // 客户类型ID
    ClientOriginId    int     `json:"client_origin_id"`    // 客户来源ID
    ClientLevelId     int     `json:"client_level_id"`     // 客户等级ID
    MemberId          int     `json:"member_id"`           // 销售负责人ID
    ServiceMemberId   int     `json:"service_member_id"`   // 服务负责人ID
    DetailAddress     string  `json:"detail_address"`      // 详细地址
    Remark            string  `json:"remark"`              // 备注
    NextVisitTime     string  `json:"next_visit_time"`     // 下次回访时间
    LatestServiceTime string  `json:"latest_service_time"` // 最晚服务时间
    Contact           Contact `json:"contact"`
    SalesLeadsId      int     `json:"sales_leads_id"` // 销售线索ID
    ContactId         int     `json:"contact_id"`     // 联系人ID
    CodeStandID       string  `json:"codeStandID"`    //编码id
    Address
    Business
}
model/request/contract.go
@@ -1,21 +1,18 @@
package request
import "aps_crm/proto/code"
type AddContract struct {
    Contract
}
type Contract struct {
    ContractName string            `json:"contractName"` //合同名称
    ClientId     int               `json:"client_id"`
    MemberId     int               `json:"member_id"`
    Number       string            `json:"number"`
    QuotationId  int               `json:"quotation_id"`
    StatusId     int               `json:"status_id"`
    File         string            `json:"file"`
    CodeStandID  string            `json:"codeStandID"` //编码id
    CodeRule     code.CodeStandard `json:"codeRule"`
    ContractName string `json:"contractName"` //合同名称
    ClientId     int    `json:"client_id"`
    MemberId     int    `json:"member_id"`
    Number       string `json:"number"`
    QuotationId  int    `json:"quotation_id"`
    StatusId     int    `json:"status_id"`
    File         string `json:"file"`
    CodeStandID  string `json:"codeStandID"` //编码id
}
type UpdateContract struct {
model/request/followRecord.go
@@ -1,28 +1,25 @@
package request
import "aps_crm/proto/code"
type AddFollowRecord struct {
    FollowRecord FollowRecord `json:"follow_record" binding:"required"`
}
type FollowRecord struct {
    ClientId             int               `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户id"`
    ClientStatusId       int               `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:客户状态id"`
    MemberId             int               `json:"member_id" gorm:"column:member_id;type:int(11);comment:跟进人id"`
    Number               string            `json:"number" gorm:"column:number;type:varchar(255);comment:跟进编号"`
    ContactId            int               `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人id"`
    Topic                string            `json:"topic" gorm:"column:topic;type:varchar(255);comment:跟进主题"`
    Record               string            `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:跟进记录"`
    SaleChanceId         int               `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"`
    SalesLeadsId         int               `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:销售线索id"`
    ContactInformationId int               `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:联系方式id"`
    FollowTime           string            `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"`
    NextFollowTime       string            `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"`
    Purpose              string            `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:跟进目的"`
    Content              string            `json:"content" gorm:"column:content;type:varchar(255);comment:跟进内容"`
    CodeStandID          string            `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"`
    CodeRule             code.CodeStandard `json:"codeRule"`
    ClientId             int    `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户id"`
    ClientStatusId       int    `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:客户状态id"`
    MemberId             int    `json:"member_id" gorm:"column:member_id;type:int(11);comment:跟进人id"`
    Number               string `json:"number" gorm:"column:number;type:varchar(255);comment:跟进编号"`
    ContactId            int    `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:联系人id"`
    Topic                string `json:"topic" gorm:"column:topic;type:varchar(255);comment:跟进主题"`
    Record               string `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:跟进记录"`
    SaleChanceId         int    `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"`
    SalesLeadsId         int    `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:销售线索id"`
    ContactInformationId int    `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:联系方式id"`
    FollowTime           string `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"`
    NextFollowTime       string `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"`
    Purpose              string `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:跟进目的"`
    Content              string `json:"content" gorm:"column:content;type:varchar(255);comment:跟进内容"`
    CodeStandID          string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"`
}
type UpdateFollowRecord struct {
model/request/masterOrder.go
@@ -1,20 +1,17 @@
package request
import "aps_crm/proto/code"
type AddMasterOrder struct {
    MasterOrder
}
type MasterOrder struct {
    Number      string            `json:"number"`
    ClientId    int               `json:"client_id"`
    MemberId    int               `json:"member_id"`
    StartTime   string            `json:"start_time"`
    EndTime     string            `json:"end_time"`
    Money       float64           `json:"money"`
    CodeStandID string            `json:"codeStandID"` //编码id
    CodeRule    code.CodeStandard `json:"codeRule"`
    Number      string  `json:"number"`
    ClientId    int     `json:"client_id"`
    MemberId    int     `json:"member_id"`
    StartTime   string  `json:"start_time"`
    EndTime     string  `json:"end_time"`
    Money       float64 `json:"money"`
    CodeStandID string  `json:"codeStandID"` //编码id
}
type UpdateMasterOrder struct {
model/request/quotation.go
@@ -2,7 +2,6 @@
import (
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddQuotation struct {
@@ -10,19 +9,18 @@
}
type Quotation struct {
    QuotationName     string            `json:"quotationName"` //报价单名称
    ClientId          int               `json:"client_id"`
    Number            string            `json:"number"`
    QuotationStatusId int               `json:"quotation_status_id"`
    ValidityDate      string            `json:"validity_date"`
    ContactId         int               `json:"contact_id"`
    MemberId          int               `json:"member_id"`
    SaleChanceId      int               `json:"sale_chance_id"`
    Conditions        string            `json:"conditions"`
    File              string            `json:"file"`
    CodeStandID       string            `json:"codeStandID"` //编码id
    CodeRule          code.CodeStandard `json:"codeRule"`
    Products          []model.Product   `json:"products"`
    QuotationName     string          `json:"quotationName"` //报价单名称
    ClientId          int             `json:"client_id"`
    Number            string          `json:"number"`
    QuotationStatusId int             `json:"quotation_status_id"`
    ValidityDate      string          `json:"validity_date"`
    ContactId         int             `json:"contact_id"`
    MemberId          int             `json:"member_id"`
    SaleChanceId      int             `json:"sale_chance_id"`
    Conditions        string          `json:"conditions"`
    File              string          `json:"file"`
    CodeStandID       string          `json:"codeStandID"` //编码id
    Products          []model.Product `json:"products"`
}
type UpdateQuotation struct {
model/request/saleChance.go
@@ -2,7 +2,6 @@
import (
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddSaleChance struct {
@@ -10,38 +9,37 @@
}
type SaleChance struct {
    Name               string            `json:"name"`
    ClientId           int               `json:"client_id"`
    Number             string            `json:"number"`
    ContactId          int               `json:"contact_id"`
    SalesSourcesId     int               `json:"sales_sources_id"`
    SaleTypeId         int               `json:"sale_type_id"`
    SaleStageId        int               `json:"sale_stage_id"`
    MemberId           int               `json:"member_id"`
    RegularCustomersId int               `json:"regular_customers_id"`
    Competitors        string            `json:"competitors"`
    Possibilities      int               `json:"possibilities"`
    Budget             float64           `json:"budget"`
    ProjectedAmount    float64           `json:"projected_amount"`
    Currency           int               `json:"currency"`
    ExpectedTime       string            `json:"expected_time"`
    StatusId           int               `json:"status_id"`
    PainPoints         string            `json:"pain_points"`
    WhetherEstablished string            `json:"whether_established"`
    CapitalBudget      string            `json:"capital_budget"`
    KeyMaker           string            `json:"key_maker"`
    KeyFactors         string            `json:"key_factors"`
    Process            string            `json:"process"`
    Solutions          string            `json:"solutions"`
    Advantages         string            `json:"advantages"`
    Disadvantages      string            `json:"disadvantages"`
    Opportunities      string            `json:"opportunities"`
    Threats            string            `json:"threats"`
    Remark             string            `json:"remark"`
    DetailAddress      string            `json:"detail_address"`
    CodeStandID        string            `json:"codeStandID"` //编码id
    CodeRule           code.CodeStandard `json:"codeRule"`
    Products           []*model.Product  `json:"products" gorm:"many2many:SaleChance_Product;"`
    Name               string           `json:"name"`
    ClientId           int              `json:"client_id"`
    Number             string           `json:"number"`
    ContactId          int              `json:"contact_id"`
    SalesSourcesId     int              `json:"sales_sources_id"`
    SaleTypeId         int              `json:"sale_type_id"`
    SaleStageId        int              `json:"sale_stage_id"`
    MemberId           int              `json:"member_id"`
    RegularCustomersId int              `json:"regular_customers_id"`
    Competitors        string           `json:"competitors"`
    Possibilities      int              `json:"possibilities"`
    Budget             float64          `json:"budget"`
    ProjectedAmount    float64          `json:"projected_amount"`
    Currency           int              `json:"currency"`
    ExpectedTime       string           `json:"expected_time"`
    StatusId           int              `json:"status_id"`
    PainPoints         string           `json:"pain_points"`
    WhetherEstablished string           `json:"whether_established"`
    CapitalBudget      string           `json:"capital_budget"`
    KeyMaker           string           `json:"key_maker"`
    KeyFactors         string           `json:"key_factors"`
    Process            string           `json:"process"`
    Solutions          string           `json:"solutions"`
    Advantages         string           `json:"advantages"`
    Disadvantages      string           `json:"disadvantages"`
    Opportunities      string           `json:"opportunities"`
    Threats            string           `json:"threats"`
    Remark             string           `json:"remark"`
    DetailAddress      string           `json:"detail_address"`
    CodeStandID        string           `json:"codeStandID"` //编码id
    Products           []*model.Product `json:"products" gorm:"many2many:SaleChance_Product;"`
    Address
}
model/request/salesDetails.go
@@ -3,7 +3,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddSalesDetails struct {
@@ -11,25 +10,25 @@
}
type SalesDetails struct {
    ClientId            int               `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
    Number              string            `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"`
    SaleChanceId        int               `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"`
    SaleType            int               `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"`
    SignTime            string            `json:"signTime" gorm:"column:sign_time;type:datetime;comment:签单时间"`
    MemberId            int               `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
    DeliveryDate        string            `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:交货日期"`
    WechatOrderStatusId int               `json:"wechatOrderStatusId" gorm:"column:wechat_order_status_id;type:int;comment:微信订单状态id"`
    Address             string            `json:"address" gorm:"column:address;type:varchar(255);comment:地址"`
    Phone               string            `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"`
    Addressee           string            `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"`
    Conditions          string            `json:"conditions" gorm:"column:conditions;type:text;comment:条件"`
    Remark              string            `json:"remark" gorm:"column:remark;type:text;comment:备注"`
    Products            []*model.Product  `json:"products" gorm:"many2many:sales_details_product;"`
    LogisticCompany     string            `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"`
    LogisticNumber      string            `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"`
    LogisticCost        float64           `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"`
    CodeStandID         string            `json:"codeStandID"` //编码id
    CodeRule            code.CodeStandard `json:"codeRule"`
    ClientId            int              `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
    Number              string           `json:"number" gorm:"column:number;type:varchar(255);comment:销售子单号"`
    SaleChanceId        int              `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:销售机会id"`
    SaleType            int              `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"`
    SignTime            string           `json:"signTime" gorm:"column:sign_time;type:datetime;comment:签单时间"`
    MemberId            int              `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
    DeliveryDate        string           `json:"deliveryDate" gorm:"column:delivery_date;type:datetime;comment:交货日期"`
    WechatOrderStatusId int              `json:"wechatOrderStatusId" gorm:"column:wechat_order_status_id;type:int;comment:微信订单状态id"`
    Address             string           `json:"address" gorm:"column:address;type:varchar(255);comment:地址"`
    Phone               string           `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"`
    Addressee           string           `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"`
    Conditions          string           `json:"conditions" gorm:"column:conditions;type:text;comment:条件"`
    Remark              string           `json:"remark" gorm:"column:remark;type:text;comment:备注"`
    Products            []*model.Product `json:"products" gorm:"many2many:sales_details_product;"`
    LogisticCompany     string           `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"`
    LogisticNumber      string           `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"`
    LogisticCost        float64          `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"`
    CodeStandID         string           `json:"codeStandID"` //编码id
    DeliverType         int              `json:"deliverType"` //交付类型:1.一次发货,2.多次发货
}
type UpdateSalesDetails struct {
model/request/salesLeads.go
@@ -2,7 +2,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/proto/code"
)
type AddSalesLeads struct {
@@ -10,17 +9,16 @@
}
type SalesLeads struct {
    Name            string            `json:"name"`             // 公司名称
    Number          string            `json:"number"`           // 销售线索编号
    ContactName     string            `json:"contact_name"`     // 联系人姓名
    ContactPhone    string            `json:"contact_phone"`    // 联系人电话
    ContactPosition string            `json:"contact_position"` // 联系人职位
    SalesSourcesId  int               `json:"sales_sources_id"` // 商机来源ID
    MemberId        int               `json:"member_id"`        // 销售负责人ID
    Desc            string            `json:"desc"`             // 备注
    DetailAddress   string            `json:"detail_address"`   // 详细地址
    CodeStandID     string            `json:"codeStandID"`      //编码id
    CodeRule        code.CodeStandard `json:"codeRule"`
    Name            string `json:"name"`             // 公司名称
    Number          string `json:"number"`           // 销售线索编号
    ContactName     string `json:"contact_name"`     // 联系人姓名
    ContactPhone    string `json:"contact_phone"`    // 联系人电话
    ContactPosition string `json:"contact_position"` // 联系人职位
    SalesSourcesId  int    `json:"sales_sources_id"` // 商机来源ID
    MemberId        int    `json:"member_id"`        // 销售负责人ID
    Desc            string `json:"desc"`             // 备注
    DetailAddress   string `json:"detail_address"`   // 详细地址
    CodeStandID     string `json:"codeStandID"`      //编码id
    Address
}
model/request/salesRefund.go
@@ -3,7 +3,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddSalesRefundRequest struct {
@@ -23,7 +22,6 @@
    Reason        string                    `json:"reason"`
    Products      []*model.Product          `json:"products"`
    CodeStandID   string                    `json:"codeStandID"` //编码id
    CodeRule      code.CodeStandard         `json:"codeRule"`
}
type UpdateSalesRefundRequest struct {
model/request/salesReturn.go
@@ -3,7 +3,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddSalesReturnRequest struct {
@@ -24,7 +23,6 @@
    Reason              string                         `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"`                     //退货原因
    Products            []*model.Product               `json:"products" gorm:"many2many:salesReturn_product;"`                                 //退货产品
    CodeStandID         string                         `json:"codeStandID"`                                                                    //编码id
    CodeRule            code.CodeStandard              `json:"codeRule"`
}
type UpdateSalesReturnRequest struct {
model/request/serviceContract.go
@@ -3,7 +3,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddServiceContract struct {
@@ -11,26 +10,25 @@
}
type ServiceContract struct {
    ClientId                int               `json:"clientId"`
    Number                  string            `json:"number"`
    MemberId                int               `json:"memberId" binding:"required"`
    ContactId               int               `json:"contactId"`
    SaleChanceId            int               `json:"saleChanceId"`
    SalesDetailsId          int               `json:"salesDetailsId"`
    QuotationId             int               `json:"quotationId"`
    TypeId                  int               `json:"typeId"`
    SignTime                string            `json:"signTime" binding:"datetime=2006-01-02"`
    StartTime               string            `json:"startTime"`
    EndTime                 string            `json:"endTime"`
    StatusId                int               `json:"statusId"`
    ServiceTimes            int               `json:"serviceTimes"`
    Terms                   string            `json:"terms"`
    Remark                  string            `json:"remark"`
    Products                []*model.Product  `json:"products"`
    ServiceContractTypeId   int               `json:"serviceContractTypeId"`
    ServiceContractStatusId int               `json:"serviceContractStatusId"`
    CodeStandID             string            `json:"codeStandID"` //编码id
    CodeRule                code.CodeStandard `json:"codeRule"`
    ClientId                int              `json:"clientId"`
    Number                  string           `json:"number"`
    MemberId                int              `json:"memberId" binding:"required"`
    ContactId               int              `json:"contactId"`
    SaleChanceId            int              `json:"saleChanceId"`
    SalesDetailsId          int              `json:"salesDetailsId"`
    QuotationId             int              `json:"quotationId"`
    TypeId                  int              `json:"typeId"`
    SignTime                string           `json:"signTime" binding:"datetime=2006-01-02"`
    StartTime               string           `json:"startTime"`
    EndTime                 string           `json:"endTime"`
    StatusId                int              `json:"statusId"`
    ServiceTimes            int              `json:"serviceTimes"`
    Terms                   string           `json:"terms"`
    Remark                  string           `json:"remark"`
    Products                []*model.Product `json:"products"`
    ServiceContractTypeId   int              `json:"serviceContractTypeId"`
    ServiceContractStatusId int              `json:"serviceContractStatusId"`
    CodeStandID             string           `json:"codeStandID"` //编码id
}
type UpdateServiceContract struct {
model/request/serviceFollowup.go
@@ -2,7 +2,6 @@
import (
    "aps_crm/constvar"
    "aps_crm/proto/code"
)
type AddServiceFollowup struct {
@@ -10,21 +9,20 @@
}
type ServiceFollowup struct {
    ClientId       int               `json:"clientId"`
    Number         string            `json:"number"`
    ContactId      int               `json:"contactId"`
    ServiceOrderId int               `json:"serviceOrderId"`
    MemberId       int               `json:"memberId"`
    PlanId         int               `json:"planId"`
    Satisfaction   int               `json:"satisfaction"`
    TimelyRate     int               `json:"timelyRate"`
    SolveRate      int               `json:"solveRate"`
    IsVisit        int               `json:"isVisit"`
    OldMemberId    int               `json:"oldMemberId"`
    Remark         string            `json:"remark"`
    File           string            `json:"file"`
    CodeStandID    string            `json:"codeStandID"` //编码id
    CodeRule       code.CodeStandard `json:"codeRule"`
    ClientId       int    `json:"clientId"`
    Number         string `json:"number"`
    ContactId      int    `json:"contactId"`
    ServiceOrderId int    `json:"serviceOrderId"`
    MemberId       int    `json:"memberId"`
    PlanId         int    `json:"planId"`
    Satisfaction   int    `json:"satisfaction"`
    TimelyRate     int    `json:"timelyRate"`
    SolveRate      int    `json:"solveRate"`
    IsVisit        int    `json:"isVisit"`
    OldMemberId    int    `json:"oldMemberId"`
    Remark         string `json:"remark"`
    File           string `json:"file"`
    CodeStandID    string `json:"codeStandID"` //编码id
}
type UpdateServiceFollowup struct {
model/request/serviceOrder.go
@@ -2,39 +2,37 @@
import (
    "aps_crm/constvar"
    "aps_crm/proto/code"
)
type AddServiceOrder struct {
    ServiceNumber        string            `gorm:"service_number" json:"serviceNumber"`                                                                    // 服务单编号
    ClientId             int               `gorm:"client_id" json:"clientId"`                                                                              // 客户id
    ServiceContractId    int               `gorm:"service_contract_id" json:"serviceContractId"`                                                           // 合同id
    SalesDetailsId       int               `gorm:"sales_details_id" json:"salesDetailsId"`                                                                 // 销售订单id
    Subject              string            `gorm:"subject" json:"subject"`                                                                                 // 主题
    ProductTypeName      string            `json:"productTypeName"`                                                                                        // 产品分类名称
    ProductName          string            `json:"productName"`                                                                                            // 产品名称
    ServiceTypeId        int               `gorm:"service_type_id" json:"serviceTypeId"`                                                                   // 服务方式id
    ServiceManId         int               `gorm:"service_man_id" json:"serviceManId"`                                                                     // 服务人员
    ContactId            int               `gorm:"linkman_id" json:"contactId"`                                                                            // 联系人id
    Address              string            `gorm:"address" json:"address"`                                                                                 // 上门地址
    PriorityLevelId      int               `gorm:"priority_level_id" json:"priorityLevelId"`                                                               // 优先级别id
    AppointmentTime      string            `gorm:"appointment_time" json:"appointmentTime"`                                                                // 预约上门时间
    SaleChanceId         int               `gorm:"sale_leads" json:"saleChanceId"`                                                                         // 销售机会id
    FaultTypeId          int               `gorm:"severity_id" json:"faultTypeId"`                                                                         // 故障类别id
    SeverityId           int               `gorm:"severity_id" json:"severity"`                                                                            // 严重程度id
    ServiceOrderStatusId int               `gorm:"column:service_order_status_id;type:int;not null;default:0;comment:服务单状态id" json:"serviceOrderStatusId"` // 处理状态
    ExpectTime           string            `gorm:"expect_time" json:"expectTime"`                                                                          // 希望处理时间
    RealTime             string            `gorm:"real_time" json:"realTime"`                                                                              // 实际处理时间
    CarFare              float64           `gorm:"car_fare" json:"carFare"`                                                                                // 交通费
    ChargeAmount         float64           `gorm:"charge_amount" json:"chargeAmount"`                                                                      // 收费金额
    TimeSpentId          int               `gorm:"time_spent_id" json:"timeSpentId"`                                                                       // 花费时间
    FaqId                int               `gorm:"problem_id" json:"faqId"`                                                                                // 常见问题id
    ProblemDesc          string            `gorm:"problem_desc" json:"problemDesc"`                                                                        // 问题描述
    Solution             string            `gorm:"solution" json:"solution"`                                                                               // 解决方法
    SolutionRemark       string            `gorm:"solution_remark" json:"solutionRemark"`                                                                  // 内部备注
    Remark               string            `gorm:"remark" json:"remark"`                                                                                   // 备注
    CodeStandID          string            `json:"codeStandID"`                                                                                            //编码id
    CodeRule             code.CodeStandard `json:"codeRule"`
    ServiceNumber        string  `gorm:"service_number" json:"serviceNumber"`                                                                    // 服务单编号
    ClientId             int     `gorm:"client_id" json:"clientId"`                                                                              // 客户id
    ServiceContractId    int     `gorm:"service_contract_id" json:"serviceContractId"`                                                           // 合同id
    SalesDetailsId       int     `gorm:"sales_details_id" json:"salesDetailsId"`                                                                 // 销售订单id
    Subject              string  `gorm:"subject" json:"subject"`                                                                                 // 主题
    ProductTypeName      string  `json:"productTypeName"`                                                                                        // 产品分类名称
    ProductName          string  `json:"productName"`                                                                                            // 产品名称
    ServiceTypeId        int     `gorm:"service_type_id" json:"serviceTypeId"`                                                                   // 服务方式id
    ServiceManId         int     `gorm:"service_man_id" json:"serviceManId"`                                                                     // 服务人员
    ContactId            int     `gorm:"linkman_id" json:"contactId"`                                                                            // 联系人id
    Address              string  `gorm:"address" json:"address"`                                                                                 // 上门地址
    PriorityLevelId      int     `gorm:"priority_level_id" json:"priorityLevelId"`                                                               // 优先级别id
    AppointmentTime      string  `gorm:"appointment_time" json:"appointmentTime"`                                                                // 预约上门时间
    SaleChanceId         int     `gorm:"sale_leads" json:"saleChanceId"`                                                                         // 销售机会id
    FaultTypeId          int     `gorm:"severity_id" json:"faultTypeId"`                                                                         // 故障类别id
    SeverityId           int     `gorm:"severity_id" json:"severity"`                                                                            // 严重程度id
    ServiceOrderStatusId int     `gorm:"column:service_order_status_id;type:int;not null;default:0;comment:服务单状态id" json:"serviceOrderStatusId"` // 处理状态
    ExpectTime           string  `gorm:"expect_time" json:"expectTime"`                                                                          // 希望处理时间
    RealTime             string  `gorm:"real_time" json:"realTime"`                                                                              // 实际处理时间
    CarFare              float64 `gorm:"car_fare" json:"carFare"`                                                                                // 交通费
    ChargeAmount         float64 `gorm:"charge_amount" json:"chargeAmount"`                                                                      // 收费金额
    TimeSpentId          int     `gorm:"time_spent_id" json:"timeSpentId"`                                                                       // 花费时间
    FaqId                int     `gorm:"problem_id" json:"faqId"`                                                                                // 常见问题id
    ProblemDesc          string  `gorm:"problem_desc" json:"problemDesc"`                                                                        // 问题描述
    Solution             string  `gorm:"solution" json:"solution"`                                                                               // 解决方法
    SolutionRemark       string  `gorm:"solution_remark" json:"solutionRemark"`                                                                  // 内部备注
    Remark               string  `gorm:"remark" json:"remark"`                                                                                   // 备注
    CodeStandID          string  `json:"codeStandID"`                                                                                            //编码id
}
type UpdateServiceOrder struct {
model/request/subOrder.go
@@ -2,7 +2,6 @@
import (
    "aps_crm/model"
    "aps_crm/proto/code"
)
type AddSubOrder struct {
@@ -10,13 +9,12 @@
}
type SubOrder struct {
    ClientId      int               `json:"clientId"`
    MasterOrderId int               `json:"masterOrderId"`
    Number        string            `json:"number"`
    MemberId      int               `json:"memberId"`
    Product       []model.Product   `json:"product"`
    CodeStandID   string            `json:"codeStandID"` //编码id
    CodeRule      code.CodeStandard `json:"codeRule"`
    ClientId      int             `json:"clientId"`
    MasterOrderId int             `json:"masterOrderId"`
    Number        string          `json:"number"`
    MemberId      int             `json:"memberId"`
    Product       []model.Product `json:"product"`
    CodeStandID   string          `json:"codeStandID"` //编码id
}
type UpdateSubOrder struct {
model/saleChance.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -213,3 +214,20 @@
    var db = slf.build()
    return db.Updates(data).Error
}
func (slf *SaleChanceSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
model/salesDetails.go
@@ -40,6 +40,7 @@
        AmountUnInvoiced    decimal.Decimal   `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:未开票金额" json:"amountUnInvoiced"` // 未开票金额
        AmountTotal         decimal.Decimal   `gorm:"column:amount_total;type:decimal(12,2);comment:价税合计" json:"amountTotal"`              // 价税合计
        CodeStandID         string            `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"`
        DeliverType         int               `json:"deliverType" gorm:"column:deliver_type;type:int;comment:交付类型(1.一次发货,2.多次发货)"`
        CrmModel
    }
@@ -133,6 +134,30 @@
    return db.Updates(record).Error
}
func (slf *SalesDetailsSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *SalesDetailsSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *SalesDetailsSearch) SetId(id int) *SalesDetailsSearch {
    slf.Id = id
    return slf
model/salesLeads.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/constvar"
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -61,6 +62,9 @@
    }
    if slf.Name != "" {
        db = db.Where("name = ?", slf.Name)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -141,6 +145,30 @@
    return records, total, err
}
func (slf *SalesLeadsSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *SalesLeadsSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *SalesLeadsSearch) SetId(id int) *SalesLeadsSearch {
    slf.Id = id
    return slf
@@ -176,6 +204,11 @@
    return slf
}
func (slf *SalesLeadsSearch) SetNumber(number string) *SalesLeadsSearch {
    slf.Number = number
    return slf
}
func (slf *SalesLeadsSearch) SetSearchMap(data map[string]interface{}) *SalesLeadsSearch {
    slf.SearchMap = data
    return slf
model/salesRefund.go
@@ -116,6 +116,9 @@
    if len(slf.MemberIds) > 0 {
        db = db.Where("sales_refund.member_id in ?", slf.MemberIds)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    return db
}
@@ -169,6 +172,30 @@
    return records, total, err
}
func (slf *SalesRefundSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *SalesRefundSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *SalesRefundSearch) SetId(id int) *SalesRefundSearch {
    slf.Id = id
    return slf
@@ -214,6 +241,11 @@
    return slf
}
func (slf *SalesRefundSearch) SetNumber(number string) *SalesRefundSearch {
    slf.Number = number
    return slf
}
func (slf *SalesRefundSearch) UpdateByMap(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
model/salesReturn.go
@@ -114,6 +114,9 @@
    if len(slf.MemberIds) > 0 {
        db = db.Where("sales_return.member_id in ?", slf.MemberIds)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    return db
}
@@ -168,6 +171,30 @@
    return records, err
}
func (slf *SalesReturnSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *SalesReturnSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *SalesReturnSearch) SetId(id int) *SalesReturnSearch {
    slf.Id = id
    return slf
@@ -217,6 +244,11 @@
    return slf
}
func (slf *SalesReturnSearch) SetNumber(number string) *SalesReturnSearch {
    slf.Number = number
    return slf
}
func (slf *SalesReturnSearch) UpdateByMap(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
model/serviceContract.go
@@ -145,6 +145,9 @@
    if slf.ContactId != 0 {
        db = db.Where("contact_id = ?", slf.ContactId)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    return db
}
@@ -180,10 +183,39 @@
        db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
    }
    err := db.Order("id desc").Order("id desc").Find(&records).Error
    err := db.Order("id desc").Find(&records).Error
    return records, total, err
}
func (slf *ServiceContractSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *ServiceContractSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *ServiceContractSearch) SetNumber(number string) *ServiceContractSearch {
    slf.Number = number
    return slf
}
func (slf *ServiceContractSearch) SetId(id int) *ServiceContractSearch {
    slf.Id = id
    return slf
model/serviceFollowup.go
@@ -101,6 +101,9 @@
    if len(slf.MemberIds) > 0 {
        db = db.Where("service_followup.member_id in ?", slf.MemberIds)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    return db
}
@@ -142,6 +145,35 @@
    return records, total, err
}
func (slf *ServiceFollowupSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *ServiceFollowupSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *ServiceFollowupSearch) SetNumber(number string) *ServiceFollowupSearch {
    slf.Number = number
    return slf
}
func (slf *ServiceFollowupSearch) SetId(id int) *ServiceFollowupSearch {
    slf.Id = id
    return slf
model/serviceOrder.go
@@ -134,6 +134,9 @@
    if len(slf.ServiceManIds) > 0 {
        db = db.Where("service_man_id in ?", slf.ServiceManIds)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    return db
}
@@ -216,6 +219,11 @@
    return slf
}
func (slf *ServiceOrderSearch) SetNumber(number string) *ServiceOrderSearch {
    slf.Number = number
    return slf
}
func (slf *ServiceOrderSearch) First() (*ServiceOrder, error) {
    var db = slf.build()
    var record = new(ServiceOrder)
@@ -260,3 +268,27 @@
    var db = slf.build()
    return db.Updates(data).Error
}
func (slf *ServiceOrderSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *ServiceOrderSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
model/subOrder.go
@@ -2,6 +2,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "fmt"
    "gorm.io/gorm"
)
@@ -49,6 +50,9 @@
    if slf.Id != 0 {
        db = db.Where("id = ?", slf.Id)
    }
    if slf.Number != "" {
        db = db.Where("number = ?", slf.Number)
    }
    if len(slf.SearchMap) > 0 {
@@ -120,6 +124,30 @@
    return records, total, err
}
func (slf *SubOrderSearch) Count() (int64, error) {
    var db = slf.build()
    var total int64
    err := db.Count(&total).Error
    return total, err
}
func (slf *SubOrderSearch) MaxAutoIncr() (int, error) {
    type Result struct {
        Max int
    }
    var (
        result Result
        db     = slf.build()
    )
    err := db.Select("MAX(id) as max").Scan(&result).Error
    if err != nil {
        return result.Max, fmt.Errorf("max err: %v", err)
    }
    return result.Max, nil
}
func (slf *SubOrderSearch) SetId(id int) *SubOrderSearch {
    slf.Id = id
    return slf
@@ -143,6 +171,12 @@
    slf.Orm = slf.Orm.Where("id in (?)", ids)
    return slf
}
func (slf *SubOrderSearch) SetNumber(number string) *SubOrderSearch {
    slf.Number = number
    return slf
}
func (slf *SubOrderSearch) UpdateByMap(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
model/util.go
@@ -38,7 +38,7 @@
    } else { // 固定值
        prefixValue = codeStandard.AutoRule.PrefixValue
    }
    strMaxAutoIncr := strconv.Itoa(id)
    strMaxAutoIncr := strconv.Itoa(id + 1)
    count := int(codeStandard.AutoRule.AutoLength) - len(strMaxAutoIncr)
    for i := 0; i < count; i++ {
        strMaxAutoIncr = "0" + strMaxAutoIncr
router/index.go
@@ -197,7 +197,8 @@
    codeGroup := PrivateGroup.Group("code")
    codeApi := v1.CodeApi{}
    {
        codeGroup.GET("getCodeList", codeApi.GetCodeList) //获取编码列表
        codeGroup.GET("getCodeList", codeApi.GetCodeList)  //获取编码列表
        codeGroup.POST("getAutoCode", codeApi.GetAutoCode) //获取编码列表
    }
    return Router
}