正在显示
4 个修改的文件
包含
23 行增加
和
6 行删除
| @@ -19,6 +19,7 @@ require ( | @@ -19,6 +19,7 @@ require ( | ||
| 19 | github.com/onsi/ginkgo v1.14.2 | 19 | github.com/onsi/ginkgo v1.14.2 |
| 20 | github.com/onsi/gomega v1.10.3 | 20 | github.com/onsi/gomega v1.10.3 |
| 21 | github.com/sergi/go-diff v1.2.0 // indirect | 21 | github.com/sergi/go-diff v1.2.0 // indirect |
| 22 | + github.com/shopspring/decimal v1.2.0 | ||
| 22 | github.com/sirupsen/logrus v1.8.1 // indirect | 23 | github.com/sirupsen/logrus v1.8.1 // indirect |
| 23 | github.com/smartystreets/goconvey v1.6.4 // indirect | 24 | github.com/smartystreets/goconvey v1.6.4 // indirect |
| 24 | github.com/valyala/fasthttp v1.28.0 // indirect | 25 | github.com/valyala/fasthttp v1.28.0 // indirect |
| @@ -27,5 +28,4 @@ require ( | @@ -27,5 +28,4 @@ require ( | ||
| 27 | github.com/yudai/gojsondiff v1.0.0 // indirect | 28 | github.com/yudai/gojsondiff v1.0.0 // indirect |
| 28 | github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect | 29 | github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect |
| 29 | github.com/yudai/pp v2.0.1+incompatible // indirect | 30 | github.com/yudai/pp v2.0.1+incompatible // indirect |
| 30 | - github.com/shopspring/decimal v1.2.0 | ||
| 31 | ) | 31 | ) |
| @@ -223,6 +223,8 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= | @@ -223,6 +223,8 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= | ||
| 223 | github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= | 223 | github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= |
| 224 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= | 224 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= |
| 225 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= | 225 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= |
| 226 | +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= | ||
| 227 | +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= | ||
| 226 | github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= | 228 | github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= |
| 227 | github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= | 229 | github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= |
| 228 | github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= | 230 | github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= |
| @@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
| 10 | 10 | ||
| 11 | type UpdateCooperationModeCommand struct { | 11 | type UpdateCooperationModeCommand struct { |
| 12 | // 共创模式ID | 12 | // 共创模式ID |
| 13 | - CooperationModeId int64 `cname:"共创模式id" json:"cooperationModeId" valid:"Required"` | 13 | + CooperationModeId int64 `cname:"共创模式ID" json:"cooperationModeId" valid:"Required"` |
| 14 | // 共创模式名称 | 14 | // 共创模式名称 |
| 15 | CooperationModeName string `cname:"共创模式名称" json:"cooperationModeName" valid:"Required"` | 15 | CooperationModeName string `cname:"共创模式名称" json:"cooperationModeName" valid:"Required"` |
| 16 | // 备注 | 16 | // 备注 |
| @@ -209,10 +209,8 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo | @@ -209,10 +209,8 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo | ||
| 209 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 209 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 210 | } | 210 | } |
| 211 | return map[string]interface{}{ | 211 | return map[string]interface{}{ |
| 212 | - //"grid": map[string]interface{}{ | ||
| 213 | "list": cooperationModes, | 212 | "list": cooperationModes, |
| 214 | "total": count, | 213 | "total": count, |
| 215 | - //}, | ||
| 216 | }, nil | 214 | }, nil |
| 217 | } | 215 | } |
| 218 | } | 216 | } |
| @@ -330,10 +328,8 @@ func (cooperationModeService *CooperationModeService) SearchCooperationMode(sear | @@ -330,10 +328,8 @@ func (cooperationModeService *CooperationModeService) SearchCooperationMode(sear | ||
| 330 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 328 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 331 | } | 329 | } |
| 332 | return map[string]interface{}{ | 330 | return map[string]interface{}{ |
| 333 | - //"grid": map[string]interface{}{ | ||
| 334 | "list": cooperationModes, | 331 | "list": cooperationModes, |
| 335 | "total": count, | 332 | "total": count, |
| 336 | - //}, | ||
| 337 | }, nil | 333 | }, nil |
| 338 | } | 334 | } |
| 339 | } | 335 | } |
| @@ -361,6 +357,25 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | @@ -361,6 +357,25 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | ||
| 361 | } else { | 357 | } else { |
| 362 | cooperationModeRepository = value | 358 | cooperationModeRepository = value |
| 363 | } | 359 | } |
| 360 | + // 共创模式DAO初始化 | ||
| 361 | + var cooperationModeDao *dao.CooperationModeDao | ||
| 362 | + if value, err := factory.CreateCooperationModeDao(map[string]interface{}{ | ||
| 363 | + "transactionContext": transactionContext, | ||
| 364 | + }); err != nil { | ||
| 365 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 366 | + } else { | ||
| 367 | + cooperationModeDao = value | ||
| 368 | + } | ||
| 369 | + // 校验共创模式名称唯一性 | ||
| 370 | + nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{ | ||
| 371 | + "companyId": updateCooperationModeCommand.CompanyId, | ||
| 372 | + "orgId": updateCooperationModeCommand.OrgId, | ||
| 373 | + "cooperationModeName": updateCooperationModeCommand.CooperationModeName, | ||
| 374 | + }) | ||
| 375 | + if !nameAvailable { | ||
| 376 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "模式名称已存在") | ||
| 377 | + } | ||
| 378 | + | ||
| 364 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) | 379 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) |
| 365 | if err != nil { | 380 | if err != nil { |
| 366 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 381 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
-
请 注册 或 登录 后发表评论