|
@@ -209,6 +209,7 @@ func TemplateList(uid, companyId int64, request *protocol.TemplateListRequest) ( |
|
@@ -209,6 +209,7 @@ func TemplateList(uid, companyId int64, request *protocol.TemplateListRequest) ( |
209
|
Name: t.Name,
|
209
|
Name: t.Name,
|
210
|
Icon: t.Icon,
|
210
|
Icon: t.Icon,
|
211
|
Code: t.Code,
|
211
|
Code: t.Code,
|
|
|
212
|
+ Sort: t.SortNum,
|
212
|
}
|
213
|
}
|
213
|
rsp.List = append(rsp.List, item)
|
214
|
rsp.List = append(rsp.List, item)
|
214
|
if templates, err = models.GetAuditTemplateByTypeId(t.Id); err != nil {
|
215
|
if templates, err = models.GetAuditTemplateByTypeId(t.Id); err != nil {
|
|
@@ -336,6 +337,7 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs |
|
@@ -336,6 +337,7 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs |
336
|
Name: template.Name,
|
337
|
Name: template.Name,
|
337
|
Doc: template.Doc,
|
338
|
Doc: template.Doc,
|
338
|
Icon: template.Icon,
|
339
|
Icon: template.Icon,
|
|
|
340
|
+ Code: template.Code,
|
339
|
}
|
341
|
}
|
340
|
rsp.Example = template.Example
|
342
|
rsp.Example = template.Example
|
341
|
|
343
|
|
|
@@ -385,6 +387,11 @@ func TemplateDelete(uid, companyId int64, request *protocol.TemplateDeleteReques |
|
@@ -385,6 +387,11 @@ func TemplateDelete(uid, companyId int64, request *protocol.TemplateDeleteReques |
385
|
log.Error(err.Error())
|
387
|
log.Error(err.Error())
|
386
|
return
|
388
|
return
|
387
|
}
|
389
|
}
|
|
|
390
|
+ orm := orm2.NewOrm()
|
|
|
391
|
+ if err = utils.ExecuteSQLWithOrmer(orm, models.DeleteAuditFormBy, request.TemplateId, companyId); err != nil {
|
|
|
392
|
+ log.Error(err.Error())
|
|
|
393
|
+ return
|
|
|
394
|
+ }
|
388
|
rsp = &protocol.TemplateDeleteResponse{}
|
395
|
rsp = &protocol.TemplateDeleteResponse{}
|
389
|
return
|
396
|
return
|
390
|
}
|
397
|
}
|
|
@@ -473,11 +480,15 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
|
@@ -473,11 +480,15 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
473
|
var (
|
480
|
var (
|
474
|
chanceType *models.ChanceType
|
481
|
chanceType *models.ChanceType
|
475
|
num int
|
482
|
num int
|
476
|
- sql1 string = `select count(0) from from audit_template where chance_type_id =? limit 1`
|
483
|
+ sql1 string = `select count(0) from audit_template where chance_type_id =? limit 1`
|
477
|
sql2 string = `select count(0) from chance where chance_type_id = ? limit 1`
|
484
|
sql2 string = `select count(0) from chance where chance_type_id = ? limit 1`
|
478
|
)
|
485
|
)
|
|
|
486
|
+ rsp = &protocol.TemplateDeleteCategoryResponse{}
|
479
|
if chanceType, err = models.GetChanceTypeById(request.ChanceTypeId); err != nil {
|
487
|
if chanceType, err = models.GetChanceTypeById(request.ChanceTypeId); err != nil {
|
480
|
log.Error(err.Error())
|
488
|
log.Error(err.Error())
|
|
|
489
|
+ if err == orm2.ErrNoRows {
|
|
|
490
|
+ err = protocol.NewErrWithMessage("10067")
|
|
|
491
|
+ }
|
481
|
return
|
492
|
return
|
482
|
}
|
493
|
}
|
483
|
if chanceType.CompanyId != int(companyId) {
|
494
|
if chanceType.CompanyId != int(companyId) {
|
|
@@ -501,7 +512,6 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
|
@@ -501,7 +512,6 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
501
|
log.Error(err.Error())
|
512
|
log.Error(err.Error())
|
502
|
return
|
513
|
return
|
503
|
}
|
514
|
}
|
504
|
- rsp = &protocol.TemplateDeleteCategoryResponse{}
|
|
|
505
|
return
|
515
|
return
|
506
|
}
|
516
|
}
|
507
|
|
517
|
|