| | |
| | | return |
| | | } |
| | | err := model.WithTransaction(func(db *gorm.DB) error { |
| | | err := model.NewSystemSetSearch().SetOrm(db).SetTypes(params.SystemTypes).DeleteAll() |
| | | err := model.NewSystemSetSearch().SetOrm(db).DeleteAll() |
| | | if err != nil { |
| | | return err |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/system/useSystemSet/{modeType}": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置" |
| | | ], |
| | | "summary": "使用系统设置", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "查询参数", |
| | | "name": "modeType", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timeSpent/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "modeType": { |
| | | "type": "string" |
| | | }, |
| | | "systemType": { |
| | | "name": { |
| | | "type": "string" |
| | | }, |
| | | "value": { |
| | |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.SystemSet" |
| | | } |
| | | }, |
| | | "systemTypes": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/system/useSystemSet/{modeType}": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置" |
| | | ], |
| | | "summary": "使用系统设置", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "查询参数", |
| | | "name": "modeType", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/response.ListResponse" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/timeSpent/add": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "modeType": { |
| | | "type": "string" |
| | | }, |
| | | "systemType": { |
| | | "name": { |
| | | "type": "string" |
| | | }, |
| | | "value": { |
| | |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.SystemSet" |
| | | } |
| | | }, |
| | | "systemTypes": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | } |
| | |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | modeType: |
| | | type: string |
| | | systemType: |
| | | name: |
| | | type: string |
| | | value: |
| | | type: string |
| | |
| | | sets: |
| | | items: |
| | | $ref: '#/definitions/model.SystemSet' |
| | | type: array |
| | | systemTypes: |
| | | items: |
| | | type: string |
| | | type: array |
| | | type: object |
| | | request.SetAuthorityMenu: |
| | |
| | | summary: 保存系统设置 |
| | | tags: |
| | | - 系统设置 |
| | | /api/system/useSystemSet/{modeType}: |
| | | get: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: path |
| | | name: modeType |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/response.ListResponse' |
| | | summary: 使用系统设置 |
| | | tags: |
| | | - 系统设置 |
| | | /api/timeSpent/add: |
| | | post: |
| | | parameters: |
| | |
| | | import "aps_crm/model" |
| | | |
| | | type SaveSystemSet struct { |
| | | SystemTypes []string `json:"systemTypes"` |
| | | Sets []*model.SystemSet `json:"sets"` |
| | | Sets []*model.SystemSet `json:"sets"` |
| | | } |
| | |
| | | } |
| | | SystemSetSearch struct { |
| | | SystemSet |
| | | Types []string |
| | | Orm *gorm.DB |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | func (slf *SystemSetSearch) SetTypes(types []string) *SystemSetSearch { |
| | | slf.Types = types |
| | | return slf |
| | | } |
| | | func (slf *SystemSetSearch) SetName(name string) *SystemSetSearch { |
| | | slf.Name = name |
| | | return slf |
| | |
| | | func (slf *SystemSetSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | | if len(slf.Types) > 0 { |
| | | db = db.Where("system_type in (?)", slf.Types) |
| | | } |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |