|
|
|
@ -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
|
|
|
|
|
}
|
|
|
|
|