...
|
...
|
@@ -209,6 +209,7 @@ func TemplateList(uid, companyId int64, request *protocol.TemplateListRequest) ( |
|
|
Name: t.Name,
|
|
|
Icon: t.Icon,
|
|
|
Code: t.Code,
|
|
|
Sort: t.SortNum,
|
|
|
}
|
|
|
rsp.List = append(rsp.List, item)
|
|
|
if templates, err = models.GetAuditTemplateByTypeId(t.Id); err != nil {
|
...
|
...
|
@@ -336,6 +337,7 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs |
|
|
Name: template.Name,
|
|
|
Doc: template.Doc,
|
|
|
Icon: template.Icon,
|
|
|
Code: template.Code,
|
|
|
}
|
|
|
rsp.Example = template.Example
|
|
|
|
...
|
...
|
@@ -385,6 +387,11 @@ func TemplateDelete(uid, companyId int64, request *protocol.TemplateDeleteReques |
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
orm := orm2.NewOrm()
|
|
|
if err = utils.ExecuteSQLWithOrmer(orm, models.DeleteAuditFormBy, request.TemplateId, companyId); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.TemplateDeleteResponse{}
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -473,11 +480,15 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
|
|
var (
|
|
|
chanceType *models.ChanceType
|
|
|
num int
|
|
|
sql1 string = `select count(0) from from audit_template where chance_type_id =? limit 1`
|
|
|
sql1 string = `select count(0) from audit_template where chance_type_id =? limit 1`
|
|
|
sql2 string = `select count(0) from chance where chance_type_id = ? limit 1`
|
|
|
)
|
|
|
rsp = &protocol.TemplateDeleteCategoryResponse{}
|
|
|
if chanceType, err = models.GetChanceTypeById(request.ChanceTypeId); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
if err == orm2.ErrNoRows {
|
|
|
err = protocol.NewErrWithMessage("10067")
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
if chanceType.CompanyId != int(companyId) {
|
...
|
...
|
@@ -501,7 +512,6 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele |
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.TemplateDeleteCategoryResponse{}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|