master
huanghai 5 years ago
parent 85fde55232
commit 64275365f5

@ -187,7 +187,7 @@ func ListApp(keyword string, page int, limit int) ([]map[string]interface{}, int
/**
*/
func SaveAppIdentity(identityId int, appId string) error {
func SaveAppIdentity(appId string, identityIds []int) error {
sql := `delete from t_app_identity where appId=?`
_, err := db.SQL(sql, appId).Execute()
if err != nil {
@ -195,9 +195,11 @@ func SaveAppIdentity(identityId int, appId string) error {
}
sql = `insert into t_app_identity(app_id,identity_id) values(?,?)`
_, err = db.SQL(sql, appId, identityId).Execute()
if err != nil {
return err
for i := range identityIds {
_, err = db.SQL(sql, appId, identityIds[i]).Execute()
if err != nil {
return err
}
}
return nil
}
@ -214,7 +216,7 @@ func GetAppIdentity(appId string) ([]map[string]interface{}, error) {
/**
*/
func SaveAppPosition(appId string, positionId string) error {
func SaveAppPosition(appId string, positionIds []string) error {
sql := `delete from t_app_position where appId=?`
_, err := db.SQL(sql, appId).Execute()
if err != nil {
@ -222,9 +224,11 @@ func SaveAppPosition(appId string, positionId string) error {
}
sql = `insert into t_app_position(app_id,position_id) values(?,?)`
_, err = db.SQL(sql, appId, positionId).Execute()
if err != nil {
return err
for i := range positionIds {
_, err = db.SQL(sql, appId, positionIds[i]).Execute()
if err != nil {
return err
}
}
return nil
}
@ -241,7 +245,7 @@ func GetAppPosition(appId string) ([]map[string]interface{}, error) {
/**
*/
func SaveAppStage(appId string, positionIds []string) error {
func SaveAppStage(appId string, stageIds []string) error {
sql := `delete from t_app_stage where appId=?`
_, err := db.SQL(sql, appId).Execute()
if err != nil {
@ -249,9 +253,9 @@ func SaveAppStage(appId string, positionIds []string) error {
}
sql = `insert into t_app_stage(app_id,stage_id) values(?,?)`
if len(positionIds) > 0 {
for i := range positionIds {
_, err = db.SQL(sql, appId, positionIds[i]).Execute()
if len(stageIds) > 0 {
for i := range stageIds {
_, err = db.SQL(sql, appId, stageIds[i]).Execute()
if err != nil {
return err
}

Loading…
Cancel
Save